コード例 #1
0
ファイル: OVR_JSON.cpp プロジェクト: Interaptix/OvrvisionPro
//-----------------------------------------------------------------------------
// Parser core - when encountering text, process appropriately.
const char* JSON::parseValue(const char* buff, const char** perror)
{
    if (perror)
        *perror = 0;

    if (!buff)
        return NULL;    // Fail on null.

    if (!OVR_strncmp(buff, "null", 4))
    {
        Type = JSON_Null;
        return buff + 4;
    }
    if (!OVR_strncmp(buff, "false", 5))
    { 
        Type   = JSON_Bool;
        Value  = "false";
        dValue = 0.;
        return buff + 5;
    }
    if (!OVR_strncmp(buff, "true", 4))
    {
        Type   = JSON_Bool;
        Value  = "true";
        dValue = 1.;
        return buff + 4;
    }
    if (*buff=='\"')
    {
        return parseString(buff, perror);
    }
    if (*buff=='-' || (*buff>='0' && *buff<='9'))
    { 
        return parseNumber(buff);
    }
    if (*buff=='[')
    { 
        return parseArray(buff, perror);
    }
    if (*buff=='{')
    {
        return parseObject(buff, perror);
    }

    return AssignError(perror, "Syntax Error: Invalid syntax");
}
コード例 #2
0
ファイル: VrCommon.cpp プロジェクト: beijingkaka/shellspace
// Returns true if head equals check plus zero or more characters.
bool MatchesHead( const char * head, const char * check )
{
	const int l = OVR_strlen( head );
	return 0 == OVR_strncmp( head, check, l );
}