File indexing completed on 2025-01-18 09:28:28
0001 #ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
0002 #define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 #include <string>
0049
0050 #include <boost/config.hpp>
0051 #include <boost/detail/workaround.hpp>
0052
0053 #include <boost/spirit/include/classic_rule.hpp>
0054 #include <boost/spirit/include/classic_chset.hpp>
0055
0056 #include <boost/archive/basic_archive.hpp>
0057 #include <boost/serialization/tracking.hpp>
0058 #include <boost/serialization/version.hpp>
0059
0060 namespace boost {
0061 namespace archive {
0062
0063
0064
0065
0066 template<class CharType>
0067 class BOOST_SYMBOL_VISIBLE basic_xml_grammar {
0068 public:
0069
0070
0071 struct return_values;
0072 friend struct return_values;
0073
0074 private:
0075 typedef typename std::basic_istream<CharType> IStream;
0076 typedef typename std::basic_string<CharType> StringType;
0077 typedef typename boost::spirit::classic::chset<CharType> chset_t;
0078 typedef typename boost::spirit::classic::chlit<CharType> chlit_t;
0079 typedef typename boost::spirit::classic::scanner<
0080 typename std::basic_string<CharType>::iterator
0081 > scanner_t;
0082 typedef typename boost::spirit::classic::rule<scanner_t> rule_t;
0083
0084 rule_t
0085 Reference,
0086 Eq,
0087 STag,
0088 ETag,
0089 LetterOrUnderscoreOrColon,
0090 AttValue,
0091 CharRef1,
0092 CharRef2,
0093 CharRef,
0094 AmpRef,
0095 LTRef,
0096 GTRef,
0097 AposRef,
0098 QuoteRef,
0099 CharData,
0100 CharDataChars,
0101 content,
0102 AmpName,
0103 LTName,
0104 GTName,
0105 ClassNameChar,
0106 ClassName,
0107 Name,
0108 XMLDecl,
0109 XMLDeclChars,
0110 DocTypeDecl,
0111 DocTypeDeclChars,
0112 ClassIDAttribute,
0113 ObjectIDAttribute,
0114 ClassNameAttribute,
0115 TrackingAttribute,
0116 VersionAttribute,
0117 UnusedAttribute,
0118 Attribute,
0119 SignatureAttribute,
0120 SerializationWrapper,
0121 NameHead,
0122 NameTail,
0123 AttributeList,
0124 S;
0125
0126
0127 chset_t
0128 BaseChar,
0129 Ideographic,
0130 Char,
0131 Letter,
0132 Digit,
0133 CombiningChar,
0134 Extender,
0135 Sch,
0136 NameChar;
0137
0138 void init_chset();
0139
0140 bool my_parse(
0141 IStream & is,
0142 const rule_t &rule_,
0143 const CharType delimiter = L'>'
0144 ) const ;
0145 public:
0146 struct return_values {
0147 StringType object_name;
0148 StringType contents;
0149
0150 int_least16_t class_id;
0151
0152 uint_least32_t object_id;
0153
0154 unsigned int version;
0155 tracking_type tracking_level;
0156 StringType class_name;
0157 return_values() :
0158 version(0),
0159 tracking_level(false)
0160 {}
0161 } rv;
0162 bool parse_start_tag(IStream & is) ;
0163 bool parse_end_tag(IStream & is) const;
0164 bool parse_string(IStream & is, StringType & s) ;
0165 void init(IStream & is);
0166 bool windup(IStream & is);
0167 basic_xml_grammar();
0168 };
0169
0170 }
0171 }
0172
0173 #endif