annotate DEPENDENCIES/generic/include/boost/archive/impl/basic_xml_grammar.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 #ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
Chris@16 2 #define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
Chris@16 3
Chris@16 4 // MS compatible compilers support #pragma once
Chris@101 5 #if defined(_MSC_VER)
Chris@16 6 # pragma once
Chris@16 7 #endif
Chris@16 8
Chris@16 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
Chris@16 10 // basic_xml_grammar.hpp
Chris@16 11
Chris@16 12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
Chris@16 13 // Use, modification and distribution is subject to the Boost Software
Chris@16 14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 15 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 16
Chris@16 17 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 18
Chris@16 19 // this module is derived from simplexml.cpp - an example shipped as part of
Chris@16 20 // the spirit parser. This example contains the following notice:
Chris@16 21 /*=============================================================================
Chris@16 22 simplexml.cpp
Chris@16 23
Chris@16 24 Spirit V1.3
Chris@16 25 URL: http://spirit.sourceforge.net/
Chris@16 26
Chris@16 27 Copyright (c) 2001, Daniel C. Nuffer
Chris@16 28
Chris@16 29 This software is provided 'as-is', without any express or implied
Chris@16 30 warranty. In no event will the copyright holder be held liable for
Chris@16 31 any damages arising from the use of this software.
Chris@16 32
Chris@16 33 Permission is granted to anyone to use this software for any purpose,
Chris@16 34 including commercial applications, and to alter it and redistribute
Chris@16 35 it freely, subject to the following restrictions:
Chris@16 36
Chris@16 37 1. The origin of this software must not be misrepresented; you must
Chris@16 38 not claim that you wrote the original software. If you use this
Chris@16 39 software in a product, an acknowledgment in the product documentation
Chris@16 40 would be appreciated but is not required.
Chris@16 41
Chris@16 42 2. Altered source versions must be plainly marked as such, and must
Chris@16 43 not be misrepresented as being the original software.
Chris@16 44
Chris@16 45 3. This notice may not be removed or altered from any source
Chris@16 46 distribution.
Chris@16 47 =============================================================================*/
Chris@16 48 #include <string>
Chris@16 49
Chris@16 50 #include <boost/config.hpp>
Chris@16 51 #include <boost/detail/workaround.hpp>
Chris@16 52
Chris@16 53 #include <boost/spirit/include/classic_rule.hpp>
Chris@16 54 #include <boost/spirit/include/classic_chset.hpp>
Chris@16 55
Chris@16 56 #include <boost/archive/basic_archive.hpp>
Chris@16 57 #include <boost/serialization/tracking.hpp>
Chris@16 58 #include <boost/serialization/version.hpp>
Chris@16 59
Chris@16 60 namespace boost {
Chris@16 61 namespace archive {
Chris@16 62
Chris@16 63 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
Chris@16 64 // XML grammar parsing
Chris@16 65
Chris@16 66 template<class CharType>
Chris@16 67 class basic_xml_grammar {
Chris@16 68 public:
Chris@16 69 // The following is not necessary according to DR45, but at least
Chris@16 70 // one compiler (Compaq C++ 6.5 in strict_ansi mode) chokes otherwise.
Chris@16 71 struct return_values;
Chris@16 72 friend struct return_values;
Chris@16 73
Chris@16 74 private:
Chris@16 75 typedef BOOST_DEDUCED_TYPENAME std::basic_istream<CharType> IStream;
Chris@16 76 typedef BOOST_DEDUCED_TYPENAME std::basic_string<CharType> StringType;
Chris@16 77 typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::chset<CharType> chset_t;
Chris@16 78 typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::chlit<CharType> chlit_t;
Chris@16 79 typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::scanner<
Chris@16 80 BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::iterator
Chris@16 81 > scanner_t;
Chris@16 82 typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::rule<scanner_t> rule_t;
Chris@16 83 // Start grammar definition
Chris@16 84 rule_t
Chris@16 85 Reference,
Chris@16 86 Eq,
Chris@16 87 STag,
Chris@16 88 ETag,
Chris@16 89 LetterOrUnderscoreOrColon,
Chris@16 90 AttValue,
Chris@16 91 CharRef1,
Chris@16 92 CharRef2,
Chris@16 93 CharRef,
Chris@16 94 AmpRef,
Chris@16 95 LTRef,
Chris@16 96 GTRef,
Chris@16 97 AposRef,
Chris@16 98 QuoteRef,
Chris@16 99 CharData,
Chris@16 100 CharDataChars,
Chris@16 101 content,
Chris@16 102 AmpName,
Chris@16 103 LTName,
Chris@16 104 GTName,
Chris@16 105 ClassNameChar,
Chris@16 106 ClassName,
Chris@16 107 Name,
Chris@16 108 XMLDecl,
Chris@16 109 XMLDeclChars,
Chris@16 110 DocTypeDecl,
Chris@16 111 DocTypeDeclChars,
Chris@16 112 ClassIDAttribute,
Chris@16 113 ObjectIDAttribute,
Chris@16 114 ClassNameAttribute,
Chris@16 115 TrackingAttribute,
Chris@16 116 VersionAttribute,
Chris@16 117 UnusedAttribute,
Chris@16 118 Attribute,
Chris@16 119 SignatureAttribute,
Chris@16 120 SerializationWrapper,
Chris@16 121 NameHead,
Chris@16 122 NameTail,
Chris@16 123 AttributeList,
Chris@16 124 S;
Chris@16 125
Chris@16 126 // XML Character classes
Chris@16 127 chset_t
Chris@16 128 BaseChar,
Chris@16 129 Ideographic,
Chris@16 130 Char,
Chris@16 131 Letter,
Chris@16 132 Digit,
Chris@16 133 CombiningChar,
Chris@16 134 Extender,
Chris@16 135 Sch,
Chris@16 136 NameChar;
Chris@16 137
Chris@16 138 void init_chset();
Chris@16 139
Chris@16 140 bool my_parse(
Chris@16 141 IStream & is,
Chris@16 142 const rule_t &rule_,
Chris@16 143 const CharType delimiter = L'>'
Chris@16 144 ) const ;
Chris@16 145 public:
Chris@16 146 struct return_values {
Chris@16 147 StringType object_name;
Chris@16 148 StringType contents;
Chris@16 149 //class_id_type class_id;
Chris@16 150 int_least16_t class_id;
Chris@16 151 //object_id_type object_id;
Chris@16 152 uint_least32_t object_id;
Chris@16 153 //version_type version;
Chris@16 154 unsigned int version;
Chris@16 155 tracking_type tracking_level;
Chris@16 156 StringType class_name;
Chris@16 157 return_values() :
Chris@16 158 version(0),
Chris@16 159 tracking_level(false)
Chris@16 160 {}
Chris@16 161 } rv;
Chris@16 162 bool parse_start_tag(IStream & is) /*const*/;
Chris@16 163 bool parse_end_tag(IStream & is) const;
Chris@16 164 bool parse_string(IStream & is, StringType & s) /*const*/;
Chris@16 165 void init(IStream & is);
Chris@16 166 void windup(IStream & is);
Chris@16 167 basic_xml_grammar();
Chris@16 168 };
Chris@16 169
Chris@16 170 } // namespace archive
Chris@16 171 } // namespace boost
Chris@16 172
Chris@16 173 #endif // BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP