Пример #1
0
VError VJSONObject::CloneProperties( VJSONCloner& inCloner, VJSONObject *inDestination) const
{
	VError err = VE_OK;
	if (inDestination != NULL)
	{
		MapType clonedMap( fMap);

		for( MapType::iterator i = clonedMap.begin() ; (i != clonedMap.end()) && (err == VE_OK) ; ++i)
		{
			if (i->second.first.IsObject())
			{
				VJSONObject *theOriginalObject = RetainRefCountable( i->second.first.GetObject());
				err = inCloner.CloneObject( theOriginalObject, i->second.first);
				VJSONGraph::Connect( &inDestination->fGraph, i->second.first);
				ReleaseRefCountable( &theOriginalObject);
			}
			else if (i->second.first.IsArray())
			{
				VJSONArray *theOriginalArray = RetainRefCountable( i->second.first.GetArray());
				err = theOriginalArray->Clone( i->second.first, inCloner);
				VJSONGraph::Connect( &inDestination->fGraph, i->second.first);
				ReleaseRefCountable( &theOriginalArray);
			}
		}
		
		if (err == VE_OK)
			inDestination->fMap.swap( clonedMap);
	}
	return err;
}
Пример #2
0
const XBOX::VValueBag* VJSPictureContainer::RetainMetaBag()
{
#if !VERSION_LINUX

	if (fMetaBag == NULL)
	{
		if (fPict != NULL)
		{
			const VPictureData* picdata = fPict->RetainNthPictData(1);
			if (picdata != NULL)
			{
				fMetaBag = picdata->RetainMetadatas();
				picdata->Release();
			}
		}
	}
	return RetainRefCountable(fMetaBag);

#else

	// Postponed Linux Implementation !
	vThrowError(VE_UNIMPLEMENTED);
	xbox_assert(false);

	return NULL;

#endif
}
Пример #3
0
void VJSONValue::_CopyFrom( const VJSONValue& inOther)
{
	fType = inOther.fType;
	switch( fType)
	{
		case JSON_string:	fString.InitWithString( inOther.fString); break;
		case JSON_number:	fNumber = inOther.fNumber; break;
		case JSON_array:	fArray = RetainRefCountable( inOther.fArray); break;
		case JSON_object:	fObject = RetainRefCountable( inOther.fObject); break;
		case JSON_date:		fTimeStamp = inOther.fTimeStamp; break;
		case JSON_null:
		case JSON_true:
		case JSON_false:
		case JSON_undefined:
			break;
	}
}
Пример #4
0
VJSContext& VJSContext::operator=( const VJSContext& inOther)
{
	fContext = inOther.fContext;
	fGlobalContext = RetainRefCountable( inOther.fGlobalContext);
	if (fGlobalContext != NULL)
	{
		fGlobalContext->Use();
	}
	return *this;
}
CDB4DContext* VRIAJSRuntimeContext::RetainDB4DContext(VRIAServerProject* inApplication)
{
	CDB4DContext* result = NULL;
	VRIAContext* riacontext = GetApplicationContext(inApplication);
	if (riacontext != NULL && riacontext->GetBaseContext() != NULL)
	{
		result = RetainRefCountable(riacontext->GetBaseContext()->GetContextOwner());
	}
	return result;
}
Пример #6
0
void VJSONValue::_CopyFrom( const VJSONValue& inOther)
{
    fType = inOther.fType;
    switch( fType)
    {
    case JSON_string:
        fString.InitWithString( inOther.fString);
        break;
    case JSON_number:
        fNumber = inOther.fNumber;
        break;
    case JSON_array:
        fArray = RetainRefCountable( inOther.fArray);
        break;
    case JSON_object:
        fObject = RetainRefCountable( inOther.fObject);
        break;
    }
}
Пример #7
0
VError VJSONArray::Clone( VJSONValue& outValue, VJSONCloner& inCloner) const
{
    VError err = VE_OK;

    VJSONArray *clone = new VJSONArray;
    if (clone != NULL)
    {
        VectorType clonedVector = fVector;

        for( VectorType::iterator i = clonedVector.begin() ; (i != clonedVector.end()) && (err == VE_OK) ; ++i)
        {
            if (i->IsObject())
            {
                VJSONObject *theOriginalObject = RetainRefCountable( i->GetObject());
                err = inCloner.CloneObject( theOriginalObject, *i);
                VJSONGraph::Connect( &clone->fGraph, *i);
                ReleaseRefCountable( &theOriginalObject);
            }
            else if (i->IsArray())
            {
                VJSONArray *theOriginalArray = RetainRefCountable( i->GetArray());
                err = theOriginalArray->Clone( *i, inCloner);
                VJSONGraph::Connect( &clone->fGraph, *i);
                ReleaseRefCountable( &theOriginalArray);
            }
        }

        if (err == VE_OK)
            clone->fVector.swap( clonedVector);
    }
    else
    {
        err = VE_MEMORY_FULL;
    }
    outValue.SetArray( clone);
    ReleaseRefCountable( &clone);

    return err;
}
Пример #8
0
VError VJSONObject::Clone( VJSONValue& outValue, VJSONCloner& inCloner) const
{
    VError err = VE_OK;

    VJSONObject *clone = new VJSONObject;
    if (clone != NULL)
    {
        MapType clonedMap = fMap;

        for( MapType::iterator i = clonedMap.begin() ; (i != clonedMap.end()) && (err == VE_OK) ; ++i)
        {
            if (i->second.IsObject())
            {
                VJSONObject *theOriginalObject = RetainRefCountable( i->second.GetObject());
                err = inCloner.CloneObject( theOriginalObject, i->second);
                VJSONGraph::Connect( &clone->fGraph, i->second);
                ReleaseRefCountable( &theOriginalObject);
            }
            else if (i->second.IsArray())
            {
                VJSONArray *theOriginalArray = RetainRefCountable( i->second.GetArray());
                err = theOriginalArray->Clone( i->second, inCloner);
                VJSONGraph::Connect( &clone->fGraph, i->second);
                ReleaseRefCountable( &theOriginalArray);
            }
        }

        if (err == VE_OK)
            clone->fMap.swap( clonedMap);
    }
    else
    {
        err = VE_MEMORY_FULL;
    }
    outValue.SetObject( clone);
    ReleaseRefCountable( &clone);

    return err;
}
Пример #9
0
VJSONObject* VValueBag::BuildJSONObject(VError& outError) const
{
    // will use stringify until redone in a more elegant way
	VJSONObject* result = nil;
	VString jsonstr;
	outError = GetJSONString(jsonstr);
	if (outError == VE_OK)
	{
		VJSONValue val;
		outError = val.ParseFromString(jsonstr);
		if (val.IsObject() && outError == VE_OK)
			result = RetainRefCountable(val.GetObject());
	}
	return result;
}
Пример #10
0
VResourceFile* VProcess::RetainResourceFile()
{
	if (fProcessResFile == NULL)
	{
	#if VERSIONMAC
		#if !__LP64__
		fProcessResFile = new VMacResFile(::CurResFile());
		((VMacResFile*)fProcessResFile)->SetUseResourceChain();
		#endif
	#else
		fProcessResFile = new VWinResFile(sWIN_AppInstance);
	#endif
	}
	
	return RetainRefCountable( fProcessResFile);
}
//VLocalizationTransUnitHandler
//----------------------------
VLocalizationTransUnitHandler::VLocalizationTransUnitHandler( uLONG inGroupID, const std::stack<XBOX::VString>& inGroupResnamesStack, VValueBag *inGroupBag, bool inShouldOverwriteAnyExistentLocalizationValue, VLocalizationManager* inLocalizationManager)
: fLocalizationManager( inLocalizationManager)
, fShouldOverwriteAnyExistentLocalizationValue( inShouldOverwriteAnyExistentLocalizationValue)
, fStringID( 0)
, fIsEntryRecorded( false)
, fGroupID( inGroupID)
, fGroupResnamesStack( inGroupResnamesStack)
, fGroupBag( RetainRefCountable( inGroupBag))
, fTransUnitBag( NULL)
, fExcluded( false)
{
	fTarget.SetNull();
	fSource.SetNull();
	
	if (fGroupBag != NULL)
		fTransUnitBag = new VValueBag;
}
Пример #12
0
void VJSONValue::SetArray( VJSONArray *inArray)
{
    if (inArray == NULL)
    {
        _Dispose();
        fType = JSON_undefined;
    }
    else if (fType == JSON_array)
    {
        CopyRefCountable( &fArray, inArray);
    }
    else
    {
        _Dispose();
        fType = JSON_array;
        fArray = RetainRefCountable( inArray);
    }
}
Пример #13
0
void VJSONValue::SetObject( VJSONObject *inObject)
{
    if (inObject == NULL)
    {
        _Dispose();
        fType = JSON_undefined;
    }
    else if (fType == JSON_object)
    {
        CopyRefCountable( &fObject, inObject);
    }
    else
    {
        _Dispose();
        fType = JSON_object;
        fObject = RetainRefCountable( inObject);
    }
}
VSyncEvent* VJSContextPool::WaitForNumberOfUsedContextEqualZero()
{
	VSyncEvent *syncEvent = NULL;

	if (fPoolMutex.Lock())
	{
		if (fUsedContexts.size() > 0)
		{
			if (fNoUsedContextEvenMutex.Lock())
			{
				if (fNoUsedContextEvent == NULL)
					fNoUsedContextEvent = new VSyncEvent();

				syncEvent = RetainRefCountable( fNoUsedContextEvent);

				fNoUsedContextEvenMutex.Unlock();
			}
		}
		fPoolMutex.Unlock();
	}
	return syncEvent;
}
Пример #15
0
END_TOOLBOX_NAMESPACE


