MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / PutString

Method PutString

ogsr_engine/xrCore/XML_Parser/tinyxml.cpp:37–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35bool TiXmlBase::condenseWhiteSpace = true;
36
37void TiXmlBase::PutString(const TIXML_STRING& str, TIXML_STRING* outString)
38{
39 int i = 0;
40
41 while (i < (int)str.length())
42 {
43 unsigned char c = (unsigned char)str[i];
44
45 if (c == '&' && i < ((int)str.length() - 2) && str[i + 1] == '#' && str[i + 2] == 'x')
46 {
47 // Hexadecimal character reference.
48 // Pass through unchanged.
49 // &#xA9; -- copyright symbol, for example.
50 //
51 // The -1 is a bug fix from Rob Laveaux. It keeps
52 // an overflow from happening if there is no ';'.
53 // There are actually 2 ways to exit this loop -
54 // while fails (error case) and break (semicolon found).
55 // However, there is no mechanism (currently) for
56 // this function to return an error.
57 while (i < (int)str.length() - 1)
58 {
59 outString->append(str.c_str() + i, 1);
60 ++i;
61 if (str[i] == ';')
62 break;
63 }
64 }
65 else if (c == '&')
66 {
67 outString->append(entity[0].str, entity[0].strLength);
68 ++i;
69 }
70 else if (c == '<')
71 {
72 outString->append(entity[1].str, entity[1].strLength);
73 ++i;
74 }
75 else if (c == '>')
76 {
77 outString->append(entity[2].str, entity[2].strLength);
78 ++i;
79 }
80 else if (c == '\"')
81 {
82 outString->append(entity[3].str, entity[3].strLength);
83 ++i;
84 }
85 else if (c == '\'')
86 {
87 outString->append(entity[4].str, entity[4].strLength);
88 ++i;
89 }
90 else if (c < 32)
91 {
92 // Easy pass at non-alpha/numeric/symbol
93 // Below 32 is symbolic.
94 char buf[32];

Callers

nothing calls this directly

Calls 4

xr_strlenFunction · 0.50
lengthMethod · 0.45
appendMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected