예제 #1
0
파일: string.cpp 프로젝트: vjcagay/taiga
bool ToBool(const wstring& str) {
  if (str.empty())
    return false;

  const wchar_t c = str.front();

  return (c == '1' || c == 't' || c == 'T' || c == 'y' || c == 'Y');
}
예제 #2
0
파일: const.cpp 프로젝트: ai-artisan/kode
 bool JstrChecker::IS_STRING(const wstring &str, wstring &strvl) {
     if (str.front() != JsonSymbol::STRING_BOUND || str.back() != JsonSymbol::STRING_BOUND) return false;
     strvl = L"";
     for (size_t i = 1; i < str.size() - 1; i++) {
         if (str[i] == JsonSymbol::ESCAPE_SYM) {
             if (i == str.size() - 2) return false;
             strvl.push_back(ESCAPE(str[i + 1]));
             i++;
         } else if (str[i] == JsonSymbol::STRING_BOUND) {
             return false;
         } else {
             strvl.push_back(str[i]);
         }
     }
     return true;
 }
예제 #3
0
void Service::SetFDDistributionPolicy(wstring const& distPolicy)
{
    if (distPolicy.front() == L'P' || distPolicy.front() == L'p')
    {
        this->FDDistribution_ = Type::Packing;
    }
    else if (distPolicy.front() == L'N' || distPolicy.front() == L'n')
    {
        this->FDDistribution_ = Type::Nonpacking;
    }
    else if (distPolicy.front() == L'I' || distPolicy.front() == L'i')
    {
        this->FDDistribution_ = Type::Ignore;
    }
    else
    {
        //todo trace for invalid policy input
    }
}