本文整理汇总了C++中StringVector::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVector::Size方法的具体用法?C++ StringVector::Size怎么用?C++ StringVector::Size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVector
的用法示例。
在下文中一共展示了StringVector::Size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlayAnimAutoStop
void AnimationController::PlayAnimAutoStop(const String &name, const String &fadein, const String &exclusive)
{
if (!name.Length())
{
LogWarning("Empty animation name for PlayAnimAutoStop");
return;
}
float fadein_ = 0.0f;
if (fadein.Length())
fadein_ = ToFloat(fadein);
bool exclusive_ = false;
if (exclusive.Length())
exclusive_ = ToBool(exclusive);
bool success;
if (exclusive_)
success = EnableExclusiveAnimation(name, false, fadein_, false);
else
success = EnableAnimation(name, false, fadein_, false);
if (!success)
{
StringVector anims = AvailableAnimations();
void (*log)(const String &) = LogDebug; if (anims.Size() > 0) log = LogWarning;
log("Failed to play animation \"" + name + "\" on entity " + ParentEntity()->Name());
log("The entity has " + String(anims.Size()) + " animations available: " + Join(anims, ","));
// Enable autostop, and start always from the beginning
SetAnimationAutoStop(name, true);
SetAnimationTimePosition(name, 0.0f);
}
}
示例2: PlayReverseAnim
void AnimationController::PlayReverseAnim(const String &name, const String &fadein, const String &exclusive)
{
if (!ViewEnabled())
return;
if (!name.Length())
{
LogWarning("Empty animation name for PlayReverseAnim");
return;
}
float fadein_ = 0.0f;
if (fadein.Length())
fadein_ = ToFloat(fadein);
bool exclusive_ = false;
if (exclusive.Length())
exclusive_ = ToBool(exclusive);
bool success;
if (exclusive_)
success = EnableAnimation(name, true, fadein_, false);
else
success = EnableExclusiveAnimation(name, true, fadein_, fadein_, false);
if (!success)
{
StringVector anims = AvailableAnimations();
void (*log)(const String &) = LogDebug; if (anims.Size() > 0) log = LogWarning;
log("Failed to play animation \"" + name + "\" in reverse on entity " + ParentEntity()->Name());
log("The entity has " + String(anims.Size()) + " animations available: " + Join(anims, ","));
SetAnimationToEnd(name);
SetAnimationSpeed(name, -1.0f);
}
}
示例3: BuildManaged
bool BuildWindows::BuildManaged(const String& buildPath)
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
ToolSystem* toolSystem = GetSubsystem<ToolSystem>();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
Project* project = toolSystem->GetProject();
ProjectSettings* settings = project->GetProjectSettings();
String projectPath = project->GetProjectPath();
#ifdef ATOMIC_DEBUG
String config = "Debug";
#else
String config = "Release";
#endif
String managedBins = projectPath + ToString("AtomicNET/%s/Bin/Desktop/", config.CString());
String managedExe = managedBins + settings->GetName() + ".exe";
if (!fileSystem->FileExists(managedExe))
{
FailBuild(ToString("Error building managed project, please compile the %s binary %s before building", config.CString(), managedExe.CString()));
return false;
}
StringVector results;
StringVector filtered;
fileSystem->ScanDir(results, managedBins, "", SCAN_FILES, false);
StringVector filterList;
StringVector::Iterator itr = results.Begin();
while (itr != results.End())
{
unsigned i;
for (i = 0; i < filterList.Size(); i++)
{
if (itr->Contains(filterList[i]))
break;
}
if (i == filterList.Size())
filtered.Push(*itr);
itr++;
}
for (unsigned i = 0; i < filtered.Size(); i++)
{
String filename = filtered[i];
if (!BuildCopyFile(managedBins + filename, buildPath_ + "/" + filename))
return false;
}
return true;
}
示例4: Object
NETBuild::NETBuild(Context* context, const String& solutionPath, const StringVector& platforms, const StringVector& configurations) :
Object(context),
solutionPath_(solutionPath),
status_(NETBUILD_PENDING)
{
for (unsigned i = 0; i < platforms.Size() ; i++)
{
platforms_.Push(platforms[i].ToLower());
}
for (unsigned i = 0; i < configurations.Size() ; i++)
{
String config = configurations[i];
config.Replace("release", "Release");
config.Replace("debug", "Debug");
configurations_.Push(config);
}
}
示例5: Join
String Join(const StringVector &list, const String &separator)
{
String joined = "";
for (unsigned int i=0 ; i<list.Size() ; ++i)
{
if (i != 0)
joined += separator;
joined += list[i];
}
return joined;
}
示例6: PreloadClassAssemblies
bool CSComponentAssembly::PreloadClassAssemblies()
{
// TEMPORARY SOLUTION, Desktop only
ATOMIC_LOGINFO("Preloading Class Assemblies");
Context* context = ScriptSystem::GetContext();
assert(context);
ResourceCache* cache = context->GetSubsystem<ResourceCache>();
FileSystem* fileSystem = context->GetSubsystem<FileSystem>();
const StringVector& resourceDirs = cache->GetResourceDirs();
for (unsigned i = 0; i < resourceDirs.Size(); i++)
{
const String& resourceDir = resourceDirs[i];
ATOMIC_LOGINFOF("Scanning: %s", resourceDir.CString());
StringVector results;
fileSystem->ScanDir(results, resourceDir, "*.dll", SCAN_FILES, true);
for (unsigned j = 0; j < results.Size(); j++)
{
// FIXME: This filtering is necessary as we're loading setting project root folder as a resource dir
// https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1037
String filter = results[j].ToLower();
if (filter.StartsWith("atomicnet/") || filter.StartsWith("resources/"))
{
ATOMIC_LOGINFOF("Skipping Assembly: %s (https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1037)", results[j].CString());
continue;
}
ATOMIC_LOGINFOF("Loading Assembly: %s", results[j].CString());
cache->GetResource<CSComponentAssembly>(results[j]);
}
}
return true;
}
示例7: ResolveClassAssembly
CSComponentAssembly* CSComponentAssembly::ResolveClassAssembly(const String& fullClassName)
{
Context* context = ScriptSystem::GetContext();
assert(context);
String classname = fullClassName;
String csnamespace;
// Handle namespaces
if (fullClassName.Contains('.'))
{
StringVector elements = fullClassName.Split('.');
if (elements.Size() <= 1)
return 0;
classname = elements.Back();
elements.Pop();
csnamespace = String::Joined(elements, ".");
}
ResourceCache* cache = context->GetSubsystem<ResourceCache>();
PODVector<CSComponentAssembly*> assemblies;
cache->GetResources<CSComponentAssembly>(assemblies);
for (unsigned i = 0; i < assemblies.Size(); i++)
{
CSComponentAssembly* assembly = assemblies[i];
// TODO: support namespaces
const StringVector& classNames = assembly->GetClassNames();
if (classNames.Contains(classname))
{
return assembly;
}
}
return 0;
}
示例8: Load
bool ResourceMapRouter::Load(const JSONValue& json)
{
const JSONValue& assetMap = json.Get("assetMap");
if (!assetMap.IsObject())
return false;
ConstJSONObjectIterator itr = assetMap.Begin();
while (itr != assetMap.End())
{
StringVector tags = itr->first_.Split(';');
if (tags.Size() == 2)
{
resourceMap_[tags[0]][tags[1]] = itr->second_.GetString();
}
itr++;
}
return true;
}
示例9: FromString
void Variant::FromString(VariantType type, const char* value)
{
switch (type)
{
case VAR_INT:
*this = ToInt(value);
break;
case VAR_INT64:
*this = ToInt64(value);
break;
case VAR_BOOL:
*this = ToBool(value);
break;
case VAR_FLOAT:
*this = ToFloat(value);
break;
case VAR_VECTOR2:
*this = ToVector2(value);
break;
case VAR_VECTOR3:
*this = ToVector3(value);
break;
case VAR_VECTOR4:
*this = ToVector4(value);
break;
case VAR_QUATERNION:
*this = ToQuaternion(value);
break;
case VAR_COLOR:
*this = ToColor(value);
break;
case VAR_STRING:
*this = value;
break;
case VAR_BUFFER:
{
SetType(VAR_BUFFER);
PODVector<unsigned char>& buffer = *(reinterpret_cast<PODVector<unsigned char>*>(&value_));
StringToBuffer(buffer, value);
}
break;
case VAR_VOIDPTR:
// From string to void pointer not supported, set to null
*this = (void*)0;
break;
case VAR_RESOURCEREF:
{
StringVector values = String::Split(value, ';');
if (values.Size() == 2)
{
SetType(VAR_RESOURCEREF);
ResourceRef& ref = *(reinterpret_cast<ResourceRef*>(&value_));
ref.type_ = values[0];
ref.name_ = values[1];
}
}
break;
case VAR_RESOURCEREFLIST:
{
StringVector values = String::Split(value, ';', true);
if (values.Size() >= 1)
{
SetType(VAR_RESOURCEREFLIST);
ResourceRefList& refList = *(reinterpret_cast<ResourceRefList*>(&value_));
refList.type_ = values[0];
refList.names_.Resize(values.Size() - 1);
for (unsigned i = 1; i < values.Size(); ++i)
refList.names_[i - 1] = values[i];
}
}
break;
case VAR_INTRECT:
*this = ToIntRect(value);
break;
case VAR_INTVECTOR2:
*this = ToIntVector2(value);
break;
case VAR_INTVECTOR3:
*this = ToIntVector3(value);
break;
case VAR_PTR:
// From string to RefCounted pointer not supported, set to null
*this = (RefCounted*)0;
//.........这里部分代码省略.........