38 void PrintString (
const std::string & val, google::protobuf::TextFormat::BaseTextGenerator* base_text_generator )
const override
43 escaped.reserve ( val.size() * 2 );
64 if ( c >= 32 && c < 127 )
72 snprintf ( buf,
sizeof ( buf ),
"\\%03o",
static_cast<unsigned char> ( c ) );
80 std::ostringstream output;
85 while ( ( found = escaped.find (
"\\n", pos ) ) != std::string::npos )
88 output << escaped.substr ( pos, found - pos + 2 );
90 if ( found + 2 < escaped.size() )
98 if ( pos < escaped.size() )
100 output << escaped.substr ( pos );
104 base_text_generator->PrintString ( output.str() );