targets/XPlatCppSdk/source/cppsdk/source/playfab/OneDSEventsApi.cpp
// Validates a OneDS event's property name. This is taken from Aria SDK (see its Utils.cpp).
Validates a OneDS event's property name. This is taken from Aria SDK .
Validates a OneDS event ' s property name . This is taken from Aria SDK .
EventRejectedReason ValidateOneDSPropertyName(std::string const& name)
    {
        if (name.length() < 1 + 0 || name.length() > 1 + 98 + 1) {
            return REJECTED_REASON_VALIDATION_FAILED;
        }
        auto filter = [](char ch) -> bool { return !isalnum(static_cast<uint8_t>(ch)) && (ch != '_') && (ch != '.'); };
        if (std::find_if(name.begin(), name.end(), filter) != name.end()) {
            return REJECTED_REASON_VALIDATION_FAILED;
        }
        if ((name.front() == '.' || name.back() == '.') )
        {
            return REJECTED_REASON_VALIDATION_FAILED;
        }
        return REJECTED_REASON_OK;
    }
EventRejectedReason ValidateOneDSPropertyName ( std :: string const & name ) { if ( name . length ( ) < 1 + 0 || name . length ( ) > 1 + 98 + 1 ) { return REJECTED_REASON_VALIDATION_FAILED ; } auto filter = [ ] ( char ch ) -> bool { return ! isalnum ( static_cast < uint8_t > ( ch ) ) && ( ch != ' ' ) && ( ch != ' ' ) ; } ; if ( std :: find_if ( name . begin ( ) , name . end ( ) , filter ) != name . end ( ) ) { return REJECTED_REASON_VALIDATION_FAILED ; } if ( ( name . front ( ) == ' ' || name . back ( ) == ' ' ) ) { return REJECTED_REASON_VALIDATION_FAILED ; } return REJECTED_REASON_OK ; }
Validates a OneDS event's property name.
Validates a OneDS event ' s property name .
// Data collector does not seem to validate property names at all. // The ObjC SDK uses this regex (avoided here for code size reasons): // ^[a-zA-Z0-9](([a-zA-Z0-9|_|.]){0,98}[a-zA-Z0-9])?$ //LOG_ERROR("Invalid property name - \"%s\": must be between 1 and 100 characters long", name.c_str()); //LOG_ERROR("Invalid property name - \"%s\": must contain [0-9A-Za-z_.] characters only", name.c_str()); /* || (name.front() == '_' || name.back() == '_') */ //LOG_ERROR("Invalid property name - \"%s\": must not start or end with _ or . characters", name.c_str());