soc.2009.transport: 403309f6: Added missing files parser.cpp

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Thu Jul 2 15:55:29 EDT 2009


-----------------------------------------------------------------
Revision: 403309f64ae2a9a5e5271e96f4c952340156c8f9
Ancestor: 5752f6e8e419dc2b65c17b80464c18997aa89e5c
Author: hanzz at soc.pidgin.im
Date: 2009-07-02T19:53:35
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/403309f64ae2a9a5e5271e96f4c952340156c8f9

Added files:
        parser.cpp parser.h

ChangeLog: 

Added missing files parser.cpp

-------------- next part --------------
============================================================
--- parser.cpp	0713e3dee945222b9f52dbb1ebef0859d5a750f1
+++ parser.cpp	0713e3dee945222b9f52dbb1ebef0859d5a750f1
@@ -0,0 +1,43 @@
+/**
+ * XMPP - libpurple transport
+ *
+ * Copyright (C) 2009, Jan Kaluza <hanzz at soc.pidgin.im>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+ 
+#include "parser.h"
+ 
+GlooxParser::GlooxParser() {
+	m_parser = new Parser(this);
+}
+
+GlooxParser::~GlooxParser() {
+	delete m_parser;
+}
+
+void GlooxParser::getTag(std::string str, void (*handleTagCallback)(Tag *tag, Tag *user_data), Tag *userdata) {
+	m_userdata = userdata;
+	m_handleTagCallback = handleTagCallback;
+
+	m_parser->cleanup();
+	m_parser->feed(str);
+}
+
+void GlooxParser::handleTag(Tag *tag) {
+	m_handleTagCallback(tag->clone(), m_userdata);
+}
+
+
============================================================
--- parser.h	05f0731faafd1ec20403817cefba317e1ffdcd96
+++ parser.h	05f0731faafd1ec20403817cefba317e1ffdcd96
@@ -0,0 +1,47 @@
+/**
+ * XMPP - libpurple transport
+ *
+ * Copyright (C) 2009, Jan Kaluza <hanzz at soc.pidgin.im>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+ 
+#ifndef _HI_PARSER_H
+#define _HI_PARSER_H
+
+#include <string>
+#include "gloox/parser.h"
+#include "gloox/taghandler.h"
+
+using namespace gloox;
+
+class GlooxParser : public TagHandler
+{
+	public:
+		GlooxParser();
+		~GlooxParser();
+		void getTag(std::string str, void (*handleTagCallback)(Tag *tag, Tag *user_data), Tag *userdata);
+
+		// TagHandler
+		void handleTag (Tag *tag);
+
+	private:
+		Parser *m_parser;
+		void (*m_handleTagCallback)(Tag *tag, Tag *user_data);
+		Tag *m_userdata;
+};
+
+#endif
+ 
\ No newline at end of file


More information about the Commits mailing list