本文整理汇总了C++中VValueBag类的典型用法代码示例。如果您正苦于以下问题:C++ VValueBag类的具体用法?C++ VValueBag怎么用?C++ VValueBag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VValueBag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: father
bool VValueBag::ReplaceElementByPath( const VValueBag::StKeyPath& inPath, VValueBag *inBag)
{
if (!testAssert( !inPath.empty()))
return false;
bool ok;
if (inPath.size() > 1)
{
VValueBag::StKeyPath father( inPath);
father.pop_back();
if (inBag == NULL)
{
// removing
VValueBag *fatherBag = GetUniqueElementByPath( father);
if (fatherBag != NULL)
fatherBag->RemoveElements( inPath.back());
ok = true;
}
else
{
VValueBag *fatherBag = GetElementByPathAndCreateIfDontExists( father);
if (fatherBag != NULL)
ok = fatherBag->ReplaceElement( inPath.back(), inBag);
else
ok = false;
}
}
else
{
ok = ReplaceElement( inPath.back(), inBag);
}
return ok;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:34,代码来源:VValueBag.cpp
示例2: VValueBag
void VJSImage::_save(XBOX::VJSParms_callStaticFunction& ioParms, VJSPictureContainer* inPict)
{
VPictureCodecFactoryRef fact;
const VPictureCodec* encoder = nil;
bool ok = false;
VPicture* pic = inPict->GetPict();
if (pic != nil)
{
VFile* file = ioParms.RetainFileParam(1);
if (file != nil)
{
VString mimetype;
ioParms.GetStringParam(2, mimetype);
if (mimetype.IsEmpty())
{
VString extension;
file->GetExtension(extension);
if (extension.IsEmpty())
extension = L"pic";
encoder = fact->RetainEncoderForExtension(extension);
}
else
encoder = fact->RetainEncoderByIdentifier(mimetype);
if (encoder != nil)
{
VError err = VE_OK;
if (file->Exists())
err = file->Delete();
if (err == VE_OK)
{
VValueBag *pictureSettings = nil;
VValueBag *bagMetas = (VValueBag*)inPict->RetainMetaBag();
if (bagMetas != nil)
{
pictureSettings = new VValueBag();
ImageEncoding::stWriter settingsWriter(pictureSettings);
VValueBag *bagRetained = settingsWriter.CreateOrRetainMetadatas( bagMetas);
if (bagRetained)
bagRetained->Release();
}
err=encoder->Encode(*pic, pictureSettings, *file);
QuickReleaseRefCountable(bagMetas);
QuickReleaseRefCountable(pictureSettings);
if (err == VE_OK)
ok = true;
}
encoder->Release();
}
file->Release();
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
}
ioParms.ReturnBool(ok);
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:60,代码来源:VJSRuntime_Image.cpp
示例3: keyName
void VValueBag::_SortElements( const StBagElementsOrdering *inElementRule, const StBagElementsOrdering inRules[])
{
VIndex count = fElements->GetCount();
if (count > 1)
{
bool need_sort = false;
VIndex currentPosition = 0;
VectorOfPositions positions;
for( VIndex i = 1 ; i <= count ; ++i)
{
VIndex position = fElements->GetNthKeyPosition( i, inElementRule->fChildren, MAX_BAG_ELEMENTS_ORDERING);
positions.push_back( VectorOfPositions::value_type( i, position));
if ( (position != 0) && (position < currentPosition) )
{
need_sort = true;
}
currentPosition = position;
}
if (need_sort)
{
std::sort( positions.begin(), positions.end(), PositionComparatorStrict);
VPackedVBagArrayDictionary *newElements = new VPackedVBagArrayDictionary;
for( VectorOfPositions::const_iterator i = positions.begin() ; i != positions.end() ; ++i)
{
VBagArray *elements;
VIndex position = i->second;
if (position > 0)
{
elements = fElements->GetNthValue( i->first, NULL);
newElements->Append( *inElementRule->fChildren[position-1], elements);
}
else
{
VString name;
elements = fElements->GetNthValue( i->first, &name);
newElements->Append( name, elements);
}
}
delete fElements;
fElements = newElements;
}
}
// sort children
for( VIndex i = 1 ; i <= count ; ++i)
{
VString name;
VBagArray *elements = fElements->GetNthValue( i, &name);
StKey keyName( name);
VIndex bagArrayCount = elements->GetCount();
for( VIndex j = 1 ; j <= bagArrayCount ; ++j)
{
VValueBag *elem = elements->GetNth( j);
elem->SortElements( keyName, inRules);
}
}
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:59,代码来源:VValueBag.cpp
示例4:
VValueBag *VValueBag::GetUniqueElementByPath( const StKeyPath& inPath)
{
VValueBag *bag = this;
for( StKeyPath::const_iterator i = inPath.begin() ; (i != inPath.end()) && (bag != NULL) ; ++i)
{
VBagArray* array = bag->GetElements( *i);
bag = (array != NULL && !array->IsEmpty()) ? array->GetNth(1) : NULL;
}
return bag;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:10,代码来源:VValueBag.cpp
示例5: SaveToBag
VError VRect::SaveToBag(VValueBag& ioBag, VString& outKind) const
{
ioBag.SetReal(L"left", fX);
ioBag.SetReal(L"top", fY);
ioBag.SetReal(L"width", fWidth);
ioBag.SetReal(L"height", fHeight);
outKind = L"rect";
return VE_OK;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:10,代码来源:VRect.cpp
示例6: UpdateValue
void VCommand::UpdateValue(const VValueSingle& inValue, const ICommandListener* inExcept)
{
VValueBag* bag = new VValueBag;
if (bag != NULL)
{
bag->SetAttribute(CVSTR("__command_value__"), dynamic_cast<VValueSingle*>(inValue.Clone()));
UpdateValue(bag, inExcept);
bag->Release();
}
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:12,代码来源:VCommand.cpp
示例7: Trigger
bool VCommand::Trigger(const VValueSingle& inValue, const ICommandListener* inExcept)
{
bool called = false;
VValueBag* bag = new VValueBag;
if (bag != NULL)
{
bag->SetAttribute(CVSTR("__command_value__"), dynamic_cast<VValueSingle*>(inValue.Clone()));
called = Trigger(bag, inExcept);
bag->Release();
}
return called;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:14,代码来源:VCommand.cpp
示例8: RetainNth
VValueBag* VBagArray::RetainNth( VIndex inIndex)
{
VValueBag* bag = NULL;
if (testAssert(inIndex >= 1 && inIndex <= GetCount()))
bag = fArray[inIndex-1];
if (bag == NULL)
bag = new VValueBag;
else
bag->Retain();
return bag;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:14,代码来源:VValueBag.cpp
示例9: SaveToBag
VError VCommand::SaveToBag(VValueBag& ioBag, VString& outKind) const
{
ioBag.SetString(L"id", fID);
ioBag.SetString(L"name", fName);
if (fTriggerSignal.IsAllwaysAsynchronous())
ioBag.SetBoolean(L"asynchronous", true);
else if (fTriggerSignal.IsAllwaysSynchronous())
ioBag.SetBoolean(L"synchronous", true);
ioBag.SetBoolean(L"enabled", IsEnabled());
outKind = "command";
return vGetLastError();
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:15,代码来源:VCommand.cpp
示例10: iterator
VError VCommandList::SaveToBag(VValueBag& ioBag, VString& outKind) const
{
VStr31 kind;
VCommand* command;
VArrayIteratorOf<VCommand*> iterator(fCmdArray);
while ((command = iterator.Next()) != NULL)
{
VValueBag* bagCommand = new VValueBag;
command->SaveToBag(*bagCommand, kind);
ioBag.AddElement(kind, bagCommand);
bagCommand->Release();
}
outKind = "command";
return vGetLastError();
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:16,代码来源:VCommand.cpp
示例11: GetUUID
bool VBagLoader::GetUUID( const VValueBag& inBag, VUUID& outUUID)
{
bool ok;
if (fRegenerateUUIDs)
{
VUUID bag_uuid;
ok = inBag.GetVUUID( BagLoaderKeys::uuid, bag_uuid);
if (ok && !bag_uuid.IsNull())
{
try
{
MapVUUID::const_iterator i = fUUIDs.find( bag_uuid);
if (i != fUUIDs.end())
{
outUUID = i->second;
}
else
{
outUUID.Regenerate();
fUUIDs[bag_uuid] = outUUID;
}
}
catch(...)
{
ok = false;
}
}
else
{
outUUID.Regenerate();
}
}
else
{
ok = inBag.GetVUUID( BagLoaderKeys::uuid, outUUID);
if (!ok)
{
outUUID.Regenerate();
}
}
return ok;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:43,代码来源:VValueBag.cpp
示例12: LoadFromBag
VError VCommandList::LoadFromBag(const VValueBag& inBag)
{
const VBagArray* bagCommands = inBag.RetainElements(L"command");
if (bagCommands != NULL)
{
LoadCommands(*bagCommands);
bagCommands->Release();
}
return vGetLastError();
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:11,代码来源:VCommand.cpp
示例13: ThrowError
VError ThrowError( VError inError, const VString *inParam, ...)
{
VErrorBase *errBase = new VErrorBase( inError, 0);
if (errBase != NULL)
{
VValueBag *bag = errBase->GetBag();
if (bag != NULL)
{
VIndex paramNum = 1;
va_list argList;
va_start( argList, inParam);
for (const VString *param = inParam ; param != NULL ; param = va_arg( argList, const VString*), ++paramNum)
{
VString attName( "param");
attName.AppendLong( paramNum);
bag->SetString( attName, *param);
}
va_end( argList);
}
开发者ID:sanyaade-teachings,项目名称:core-Wakanda,代码行数:22,代码来源:VRIAServerTools.cpp
示例14: ReadFromStreamMinimal
VError VBagArray::ReadFromStreamMinimal( VStream* inStream)
{
VError err = inStream->GetLastError();
if (err == VE_OK)
{
try
{
VIndex max_bag = inStream->GetLong();
fArray.reserve( max_bag);
for( VIndex i = 1 ; (i <= max_bag) && (err == VE_OK) ; i++)
{
VValueBag* bag = new VValueBag;
if (bag != NULL)
{
err = bag->ReadFromStreamMinimal( inStream);
if (err == VE_OK)
{
fArray.push_back( bag);
}
else
{
bag->Release();
}
}
else
{
err = VE_MEMORY_FULL;
}
}
}
catch(...)
{
err = VE_MEMORY_FULL;
}
}
return err;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:38,代码来源:VValueBag.cpp
示例15: AddElement
VError VValueBag::AddElement(const IBaggable* inObject)
{
VError err = VE_OK;
if (inObject != NULL)
{
VValueBag* bag = new VValueBag;
if (bag != NULL)
{
VStr31 kind;
err = inObject->SaveToBag(*bag, kind);
if (err == VE_OK)
AddElement(kind, bag);
bag->Release();
}
else
{
err = vThrowError(VE_MEMORY_FULL);
}
}
return err;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:23,代码来源:VValueBag.cpp
示例16: metadata
void VJSImage::_saveMeta(XBOX::VJSParms_callStaticFunction& ioParms, VJSPictureContainer* inPict)
{
VPicture* pic = inPict->GetPict();
if (pic != nil)
{
bool okmeta = false;
VString jsonString;
if (ioParms.IsObjectParam(1))
{
VJSObject metadata(ioParms.GetContextRef());
ioParms.GetParamObject(1, metadata);
okmeta = true;
VJSJSON json(ioParms.GetContextRef());
json.Stringify(metadata, jsonString);
}
else
{
if (inPict->MetaInfoInited())
{
okmeta = true;
VJSValue metadata(ioParms.GetContextRef(), inPict->GetMetaInfo());
VJSJSON json(ioParms.GetContextRef());
json.Stringify(metadata, jsonString);
}
}
if (okmeta)
{
VValueBag* bag = new VValueBag();
bag->FromJSONString(jsonString);
inPict->SetMetaBag(bag);
QuickReleaseRefCountable(bag);
}
//inPict->SetModif();
}
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:36,代码来源:VJSRuntime_Image.cpp
示例17: LoadFromBag
VError VRect::LoadFromBag(const VValueBag& inBag)
{
bool fullySpecified = false;
GReal tmp,right, bottom;
fX = fY = fWidth = fHeight = 0;
if (inBag.GetReal(L"left", fX))
{
if (inBag.GetReal(L"right", right))
{
fWidth = right - fX;
fullySpecified = !inBag.AttributeExists(L"width");
}
else
{
fullySpecified = inBag.GetReal(L"width", fWidth);
}
}
else if (inBag.GetReal(L"right", right))
{
fullySpecified = inBag.GetReal(L"width", fWidth);
fX = right - fWidth;
}
if (inBag.GetReal(L"top", fY))
{
if (inBag.GetReal(L"bottom", bottom))
{
fHeight = bottom - fY;
fullySpecified = !inBag.AttributeExists(L"height");
}
else
{
fullySpecified = inBag.GetReal(L"height", fHeight);
}
}
else if (inBag.GetReal(L"bottom", bottom))
{
fullySpecified = inBag.GetReal(L"height", fHeight);
fY = bottom - fHeight;
}
if (!fullySpecified)
return VE_MALFORMED_XML_DESCRIPTION;
return VE_OK;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:48,代码来源:VRect.cpp
示例18: ScriptDocLexer
//.........这里部分代码省略.........
xbox_assert( static_cast< SeeElement * >( comment->GetElement( 2 ) )->fMethodName == "someOtherMethod" );
xbox_assert( comment->GetElement( 3 )->Type() == IScriptDocCommentField::kMemberOf );
xbox_assert( static_cast< MemberOfElement * >( comment->GetElement( 3 ) )->fClass == "AwesomeClass" );
xbox_assert( comment->GetElement( 4 )->Type() == IScriptDocCommentField::kDeprecated );
xbox_assert( comment->GetElement( 5 )->Type() == IScriptDocCommentField::kAuthor );
xbox_assert( static_cast< AuthorElement * >( comment->GetElement( 5 ) )->fAuthorName == "Aaron Ballman" );
xbox_assert( comment->GetElement( 6 )->Type() == IScriptDocCommentField::kVersion );
xbox_assert( static_cast< VersionElement * >( comment->GetElement( 6 ) )->fVersion == "1.5" );
delete comment;
// We are going to do a few more tests, but use the public interface for ScriptDoc parsing
std::vector< IScriptDocCommentField * > fields;
xbox_assert( gLanguageSyntax->ParseScriptDocComment( sourceString, fields ) );
xbox_assert( fields.size() == 7 );
xbox_assert( fields[ 0 ]->GetKind() == IScriptDocCommentField::kComment );
xbox_assert( fields[ 1 ]->GetKind() == IScriptDocCommentField::kMethod );
xbox_assert( fields[ 2 ]->GetKind() == IScriptDocCommentField::kSee );
xbox_assert( fields[ 3 ]->GetKind() == IScriptDocCommentField::kMemberOf );
xbox_assert( fields[ 4 ]->GetKind() == IScriptDocCommentField::kDeprecated );
xbox_assert( fields[ 5 ]->GetKind() == IScriptDocCommentField::kAuthor );
xbox_assert( fields[ 6 ]->GetKind() == IScriptDocCommentField::kVersion );
for (std::vector< IScriptDocCommentField * >::iterator iter = fields.begin(); iter != fields.end(); ++iter) {
(*iter)->Release();
}
fields.clear();
sourceString = "/**\n"
"* @param {String} Name A simple string parameter.\n"
"* @param {Integer, Object} Type This can be a number or an object.\n"
"* @param {Date} [When] An optional date parameter.\n"
"*/";
xbox_assert( gLanguageSyntax->ParseScriptDocComment( sourceString, fields ) );
xbox_assert( fields.size() == 3 );
VValueBag *values = fields[ 0 ]->GetContents();
xbox_assert( values );
VString valueText;
xbox_assert( values->GetString( ScriptDocKeys::Name, valueText ) );
xbox_assert( valueText == "Name" );
xbox_assert( values->GetString( ScriptDocKeys::Types, valueText ) );
xbox_assert( valueText == "String" );
xbox_assert( values->GetString( ScriptDocKeys::Comment, valueText ) );
xbox_assert( valueText == "A simple string parameter." );
values->Release();
values = fields[ 2 ]->GetContents();
xbox_assert( values );
xbox_assert( values->GetString( ScriptDocKeys::Name, valueText ) );
xbox_assert( valueText == "When" );
xbox_assert( values->GetString( ScriptDocKeys::Types, valueText ) );
xbox_assert( valueText == "Date" );
xbox_assert( values->GetString( ScriptDocKeys::Comment, valueText ) );
xbox_assert( valueText == "An optional date parameter." );
bool valueBool = false;
xbox_assert( values->GetBool( ScriptDocKeys::IsOptional, valueBool ) );
xbox_assert( valueBool );
values->Release();
for (std::vector< IScriptDocCommentField * >::iterator iter = fields.begin(); iter != fields.end(); ++iter) {
(*iter)->Release();
}
fields.clear();
sourceString = "/**\n"
"* @unknown\n"
"* @anotherUnkownTag This is an unknown tag, but we should still display it fine\n"
"*/";
comment = ScriptDocComment::Create( sourceString );
开发者ID:sanyaade-mobiledev,项目名称:core-Components,代码行数:67,代码来源:ScriptDoc.cpp
示例19: VFile
XBOX::VError VRPCService::GetProxy( XBOX::VString& outProxy, const XBOX::VString& inModulePath, const XBOX::VString& inNamespace, const IHTTPRequest* inRequest, IHTTPResponse* inResponse)
{
VError err = VE_OK;
outProxy.Clear();
if (fApplication != NULL)
{
VRIAContext *riaContext = fApplication->RetainNewContext( err);
if (err == VE_OK)
{
VRPCCatalog *catalog = fApplication->RetainRPCCatalog( riaContext, &err, inRequest, inResponse);
if (err == VE_OK)
{
if (catalog != NULL)
{
MapOfRPCSchema schemas;
err = catalog->RetainSchemasByModule( inModulePath, schemas);
if (err == VE_OK)
{
// Build the proxy
VFile *bodyFile = NULL, *templateFile = NULL;
VFilePath path;
VRIAServerApplication::Get()->GetWAFrameworkFolderPath( path);
path.ToSubFolder( L"Core").ToSubFolder( L"Runtime").ToSubFolder( L"rpcService");
path.SetFileName( L"proxy-body.js", true);
bodyFile = new VFile( path);
if (bodyFile == NULL)
err = vThrowError( VE_MEMORY_FULL);
if (err == VE_OK)
{
path.SetFileName( L"proxy-template.js", true);
templateFile = new VFile( path);
if (templateFile == NULL)
err = vThrowError( VE_MEMORY_FULL);
}
if (err == VE_OK && bodyFile->Exists() && templateFile->Exists())
{
VString templateString;
VFileStream bodyStream( bodyFile);
VFileStream templateStream( templateFile);
err = bodyStream.OpenReading();
if (err == VE_OK)
templateStream.OpenReading();
if (err == VE_OK)
err = bodyStream.GetText( outProxy);
if (err == VE_OK)
{
VValueBag bag;
bag.SetString( L"rpc-pattern", fPatternForMethods);
bag.SetString( L"publishInGlobalNamespace", (fPublishInClientGlobalNamespace) ? L"true" : L"false");
outProxy.Format( &bag);
}
if (err == VE_OK)
err = templateStream.GetText( templateString);
if (err == VE_OK)
{
if (templateString.BeginsWith( L"/*"))
{
// sc 28/08/2014, remove the copyright
VIndex end = templateString.Find( L"*/");
if (end > 0)
{
templateString.Remove( 1, end + 1);
}
}
for (MapOfRPCSchema::const_iterator iter = schemas.begin() ; iter != schemas.end() ; ++iter)
{
VValueBag bag;
bag.SetString( L"function-name", iter->first.GetMethodName());
bag.SetString( L"namespace", inNamespace);
bag.SetString( L"modulePath", inModulePath);
VString proxy( templateString);
proxy.Format( &bag);
outProxy.AppendString( proxy);
}
}
bodyStream.CloseReading();
templateStream.CloseReading();
}
else
{
err = vThrowError( VE_FILE_NOT_FOUND);
}
QuickReleaseRefCountable( bodyFile);
QuickReleaseRefCountable( templateFile);
}
}
else
{
err = vThrowError( VE_RIA_RPC_CATALOG_NOT_FOUND);
//.........这里部分代码省略.........
开发者ID:StephaneH,项目名称:core-Wakanda,代码行数:101,代码来源:VRPCService.cpp
示例20: switch
//.........这里部分代码省略.........
break;
case DB4D_Log_DeleteRecord:
case DB4D_Log_TruncateTable:
{
sLONG recordNumber;
if ( error == VE_OK )
error = fFileStream->GetLong(recordNumber);
/*
sLONG tableIndex;
if ( error == VE_OK )
error = fFileStream->GetLong(tableIndex);
*/
VUUID xTableID;
if ( error == VE_OK )
error = xTableID.ReadFromStream(fFileStream);
if ( error == VE_OK )
*outJournalData = new VDB4DJournalData(globaloperation, logAction,contextID, GetContextExtraData( contextID),timeStamp,recordNumber,xTableID);
}
break;
case DB4D_Log_CreateContextWithUserUUID:
{
VUUID userID;
error = userID.ReadFromStream(fFileStream);
if (error == VE_OK)
*outJournalData = new VDB4DJournalData(globaloperation, logAction,contextID, GetContextExtraData( contextID),timeStamp,userID);
}
break;
case DB4D_Log_CreateContextWithExtra:
{
VValueBag *bag = new VValueBag;
if (bag != NULL)
{
// the extra data is always stored in little endian
Boolean oldNeedSwap = fFileStream->NeedSwap();
fFileStream->SetLittleEndian();
error = bag->ReadFromStream(fFileStream);
fFileStream->SetNeedSwap( oldNeedSwap);
if (error == VE_OK)
{
try
{
fContextExtraByID[contextID] = bag;
}
catch(...)
{
}
*outJournalData = new VDB4DJournalData(globaloperation, logAction,contextID, GetContextExtraData( contextID),timeStamp);
}
}
else
{
error = memfull;
}
ReleaseRefCountable( &bag);
}
break;
case DB4D_Log_CreateBlob:
case DB4D_Log_ModifyBlob:
{
VString path;
开发者ID:sanyaade-iot,项目名称:core-Components,代码行数:67,代码来源:journal_parser.cpp
注:本文中的VValueBag类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论