Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: third_party/libjingle_xmpp/xmpp/xmppstanzaparser.h

Issue 2443903004: Add xmllite and xmpp sources to third_party/ (Closed)
Patch Set: Explicitly use webrtc_overrides/webrtc/base/logging.h Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_LIBJINGLE_XMPP_XMPPSTANZAPARSER_H_
12 #define WEBRTC_LIBJINGLE_XMPP_XMPPSTANZAPARSER_H_
13
14 #include "third_party/libjingle_xmpp/xmllite/xmlbuilder.h"
15 #include "third_party/libjingle_xmpp/xmllite/xmlparser.h"
16
17
18 namespace buzz {
19
20 class XmlElement;
21
22 class XmppStanzaParseHandler {
23 public:
24 virtual ~XmppStanzaParseHandler() {}
25 virtual void StartStream(const XmlElement * pelStream) = 0;
26 virtual void Stanza(const XmlElement * pelStanza) = 0;
27 virtual void EndStream() = 0;
28 virtual void XmlError() = 0;
29 };
30
31 class XmppStanzaParser {
32 public:
33 XmppStanzaParser(XmppStanzaParseHandler *psph);
34 bool Parse(const char * data, size_t len, bool isFinal)
35 { return parser_.Parse(data, len, isFinal); }
36 void Reset();
37
38 private:
39 class ParseHandler : public XmlParseHandler {
40 public:
41 ParseHandler(XmppStanzaParser * outer) : outer_(outer) {}
42 virtual void StartElement(XmlParseContext * pctx,
43 const char * name, const char ** atts)
44 { outer_->IncomingStartElement(pctx, name, atts); }
45 virtual void EndElement(XmlParseContext * pctx,
46 const char * name)
47 { outer_->IncomingEndElement(pctx, name); }
48 virtual void CharacterData(XmlParseContext * pctx,
49 const char * text, int len)
50 { outer_->IncomingCharacterData(pctx, text, len); }
51 virtual void Error(XmlParseContext * pctx,
52 XML_Error errCode)
53 { outer_->IncomingError(pctx, errCode); }
54 private:
55 XmppStanzaParser * const outer_;
56 };
57
58 friend class ParseHandler;
59
60 void IncomingStartElement(XmlParseContext * pctx,
61 const char * name, const char ** atts);
62 void IncomingEndElement(XmlParseContext * pctx,
63 const char * name);
64 void IncomingCharacterData(XmlParseContext * pctx,
65 const char * text, int len);
66 void IncomingError(XmlParseContext * pctx,
67 XML_Error errCode);
68
69 XmppStanzaParseHandler * psph_;
70 ParseHandler innerHandler_;
71 XmlParser parser_;
72 int depth_;
73 XmlBuilder builder_;
74
75 };
76
77
78 }
79
80 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPSTANZAPARSER_H_
OLDNEW
« no previous file with comments | « third_party/libjingle_xmpp/xmpp/xmpplogintask_unittest.cc ('k') | third_party/libjingle_xmpp/xmpp/xmppstanzaparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698