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 <string> | 15 #include <string> |
15 #include <vector> | 16 #include <vector> |
16 #include "webrtc/libjingle/xmllite/qname.h" | 17 #include "webrtc/libjingle/xmllite/qname.h" |
17 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
18 | 19 |
19 namespace buzz { | 20 namespace buzz { |
20 | 21 |
21 class XmlnsStack { | 22 class XmlnsStack { |
22 public: | 23 public: |
23 XmlnsStack(); | 24 XmlnsStack(); |
24 ~XmlnsStack(); | 25 ~XmlnsStack(); |
25 | 26 |
26 void AddXmlns(const std::string& prefix, const std::string& ns); | 27 void AddXmlns(const std::string& prefix, const std::string& ns); |
27 void RemoveXmlns(); | 28 void RemoveXmlns(); |
28 void PushFrame(); | 29 void PushFrame(); |
29 void PopFrame(); | 30 void PopFrame(); |
30 void Reset(); | 31 void Reset(); |
31 | 32 |
32 std::pair<std::string, bool> NsForPrefix(const std::string& prefix); | 33 std::pair<std::string, bool> NsForPrefix(const std::string& prefix); |
33 bool PrefixMatchesNs(const std::string & prefix, const std::string & ns); | 34 bool PrefixMatchesNs(const std::string & prefix, const std::string & ns); |
34 std::pair<std::string, bool> PrefixForNs(const std::string& ns, bool isAttr); | 35 std::pair<std::string, bool> PrefixForNs(const std::string& ns, bool isAttr); |
35 std::pair<std::string, bool> AddNewPrefix(const std::string& ns, bool isAttr); | 36 std::pair<std::string, bool> AddNewPrefix(const std::string& ns, bool isAttr); |
36 std::string FormatQName(const QName & name, bool isAttr); | 37 std::string FormatQName(const QName & name, bool isAttr); |
37 | 38 |
38 private: | 39 private: |
39 | 40 |
40 rtc::scoped_ptr<std::vector<std::string> > pxmlnsStack_; | 41 std::unique_ptr<std::vector<std::string> > pxmlnsStack_; |
41 rtc::scoped_ptr<std::vector<size_t> > pxmlnsDepthStack_; | 42 std::unique_ptr<std::vector<size_t> > pxmlnsDepthStack_; |
42 }; | 43 }; |
43 } | 44 } |
44 | 45 |
45 #endif // WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ | 46 #endif // WEBRTC_LIBJINGLE_XMLLITE_XMLNSSTACK_H_ |
OLD | NEW |