Src/GPUPerfAPIGL/ASICInfo.cpp
/// Parses a version number like this: "4.2.12325 Compatibility Profile Context 13.100.0.0"
/// to extract the "12325" portion.
/// \param pVersion the version string to extract the number from
/// \return 0 on failure, the build version number on success
Parses a version number like this: "4.2.12325 Compatibility Profile Context 13.100.0.0"
to extract the "12325" portion.
\param pVersion the version string to extract the number from
\return 0 on failure, the build version number on success
Parses a version number like this : " 4 . 2 . 12325 Compatibility Profile Context 13 . 100 . 0 . 0 " to extract the " 12325 " portion . \ param pVersion the version string to extract the number from \ return 0 on failure the build version number on success
int extractVersionNumber(const GLubyte* pVersion)
{
    const char* pcszVer = reinterpret_cast<const char*>(pVersion);
    std::string strVer(pcszVer);
    int nEndBuild = (int)strVer.find_first_of(' ');
    strVer = strVer.substr(0, nEndBuild);
    int nStartBuild = (int)strVer.find_last_of('.') + 1;
    int nVersion = atoi(strVer.substr(nStartBuild, nEndBuild - nStartBuild).c_str());
    if (0 == nVersion)
    {
        nVersion = INT_MAX;
    }
    return nVersion;
}
int extractVersionNumber ( const GLubyte * pVersion ) { const char * pcszVer = reinterpret_cast < const char * > ( pVersion ) ; std :: string strVer ( pcszVer ) ; int nEndBuild = ( int ) strVer . find_first_of ( ' ' ) ; strVer = strVer . substr ( 0 , nEndBuild ) ; int nStartBuild = ( int ) strVer . find_last_of ( ' ' ) + 1 ; int nVersion = atoi ( strVer . substr ( nStartBuild , nEndBuild - nStartBuild ) . c_str ( ) ) ; if ( 0 == nVersion ) { nVersion = INT_MAX ; } return nVersion ; }
Parses a version number like this: "4.2.12325 Compatibility Profile Context 13.100.0.0"
to extract the "12325" portion.
Parses a version number like this : " 4 . 2 . 12325 Compatibility Profile Context 13 . 100 . 0 . 0 " to extract the " 12325 " portion .
// the build number ends at the first space // truncate the input at the first space // the build number starts after the last decimal point // parse the version number // couldn't extract version -- return MAX_INT to simulate most recent driver