CXmlDocumentInfoBase.h
Go to the documentation of this file.
1 #ifndef iser_CXmlDocumentInfoBase_included
2 #define iser_CXmlDocumentInfoBase_included
3 
4 
5 // Qt includes
6 #include <QtCore/QString>
7 #include <QtCore/QMap>
8 
9 
10 namespace iser
11 {
12 
13 
19 {
20 public:
22 
27  bool IsCommentEnabled() const;
32  void SetCommentEnabled(bool state = true);
33 
34  // static methods
35  static void EncodeXml(const QByteArray& text, QByteArray& xmlText);
36  static void DecodeXml(const QByteArray& xmlText, QByteArray& text);
37  static void EncodeXml(const QString& text, QByteArray& xmlText);
38  static void DecodeXml(const QByteArray& xmlText, QString& text);
39  static const QString& GetElementSeparator();
40 
41 protected:
42  class CharToEntityMap: public QMap<char, QByteArray>
43  {
44  public:
46  };
47 
48  class EntityToChartMap: public QMap<QByteArray, char>
49  {
50  public:
52  };
53 
54  class WideCharToEntityMap: public QMap<QChar, QByteArray >
55  {
56  public:
58  };
59 
60  class EntityToWideChartMap: public QMap<QByteArray, QChar>
61  {
62  public:
64  };
65 
66 private:
67  bool m_isCommentEnabled;
68 
69  static CharToEntityMap s_charToEntityMap;
70  static EntityToChartMap s_entityToChartMap;
71  static WideCharToEntityMap s_wideCharToEntityMap;
72  static EntityToWideChartMap s_entityToWideChartMap;
73 
74  static QString s_elementSeparator;
75 };
76 
77 
78 // inline methods
79 
81 {
82  return m_isCommentEnabled;
83 }
84 
85 
87 {
88  m_isCommentEnabled = state;
89 }
90 
91 
92 } // namespace iser
93 
94 
95 #endif // !iser_CXmlDocumentInfoBase_included
96 
97 
static const QString & GetElementSeparator()
void SetCommentEnabled(bool state=true)
Allows comments in XML document.
Base class for all XML implementations for ACF documents.
static void EncodeXml(const QByteArray &text, QByteArray &xmlText)
static void DecodeXml(const QByteArray &xmlText, QByteArray &text)
bool IsCommentEnabled() const
Check if comments in XML document are enabled.

© 2007-2017 Witold Gantzke and Kirill Lepskiy