/*
	static
*/
void VJSONGraph::Connect( VJSONGraph** inRetainerGraph, VJSONGraph** inRetainedGraph)
{
    if (inRetainedGraph == inRetainerGraph)
    {
        // connecting to ourselves makes a cycle
        if (*inRetainerGraph == NULL)
        {
            *inRetainerGraph = new VJSONGraph;
            (*inRetainerGraph)->SetCyclic();
        }
        else
        {
            VJSONGraph *topMostGraph = *inRetainerGraph;
            while( topMostGraph->GetParent() != NULL)
                topMostGraph = topMostGraph->GetParent();
            topMostGraph->SetCyclic();
        }
    }
    else if ( (*inRetainerGraph == NULL) && (*inRetainedGraph == NULL) )
    {
        // new graph
        *inRetainerGraph = new VJSONGraph;
        *inRetainedGraph = RetainRefCountable( *inRetainerGraph);
    }
    else if (*inRetainedGraph == NULL)
    {
        *inRetainedGraph = RetainRefCountable( *inRetainerGraph);
    }
    else if (*inRetainerGraph == NULL)
    {
        *inRetainerGraph = RetainRefCountable( *inRetainedGraph);
    }
    else
    {
        // connecting two graphs together

        VJSONGraph *topMostGraph = *inRetainerGraph;
        while( topMostGraph->GetParent() != NULL)
            topMostGraph = topMostGraph->GetParent();

        VJSONGraph *otherTopMostGraph = *inRetainedGraph;
        while( otherTopMostGraph->GetParent() != NULL)
            otherTopMostGraph = otherTopMostGraph->GetParent();

        if (topMostGraph == otherTopMostGraph)
        {
            // cycle detected
            topMostGraph->SetCyclic();
        }
        else
        {
            if (otherTopMostGraph->IsCyclic())
                topMostGraph->SetCyclic();
            otherTopMostGraph->SetParent( topMostGraph);
        }
    }
}
VValueBag* VRIAServerSolutionOpeningParameters::RetainBag() const
{
	return RetainRefCountable( fBag);
}
Пример #17
0
VJSONValue::VJSONValue( VJSONArray *inArray)
    : fType( (inArray == NULL) ? JSON_undefined : JSON_array)
    , fArray( RetainRefCountable( inArray))
{
}
Пример #18
0
VJSONValue::VJSONValue( VJSONObject *inObject)
    : fType( (inObject == NULL) ? JSON_undefined : JSON_object)
    , fObject( RetainRefCountable( inObject))
{
}
Пример #19
0
VJSContext::VJSContext( const VJSGlobalContext *inGlobalContext)
: fGlobalContext( RetainRefCountable( inGlobalContext))
, fContext( inGlobalContext->Use())
, fDebuggerAllowed(true)
{
}
CUAGSession* VRIAJSRuntimeContext::RetainUAGSession()
{
	return RetainRefCountable(fCurrentUAGSession);
}
CUAGDirectory* VRIAServerSolution::RetainUAGDirectory() const
{
	return RetainRefCountable( fUAGDirectory);
}
Пример #22
0
ILogger* VProcess::RetainLogger() const
{
	return RetainRefCountable( fLogger);
}
Пример #23
0
void VJSPictureContainer::SetMetaBag(const XBOX::VValueBag* metaBag)
{
	QuickReleaseRefCountable(fMetaBag);
	fMetaBag = RetainRefCountable(metaBag);
}
const VValueBag *VLanguageSyntaxTesterCatalog::RetainCatalogBag() const
{
	return RetainRefCountable( fCatalogBag);
}