AWS SDK for C++  1.8.21
AWS SDK for C++
XmlSerializer.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 
10 #include <aws/core/utils/Outcome.h>
13 
14 namespace Aws
15 {
16  namespace External
17  {
18  namespace tinyxml2
19  {
20  class XMLNode;
21 
22  class XMLDocument;
23  } // namespace tinyxml2
24  } // namespace External
25 } // namespace Aws
26 
27 namespace Aws
28 {
29  template<typename PAYLOAD_TYPE>
30  class AmazonWebServiceResult;
31  namespace Client
32  {
33  enum class CoreErrors;
34  template<typename ERROR_TYPE>
35  class AWSError;
36  class AWSXMLClient;
37  } // namespace Client
38  namespace Utils
39  {
40  namespace Xml
41  {
46 
47  class XmlDocument;
48 
53  {
54  public:
58  XmlNode(const XmlNode& other);
62  XmlNode& operator=(const XmlNode& other);
66  const Aws::String GetName() const;
70  void SetName(const Aws::String& name);
74  const Aws::String GetAttributeValue(const Aws::String& name) const;
78  void SetAttributeValue(const Aws::String& name, const Aws::String& value);
82  Aws::String GetText() const;
86  void SetText(const Aws::String& textValue);
90  bool HasNextNode() const;
94  XmlNode NextNode() const;
98  XmlNode NextNode(const char* name) const;
102  XmlNode NextNode(const Aws::String& name) const;
106  XmlNode FirstChild() const;
110  XmlNode FirstChild(const char* name) const;
114  XmlNode FirstChild(const Aws::String& name) const;
118  bool HasChildren() const;
122  XmlNode Parent() const;
126  XmlNode CreateChildElement(const Aws::String& name);
130  XmlNode CreateSiblingElement(const Aws::String& name);
134  bool IsNull();
135 
136  private:
137  XmlNode(Aws::External::tinyxml2::XMLNode* node, const XmlDocument& document) :
138  m_node(node), m_doc(&document)
139  {
140  }
141 
142  //we do not own these.... I just had to change it from ref because the compiler was
143  //confused about which assignment operator to call. Do not... I repeat... do not delete
144  //these pointers in your destructor.
146  const XmlDocument* m_doc;
147 
148  friend class XmlDocument;
149  };
150 
156  {
157  public:
161  XmlDocument(const XmlDocument& other);
162  XmlDocument(XmlDocument&& doc);
163 
164  XmlDocument& operator=(const XmlDocument& other);
165  XmlDocument& operator=(XmlDocument&& other);
166 
167  ~XmlDocument();
168 
172  XmlNode GetRootElement() const;
176  Aws::String ConvertToString() const;
181  bool WasParseSuccessful() const;
185  Aws::String GetErrorMessage() const;
189  static XmlDocument CreateFromXmlStream(Aws::IOStream&);
193  static XmlDocument CreateFromXmlString(const Aws::String&);
197  static XmlDocument CreateWithRootNode(const Aws::String&);
198 
199  private:
200  XmlDocument();
201  void InitDoc();
202 
204 
205  friend class XmlNode;
206 
207  //allow outcome call the default constructor to handle it's error case.
208  friend class Aws::Utils::Outcome<Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>, Aws::Client::AWSError<Aws::Client::CoreErrors>>;
209  friend class Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>;
210  template<typename T>
211  friend class Client::AWSError;
212  friend class Client::AWSXMLClient;
213  };
214 
215  } // namespace Xml
216  } // namespace Utils
217 } // namespace Aws
218 
const char *const name
Definition: cJSON.h:261
std::basic_iostream< char, std::char_traits< char > > IOStream
Definition: AWSStreamFwd.h:22
AWS_CORE_API Aws::String DecodeEscapedXmlText(const Aws::String &textToDecode)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
#define AWS_CORE_API
Definition: Core_EXPORTS.h:25