MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / print_escaped

Function print_escaped

extern/boost/boost/test/utils/xml_printer.hpp:44–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42// ************************************************************************** //
43
44inline void
45print_escaped( std::ostream& where_to, const_string value )
46{
47#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
48 static std::map<char,char const*> const char_type{{
49 {'<' , "lt"},
50 {'>' , "gt"},
51 {'&' , "amp"},
52 {'\'', "apos"},
53 {'"' , "quot"}
54 }};
55#else
56 static std::map<char,char const*> char_type;
57
58 if( char_type.empty() ) {
59 char_type['<'] = "lt";
60 char_type['>'] = "gt";
61 char_type['&'] = "amp";
62 char_type['\'']= "apos";
63 char_type['"'] = "quot";
64 }
65#endif
66
67 BOOST_TEST_FOREACH( char, c, value ) {
68 std::map<char,char const*>::const_iterator found_ref = char_type.find( c );
69
70 if( found_ref != char_type.end() )
71 where_to << '&' << found_ref->second << ';';
72 else
73 where_to << c;
74 }
75}
76
77//____________________________________________________________________________//
78

Callers 1

xml_printer.hppFile · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected