Warning, file /include/boost/archive/iterators/xml_escape.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP
0002 #define BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_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 #include <boost/assert.hpp>
0020 #include <boost/archive/iterators/escape.hpp>
0021
0022 namespace boost {
0023 namespace archive {
0024 namespace iterators {
0025
0026
0027
0028
0029 template<class Base>
0030 class xml_escape
0031 : public escape<xml_escape<Base>, Base>
0032 {
0033 friend class boost::iterator_core_access;
0034
0035 typedef escape<xml_escape<Base>, Base> super_t;
0036
0037 public:
0038 char fill(const char * & bstart, const char * & bend);
0039 wchar_t fill(const wchar_t * & bstart, const wchar_t * & bend);
0040
0041 template<class T>
0042 xml_escape(T start) :
0043 super_t(Base(static_cast< T >(start)))
0044 {}
0045
0046 xml_escape(const xml_escape & rhs) :
0047 super_t(rhs.base_reference())
0048 {}
0049 };
0050
0051 template<class Base>
0052 char xml_escape<Base>::fill(
0053 const char * & bstart,
0054 const char * & bend
0055 ){
0056 char current_value = * this->base_reference();
0057 switch(current_value){
0058 case '<':
0059 bstart = "<";
0060 bend = bstart + 4;
0061 break;
0062 case '>':
0063 bstart = ">";
0064 bend = bstart + 4;
0065 break;
0066 case '&':
0067 bstart = "&";
0068 bend = bstart + 5;
0069 break;
0070 case '"':
0071 bstart = """;
0072 bend = bstart + 6;
0073 break;
0074 case '\'':
0075 bstart = "'";
0076 bend = bstart + 6;
0077 break;
0078 default:
0079 bstart="";
0080 bend=bstart;
0081 return current_value;
0082 }
0083 return *bstart;
0084 }
0085
0086 template<class Base>
0087 wchar_t xml_escape<Base>::fill(
0088 const wchar_t * & bstart,
0089 const wchar_t * & bend
0090 ){
0091 wchar_t current_value = * this->base_reference();
0092 switch(current_value){
0093 case '<':
0094 bstart = L"<";
0095 bend = bstart + 4;
0096 break;
0097 case '>':
0098 bstart = L">";
0099 bend = bstart + 4;
0100 break;
0101 case '&':
0102 bstart = L"&";
0103 bend = bstart + 5;
0104 break;
0105 case '"':
0106 bstart = L""";
0107 bend = bstart + 6;
0108 break;
0109 case '\'':
0110 bstart = L"'";
0111 bend = bstart + 6;
0112 break;
0113 default:
0114 return current_value;
0115 }
0116 return *bstart;
0117 }
0118
0119 }
0120 }
0121 }
0122
0123 #endif