MCPcopy Create free account
hub / github.com/davisking/dlib / parse_pi

Method parse_pi

dlib/xml_parser/xml_parser_kernel_1.h:1203–1246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201// ----------------------------------------------------------------------------------------
1202
1203 int xml_parser::
1204 parse_pi (
1205 const std::string& token,
1206 std::string& target,
1207 std::string& data
1208 )
1209 {
1210 target.erase();
1211 data.erase();
1212
1213 if (token.size() < 3) return -1;
1214
1215 std::istream::int_type ch = token[2];
1216 std::string::size_type i = 3;
1217 while (ch != ' ' && ch != '?' && ch != '\t' && ch != '\n' && ch!='\r')
1218 {
1219 if (i >= token.size()) return -1;
1220 target += ch;
1221 ch = token[i];
1222 ++i;
1223 }
1224 if (target.size() == 0)
1225 return -1;
1226
1227 // if we aren't at a ? character then go to the next character
1228 if (ch != '?' )
1229 {
1230 if (i >= token.size()) return -1;
1231 ch = token[i];
1232 ++i;
1233 }
1234
1235 // if we still aren't at the end of the processing instruction then
1236 // set this stuff in the data section
1237 while (ch != '?')
1238 {
1239 data += ch;
1240 if (i >= token.size()) return -1;
1241 ch = token[i];
1242 ++i;
1243 }
1244
1245 return 0;
1246 }
1247
1248// ----------------------------------------------------------------------------------------
1249

Callers

nothing calls this directly

Calls 2

eraseMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected