Пример #1
0
// Initializes the time zone.
tResult NVObjTimeZone::methodInitialize( tThreadData* pThreadData, qshort pParamCount )
{ 
    // Parameter 1: (Optional) Location of time zone to initialize with
    EXTfldval locationVal;
    
    SystemTimeZone curZone;
    
    std::string locationString; 
    if ( getParamVar(pThreadData, 1, locationVal) == qtrue ) {
        locationString = getStringFromEXTFldVal(locationVal);
        
        if (boost::iequals(locationString,"UTC")) {
            timezone = icaltimezone_get_utc_timezone();  
        } else {
            timezone = icaltimezone_get_builtin_timezone(locationString.c_str());
        }
    } else {
        timezone = icaltimezone_get_builtin_timezone(curZone.name().c_str());
    }
    
    // Copy the object and return to the caller (this allows inline calls)
    NVObjTimeZone* thisCopy = createNVObj<NVObjTimeZone>(pThreadData);
    if(!thisCopy) {
        return ERR_METHOD_FAILED;
    }
    thisCopy->copy(this);  // Move data into new object
    
    EXTfldval retVal;  retVal.setObjInst(thisCopy->getInstance(), qtrue);
    ECOaddParam(pThreadData->mEci, &retVal);
    
    return METHOD_DONE_RETURN;
}
Пример #2
0
// Get a pointer to the root of the current object
void JsonValue::methodRoot( tThreadData* pThreadData, qshort pParamCount ) {
    JsonValue *newObj = createNVObj<JsonValue>(pThreadData);
    newObj->setJsonValue(document);

    EXTfldval retVal;
    retVal.setObjInst( newObj->getInstance(), qtrue );
    ECOaddParam( pThreadData->mEci, &retVal );
}
Пример #3
0
// Create a copy of the pointer at the current position.  This copied pointer is trimmed above the current position.
void JsonValue::methodCopy( tThreadData* pThreadData, qshort pParamCount ) {
    shared_ptr<Json::Value> copyValue(new Json::Value(*jsonValue));

    JsonValue *newObj = createNVObj<JsonValue>(pThreadData);
    newObj->setJsonValue(copyValue);

    EXTfldval retVal;
    retVal.setObjInst( newObj->getInstance(), qtrue );
    ECOaddParam( pThreadData->mEci, &retVal );
}
Пример #4
0
void JsonValue::getEXTfldvalForValue(tThreadData* pThreadData, EXTfldval &retVal, Json::Value* posPointer) {
    // Create return value object
    JsonValue *newObj = createNVObj<JsonValue>(pThreadData);
    if ( posPointer != 0 ) {
        // Return pointer to found position
        newObj->setJsonValue(document, posPointer); // Set value and pointer to source
    } else {
        // Create and return new null object
        shared_ptr<Json::Value> nullObj(new Json::Value());
        newObj->setJsonValue(nullObj);
    }

    retVal.setObjInst( newObj->getInstance(), qtrue );
}