• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef TALK_XMLLITE_QNAME_H_
6 #define TALK_XMLLITE_QNAME_H_
7 
8 #include <string>
9 
10 namespace buzz {
11 
12 // Default libjingle's implementation of QName class is not threadsafe. This
13 // one is.
14 class QName
15 {
16 public:
17   QName();
18   QName(const std::string & ns, const std::string & local);
19   QName(bool add, const std::string & ns, const std::string & local);
20   explicit QName(const std::string & mergedOrLocal);
21 
Namespace()22   const std::string & Namespace() const { return namespace_; }
LocalPart()23   const std::string & LocalPart() const { return local_part_; }
24   std::string Merged() const;
25   int Compare(const QName & other) const;
26   bool operator==(const QName & other) const;
27   bool operator!=(const QName & other) const { return !operator==(other); }
28   bool operator<(const QName & other) const { return Compare(other) < 0; }
29 
30 private:
31   std::string namespace_;
32   std::string local_part_;
33 };
34 
35 }  // namespace buzz
36 
37 #endif  // TALK_XMLLITE_QNAME_H_
38