Пример #1
0
// Return the contents of this value to the caller
void JsonValue::getPropertyContents(EXTfldval &retVal, tThreadData* pThreadData) {
    switch (jsonValue->type()) {
    case Json::nullValue:
        retVal.setNull(fftCharacter, dpFcharacter);
        break;
    case Json::intValue:
        getEXTFldValFromInt(retVal, jsonValue->asInt());
        break;
    case Json::uintValue:
        getEXTFldValFromInt(retVal, jsonValue->asUInt());
        break;
    case Json::realValue:
        getEXTFldValFromDouble(retVal, jsonValue->asDouble());
        break;
    case Json::stringValue:
        // String can be a string or a date
        if (isISO8601Date(jsonValue ->asString())) {
            getEXTfldvalFromISO8601DateString(retVal, jsonValue->asString());
        } else {
            getEXTFldValFromString(retVal,jsonValue->asString());
        }
        break;
    case Json::booleanValue:
        getEXTFldValFromBool(retVal, jsonValue->asBool());
        break;
    case Json::arrayValue:
        getEXTFldValFromString(retVal,"<JSON Array>");
        break;
    case Json::objectValue:
        getEXTFldValFromString(retVal,"<JSON Object>");
        break;
    default:
        break;
    }
}
Пример #2
0
// Get an EXTFldVal based on a Json::Value
void JsonValue::getEXTFldValFromValue(tThreadData* pThreadData, EXTfldval& fVal, Json::Value* val) {

    std::string stringCheck;

    // Perform appropriate initialization for each type
    switch (val->type()) {
    case Json::nullValue:
        fVal.setNull(fftCharacter, dpFcharacter);
        break;
    case Json::intValue:
        getEXTFldValFromInt(fVal, val->asInt());
        break;
    case Json::uintValue:
        getEXTFldValFromInt(fVal, val->asUInt());
        break;
    case Json::realValue:
        getEXTFldValFromDouble(fVal, val->asDouble());
        break;
    case Json::stringValue:
        // String could also be a date value in ISO8601 format
        stringCheck = val->asString();

        // Check which kind of string it is
        if( isISO8601Date(stringCheck) ) {
            getEXTfldvalFromISO8601DateString(fVal, stringCheck);
        } else {
            // Must be a string
            getEXTFldValFromString(fVal, stringCheck);
        }
        break;
    case Json::booleanValue:
        getEXTFldValFromBool(fVal, val->asBool());
        break;
    case Json::arrayValue:
    case Json::objectValue:
        // Object and array handled above
        break;
    default:
        break;
    }
}