OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ | 11 #ifndef WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ |
12 #define WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ | 12 #define WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 #include "webrtc/libjingle/xmllite/qname.h" | 17 #include "webrtc/libjingle/xmllite/qname.h" |
18 #include "webrtc/base/scoped_ptr.h" | |
19 | 18 |
20 namespace buzz { | 19 namespace buzz { |
21 | 20 |
22 class XmlnsStack { | 21 class XmlnsStack { |
23 public: | 22 public: |
24 XmlnsStack(); | 23 XmlnsStack(); |
25 ~XmlnsStack(); | 24 ~XmlnsStack(); |
26 | 25 |
27 void AddXmlns(const std::string& prefix, const std::string& ns); | 26 void AddXmlns(const std::string& prefix, const std::string& ns); |
28 void RemoveXmlns(); | 27 void RemoveXmlns(); |
29 void PushFrame(); | 28 void PushFrame(); |
30 void PopFrame(); | 29 void PopFrame(); |
31 void Reset(); | 30 void Reset(); |
32 | 31 |
33 std::pair<std::string, bool> NsForPrefix(const std::string& prefix); | 32 std::pair<std::string, bool> NsForPrefix(const std::string& prefix); |
34 bool PrefixMatchesNs(const std::string & prefix, const std::string & ns); | 33 bool PrefixMatchesNs(const std::string & prefix, const std::string & ns); |
35 std::pair<std::string, bool> PrefixForNs(const std::string& ns, bool isAttr); | 34 std::pair<std::string, bool> PrefixForNs(const std::string& ns, bool isAttr); |
36 std::pair<std::string, bool> AddNewPrefix(const std::string& ns, bool isAttr); | 35 std::pair<std::string, bool> AddNewPrefix(const std::string& ns, bool isAttr); |
37 std::string FormatQName(const QName & name, bool isAttr); | 36 std::string FormatQName(const QName & name, bool isAttr); |
38 | 37 |
39 private: | 38 private: |
40 | 39 |
41 std::unique_ptr<std::vector<std::string> > pxmlnsStack_; | 40 std::unique_ptr<std::vector<std::string> > pxmlnsStack_; |
42 std::unique_ptr<std::vector<size_t> > pxmlnsDepthStack_; | 41 std::unique_ptr<std::vector<size_t> > pxmlnsDepthStack_; |
43 }; | 42 }; |
44 } | 43 } |
45 | 44 |
46 #endif // WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ | 45 #endif // WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ |
OLD | NEW |