MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / StrCheckEmpty

Function StrCheckEmpty

common/map_sdk/map_import/src/OpenDriveStruct.cpp:20–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18namespace hadmap {
19#define ELE_CKECK elementCheck(element)
20std::string StrCheckEmpty(const char* s) {
21 if (s == nullptr) {
22 return std::string();
23 }
24 std::string ns = s;
25 bool hasChn = false;
26 for (const auto& c : ns) {
27 if (c < 0) {
28 hasChn = true;
29 break;
30 }
31 }
32 if (hasChn) {
33 setlocale(LC_ALL, "en_US.utf8");
34 int len = mbstowcs(nullptr, ns.c_str(), ns.size());
35 if (len > 0) {
36 std::wstring wstr;
37 wstr.resize(len, 0);
38 mbstowcs(const_cast<wchar_t*>(wstr.data()), ns.c_str(), len);
39 setlocale(LC_ALL, "");
40 len = wcstombs(nullptr, wstr.c_str(), wstr.size());
41 if (len > 0) {
42 ns.clear();
43 ns.resize(len, 0);
44 wcstombs(const_cast<char*>(ns.data()), wstr.c_str(), len);
45 }
46 }
47 }
48 return ns;
49}
50
51ODXYZ& ODXYZ::operator+=(const ODXYZ& rhs) {
52 // TODO(undefined): insert return statement here

Callers 2

parseMethod · 0.85
parseTunnelMethod · 0.85

Calls 4

sizeMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected