bool AlibabaCloud::OSS::IsValidLoggingPrefix()

in sdk/src/utils/Utils.cc [669:690]


 bool AlibabaCloud::OSS::IsValidLoggingPrefix(const std::string &prefix)
 {
     if (prefix.empty())
         return true;
#if defined(__GNUG__) && __GNUC__ < 5
     if (prefix.size() > 32)
         return false;

     auto ch = static_cast<int>(*prefix.begin());
     if (isalpha(ch) == 0)
         return false;

     for (auto it = prefix.begin(); it != prefix.end(); it++) {
         ch = static_cast<int>(*it);
         if (!(::isalpha(ch) || ::isdigit(ch) || *it == '-'))
             return false;
     }
     return true;
#else
     return std::regex_match(prefix, loggingPrefixPattern);
#endif
 }