MCPcopy Create free account
hub / github.com/Kitware/VTK / EncodeWriteString

Method EncodeWriteString

IO/Core/vtkWriter.cxx:126–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void vtkWriter::EncodeWriteString(ostream* out, const char* name)
127{
128 if (!name)
129 {
130 return;
131 }
132 int cc = 0;
133
134 char buffer[10];
135
136 while (name[cc])
137 {
138 // Encode spaces and %'s (and most non-printable ascii characters)
139 // The reader does not support spaces in strings.
140 if (name[cc] < 33 || name[cc] > 126 || name[cc] == '\"' || name[cc] == '%')
141 {
142 auto result =
143 vtk::format_to_n(buffer, sizeof(buffer), "{:02X}", static_cast<unsigned char>(name[cc]));
144 *result.out = '\0';
145 *out << "%" << buffer;
146 }
147 else
148 {
149 *out << name[cc];
150 }
151 cc++;
152 }
153}
154
155void vtkWriter::EncodeWriteString(ostream* out, const char* name, bool doublePercent)
156{

Callers 2

WriteArrayMethod · 0.80
WriteInformationMethod · 0.80

Calls 1

format_to_nFunction · 0.50

Tested by

no test coverage detected