File indexing completed on 2026-08-06 09:24:28
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef MYXML_ElementIO_hpp_included
0010 #define MYXML_ElementIO_hpp_included
0011
0012 #include <iostream>
0013
0014 #include "Element.h"
0015
0016 namespace XML {
0017
0018
0019
0020
0021
0022 class ElementIO {
0023
0024 public:
0025
0026
0027
0028
0029 template<class OStream>
0030 static void put(Element, OStream&);
0031
0032
0033
0034
0035 static Element get(std::istream&);
0036
0037
0038
0039
0040 static Element getAll(std::istream&);
0041
0042 private:
0043
0044
0045
0046
0047 static void strip(std::string&, const std::string& skip = "\n\t ");
0048
0049
0050
0051
0052 static std::istream& getline(std::istream&, std::string&, const std::string&);
0053
0054
0055
0056
0057 static void skip(std::istream&, const std::string& skip_chars = "\n\t ");
0058
0059
0060
0061
0062 struct Tag {
0063
0064
0065
0066
0067 enum EnumerateTagTypes {
0068
0069 Unknown = -1,
0070
0071 EmptyElement = 1,
0072
0073 ElementBegin = 2,
0074
0075 ProcessingInstruction = 3,
0076
0077 CharacterData = 4,
0078
0079 ParsedCharacterData = 5,
0080
0081 Comment = 6,
0082
0083 ElementEnd = 20
0084
0085 };
0086
0087
0088
0089
0090 int type;
0091
0092
0093
0094
0095 std::string content;
0096
0097
0098
0099
0100 std::map<std::string,std::string> attributes;
0101
0102
0103
0104
0105 Element produce() const;
0106
0107 };
0108
0109
0110
0111
0112 static void getTag(Tag&, std::istream&);
0113
0114
0115
0116
0117 static Element produce(std::list<Tag>&);
0118
0119
0120
0121
0122 static void produce(std::list<Tag>&, Element&);
0123
0124
0125
0126
0127 static void unexpectedEOF(const std::string& what = "");
0128
0129
0130
0131
0132 static void parseError(const std::string& what = "");
0133
0134 };
0135
0136 }
0137
0138 #include "ElementIO.tcc"
0139
0140 #endif