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

Side by Side Diff: third_party/libjingle_xmpp/xmllite/qname.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
« no previous file with comments | « third_party/libjingle_xmpp/xmllite/DEPS ('k') | third_party/libjingle_xmpp/xmllite/qname.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_XMLLITE_QNAME_H_
12 #define WEBRTC_LIBJINGLE_XMLLITE_QNAME_H_
13
14 #include <string>
15
16 namespace buzz {
17
18 class QName;
19
20 // StaticQName is used to represend constant quailified names. They
21 // can be initialized statically and don't need intializers code, e.g.
22 // const StaticQName QN_FOO = { "foo_namespace", "foo" };
23 //
24 // Beside this use case, QName should be used everywhere
25 // else. StaticQName instances are implicitly converted to QName
26 // objects.
27 struct StaticQName {
28 const char* const ns;
29 const char* const local;
30
31 bool operator==(const QName& other) const;
32 bool operator!=(const QName& other) const;
33 };
34
35 class QName {
36 public:
37 QName();
38 QName(const QName& qname);
39 QName(const StaticQName& const_value);
40 QName(const std::string& ns, const std::string& local);
41 explicit QName(const std::string& merged_or_local);
42 ~QName();
43
44 const std::string& Namespace() const { return namespace_; }
45 const std::string& LocalPart() const { return local_part_; }
46 std::string Merged() const;
47 bool IsEmpty() const;
48
49 int Compare(const StaticQName& other) const;
50 int Compare(const QName& other) const;
51
52 bool operator==(const StaticQName& other) const {
53 return Compare(other) == 0;
54 }
55 bool operator==(const QName& other) const {
56 return Compare(other) == 0;
57 }
58 bool operator!=(const StaticQName& other) const {
59 return Compare(other) != 0;
60 }
61 bool operator!=(const QName& other) const {
62 return Compare(other) != 0;
63 }
64 bool operator<(const QName& other) const {
65 return Compare(other) < 0;
66 }
67
68 private:
69 std::string namespace_;
70 std::string local_part_;
71 };
72
73 inline bool StaticQName::operator==(const QName& other) const {
74 return other.Compare(*this) == 0;
75 }
76
77 inline bool StaticQName::operator!=(const QName& other) const {
78 return other.Compare(*this) != 0;
79 }
80
81 } // namespace buzz
82
83 #endif // WEBRTC_LIBJINGLE_XMLLITE_QNAME_H_
OLDNEW
« no previous file with comments | « third_party/libjingle_xmpp/xmllite/DEPS ('k') | third_party/libjingle_xmpp/xmllite/qname.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698