| 18 | namespace hadmap { |
| 19 | #define ELE_CKECK elementCheck(element) |
| 20 | std::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 | |
| 51 | ODXYZ& ODXYZ::operator+=(const ODXYZ& rhs) { |
| 52 | // TODO(undefined): insert return statement here |