MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / p21encode

Function p21encode

src/cpp/web-ifc/parsing/string_parsing.cpp:60–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 }
59
60 void p21encode(std::string_view input, std::ostringstream &output)
61 {
62 std::string tmp;
63 bool inEncode=false;
64 for (char c : input) {
65 if (c > 126 || c < 32) {
66 if (!inEncode)
67 {
68 inEncode = true;
69 tmp=c;
70 continue;
71 } else {
72 tmp+=c;
73 continue;
74 }
75 } else {
76 if (inEncode) {
77 encodeCharacters(output,tmp);
78 inEncode=false;
79 tmp.clear();
80 } else if (c==39) {
81 output << c << c;
82 continue;
83 }
84 }
85 output << c;
86 }
87 if (inEncode) encodeCharacters(output,tmp);
88 }
89
90 std::string utf8_from_utf16(const std::u16string& u16str) {
91 std::string utf8;

Callers 2

EncodeTextFunction · 0.85
SaveFileMethod · 0.85

Calls 2

encodeCharactersFunction · 0.85
clearMethod · 0.65

Tested by

no test coverage detected