本文整理汇总了C++中StringVector::Push方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVector::Push方法的具体用法?C++ StringVector::Push怎么用?C++ StringVector::Push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVector
的用法示例。
在下文中一共展示了StringVector::Push方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateCamera
void CameraApplication::CreateCamera()
{
if (!lastScene_)
return;
StringVector components;
components.Push("Placeable");
components.Push("Camera");
Entity* cameraEntity = lastScene_->CreateEntity(0, components, AttributeChange::LocalOnly, false, false, true);
if (!cameraEntity)
{
LogError("CameraApplication::CreateCamera: failed to create camera entity");
return;
}
cameraEntity->SetName("FreeLookCamera");
IRenderer* renderer = framework->Renderer();
if (!renderer)
{
LogError("CameraApplication::CreateCamera: can not assign camera; no renderer assigned");
return;
}
renderer->SetMainCamera(cameraEntity);
TundraLogic* logic = framework->Module<TundraLogic>();
if (logic)
logic->SyncManager()->SetObserver(EntityPtr(cameraEntity));
lastCamera_ = cameraEntity;
lastScene_->EntityCreated.Connect(this, &CameraApplication::CheckCameraSpawnPos);
CheckCameraSpawnPos(lastScene_->EntityByName("FreeLookCameraSpawnPos"), AttributeChange::Default);
}
示例2: 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;
}
示例3: GetResponseHeaderKeys
StringVector WebRequest::GetResponseHeaderKeys()
{
StringVector keys;
for (auto it(is_->responseHeaders.Begin()),
itEnd(is_->responseHeaders.End()); it != itEnd; ++it)
{
keys.Push(it->second_.first_);
}
return keys;
}
示例4: BuildAtomicProject
NETBuild* NETBuildSystem::BuildAtomicProject(Project* project)
{
StringVector platforms;
StringVector configurations;
platforms.Push("desktop");
#ifdef ATOMIC_DEBUG
configurations.Push("Debug");
#else
configurations.Push("Release");
#endif
AtomicNETCopyAssemblies(context_, project->GetProjectPath() + "AtomicNET/Lib/");
String solutionPath = project->GetProjectPath() + "AtomicNET/Solution/" + project->GetProjectSettings()->GetName() + ".sln";
NETBuild* build = Build(solutionPath, platforms, configurations);
if (build)
{
ProjectSettings* settings = project->GetProjectSettings();
// This path is currently only hit when refreshing for desktop
if (settings->GetSupportsAndroid() || settings->GetSupportsIOS())
{
// Build the PCL, which will get copied to Resources
build->targets_.Push(project->GetProjectSettings()->GetName());
// Build the Desktop executable, so we can run it
// IMPORTANT NOTE: msbuild requires replacing '.' with '_' when in project name
build->targets_.Push(project->GetProjectSettings()->GetName() + "_Desktop");
}
build->project_ = project;
}
ATOMIC_LOGINFOF("Received build for project %s", project->GetProjectFilePath().CString());
return build;
}
示例5: ActiveAnimations
StringVector AnimationController::ActiveAnimations() const
{
StringVector activeList;
for(auto i = animations_.Begin(); i != animations_.End(); ++i)
{
if (i->second_.phase_ != StopPhase)
activeList.Push(i->first_);
}
return activeList;
}
示例6: GetStringVector
StringVector XMLElement::GetStringVector() const
{
StringVector ret;
XMLElement stringElem = GetChild("string");
while (stringElem)
{
ret.Push(stringElem.GetAttributeCString("value"));
stringElem = stringElem.GetNext("string");
}
return ret;
}
示例7: InsertAlpha
void InsertAlpha(StringVector &container, const String &value)
{
if (container.Find(value) != container.End())
return;
for(auto iter = container.Begin(); iter != container.End(); ++iter)
{
if (value.Compare((*iter), false) < 0)
{
container.Insert(iter, value);
return;
}
}
container.Push(value);
}
示例8: HandleMouseEvent
void SceneInteract::HandleMouseEvent(MouseEvent* e)
{
// Invalidate cached raycast if mouse coordinates have changed
if (frameRaycasted)
if (lastX != e->x || lastY != e->y)
frameRaycasted = false;
lastX = e->x;
lastY = e->y;
itemUnderMouse = GetSubsystem<Urho3D::UI>()->GetElementAt(lastX, lastY, true) != nullptr;
RayQueryResult *raycastResult = ExecuteRaycast();
Entity *hitEntity = lastHitEntity;
if (!hitEntity || !raycastResult)
return;
StringVector actionParams;
if (lastHitEntity)
{
if(e->Type() == MouseEvent::MouseMove)
{
EntityMouseMove.Emit(hitEntity, e->otherButtons, raycastResult);
}
else if (e->Type() == MouseEvent::MouseScroll)
{
actionParams.Push(String(e->relativeZ));
actionParams.Push(Urho3D::ToString("%f,%f,%f", raycastResult->pos.x, raycastResult->pos.y, raycastResult->pos.z));
hitEntity->Exec(EntityAction::Local, "MouseScroll", actionParams);
EntityMouseScroll.Emit(hitEntity, e->relativeZ, raycastResult);
}
else if (e->Type() == MouseEvent::MousePressed)
{
// Execute local entity action with signature:
// Action name: "MousePress"
// String parameters: (int)mouseButton, (float,float,float)"x,y,z"
actionParams.Push(String((int)e->button));
actionParams.Push(Urho3D::ToString("%f,%f,%f", raycastResult->pos.x, raycastResult->pos.y, raycastResult->pos.z));
hitEntity->Exec(EntityAction::Local, "MousePress", actionParams);
EntityClicked.Emit(hitEntity, (int)e->button, raycastResult);
}
else if (e->Type() == MouseEvent::MouseReleased)
{
// Execute local entity action with signature:
// Action name: "MouseRelease"
// String parameters: (int)mouseButton, (float,float,float)"x,y,z", (int)"submesh index"
actionParams.Push(String((int)e->button));
actionParams.Push(Urho3D::ToString("%f,%f,%f", raycastResult->pos.x, raycastResult->pos.y, raycastResult->pos.z));
hitEntity->Exec(EntityAction::Local, "MouseRelease", actionParams);
EntityClickReleased.Emit(hitEntity, (int)e->button, raycastResult);
}
}
}
示例9: ParseCommand
void ParseCommand(String input, String &command, StringVector ¶meters)
{
input = input.Trimmed();
if (input.Empty())
return;
uint parenPos = input.Find('(', 0);
uint spacePos = input.Find(' ', 0);
if (parenPos == String::NPOS && spacePos == String::NPOS)
{
command = input;
return;
}
StringVector parts;
if (parenPos != String::NPOS && parenPos < spacePos)
{
uint parenEndPos = input.FindLast(')');
String insideParens = (parenEndPos != String::NPOS ?
input.Substring(parenPos+1, parenEndPos-parenPos-1).Trimmed() : input.Substring(parenPos+1).Trimmed());
command = input.Substring(0, parenPos).Trimmed();
// "one, two, three", "one,two,three" and "one two three"
parts = insideParens.Contains(',') ? insideParens.Split(',') : insideParens.Split(' ');
}
else
{
command = input.Substring(0, spacePos).Trimmed();
String remaining = input.Substring(spacePos+1).Trimmed();
// "one, two, three", "one,two,three" and "one two three"
parts = remaining.Contains(',') ? remaining.Split(',') : remaining.Split(' ');
}
for(StringVector::Iterator iter=parts.Begin(); iter!=parts.End(); ++iter)
{
String part = (*iter).Trimmed();
if (part.EndsWith(","))
part = part.Substring(0, part.Length()-1);
if (!part.Empty())
parameters.Push(part);
}
}
示例10: GenerateManagedSource
void CSClassWriter::GenerateManagedSource(String& sourceOut)
{
String source = "";
if (klass_->IsNumberArray())
return;
Indent();
source += "\n";
String line;
if (klass_->GetDocString().Length())
{
// monodocer -assembly:NETCore.dll -path:en -pretty
// mdoc export-html -o htmldocs en
source += IndentLine("/// <summary>\n");
if (klass_->GetDocString().Contains('\n'))
source += IndentLine("/* " + klass_->GetDocString() + "*/\n");
else
source += IndentLine("/// " + klass_->GetDocString() + "\n");
source += IndentLine("/// </summary>\n");
}
if (klass_->GetBaseClass())
{
String baseString = klass_->GetBaseClass()->GetName();
const PODVector<JSBClass*>& interfaces = klass_->GetInterfaces();
if (interfaces.Size())
{
StringVector baseStrings;
baseStrings.Push(baseString);
for (unsigned i = 0; i < interfaces.Size(); i++)
{
baseStrings.Push(interfaces.At(i)->GetName());
}
baseString = String::Joined(baseStrings, ",");
}
line = ToString("public partial class %s%s : %s\n", klass_->GetName().CString(), klass_->IsGeneric() ? "<T>" : "", baseString.CString());
}
else
{
String classString = "class";
if (klass_->IsInterface())
classString = "interface";
line = ToString("public partial %s %s%s\n", classString.CString(), klass_->GetName().CString(), klass_->IsGeneric() ? "<T>" : "");
}
source += IndentLine(line);
source += IndentLine("{\n");
Indent();
WriteManagedProperties(source);
JSBPackage* package = klass_->GetPackage();
// CoreCLR has pinvoke security demand code commented out, so we do not (currently) need this optimization:
// https://github.com/dotnet/coreclr/issues/1605
// line = "[SuppressUnmanagedCodeSecurity]\n";
// source += IndentLine(line);
if (!klass_->IsInterface())
{
line = "[DllImport (Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]\n";
source += IndentLine(line);
line = ToString("public static extern IntPtr csb_%s_%s_GetClassIDStatic();\n", package->GetName().CString(), klass_->GetName().CString());
source += IndentLine(line);
source += "\n";
}
Dedent();
// managed functions
CSFunctionWriter::SetWroteConstructor(false);
for (unsigned i = 0; i < klass_->functions_.Size(); i++)
{
JSBFunction* function = klass_->functions_.At(i);
if (function->Skip())
continue;
if (klass_->IsInterface() && function->IsConstructor())
continue;
if (function->IsDestructor())
continue;
if (CSTypeHelper::OmitFunction(function))
//.........这里部分代码省略.........
示例11: GetVariantValue
void JSONValue::GetVariantValue(Variant& variant, VariantType type) const
{
switch (type)
{
case VAR_BOOL:
variant = GetBool();
return;
case VAR_INT:
variant = GetInt();
return;
case VAR_FLOAT:
variant = GetFloat();
return;
case VAR_DOUBLE:
variant = GetDouble();
return;
case VAR_STRING:
variant = GetString();
return;
case VAR_VARIANTVECTOR:
{
VariantVector vector;
GetVariantVector(vector);
variant = vector;
}
return;
case VAR_VARIANTMAP:
{
VariantMap map;
GetVariantMap(map);
variant = map;
}
return;
case VAR_RESOURCEREF:
{
ResourceRef ref;
Vector<String> values = GetString().Split(';');
if (values.Size() == 2)
{
ref.type_ = values[0];
ref.name_ = values[1];
}
variant = ref;
}
return;
case VAR_RESOURCEREFLIST:
{
ResourceRefList refList;
Vector<String> values = GetString().Split(';');
if (values.Size() >= 1)
{
refList.type_ = values[0];
refList.names_.Resize(values.Size() - 1);
for (unsigned i = 1; i < values.Size(); ++i)
refList.names_[i - 1] = values[i];
}
variant = refList;
}
return;
case VAR_STRINGVECTOR:
{
StringVector vector;
for (unsigned i = 0; i < Size(); ++i)
vector.Push((*this)[i].GetString());
variant = vector;
}
return;
default:
variant.FromString(type, GetString());
return;
}
}
示例12: HandleToolUpdate
void NETBuildSystem::HandleToolUpdate(StringHash eventType, VariantMap& eventData)
{
if (curBuild_.Null() && !builds_.Size())
return;
if (curBuild_.Null())
{
// kick off a new build
curBuild_ = builds_.Front();
builds_.PopFront();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
// Ensure solution still exists
if (!fileSystem->FileExists(curBuild_->solutionPath_))
{
CurrentBuildError(ToString("Solution does not exist(%s)", curBuild_->solutionPath_.CString()));
return;
}
String solutionPath = curBuild_->solutionPath_;
String ext = GetExtension(solutionPath);
bool requiresNuGet = true;
if (ext == ".sln")
{
// TODO: handle projects that require nuget
requiresNuGet = false;
if (!fileSystem->FileExists(solutionPath))
{
CurrentBuildError(ToString("Generated solution does not exist (%s : %s)", curBuild_->solutionPath_.CString(), solutionPath.CString()));
return;
}
}
else if (ext == ".json")
{
SharedPtr<NETProjectGen> gen(new NETProjectGen(context_));
gen->SetSupportedPlatforms(curBuild_->platforms_);
gen->SetRewriteSolution(true);
if (!gen->LoadJSONProject(solutionPath))
{
CurrentBuildError(ToString("Error loading project (%s)", solutionPath.CString()));
return;
}
if (!gen->Generate())
{
CurrentBuildError(ToString("Error generating project (%s)", solutionPath.CString()));
return;
}
solutionPath = gen->GetSolution()->GetOutputFilename();
requiresNuGet = gen->GetRequiresNuGet();
if (!fileSystem->FileExists(solutionPath))
{
CurrentBuildError(ToString("Generated solution does not exist (%s : %s)", curBuild_->solutionPath_.CString(), solutionPath.CString()));
return;
}
}
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
const String& nugetBinary = tenv->GetAtomicNETNuGetBinary();
if (requiresNuGet && !fileSystem->FileExists(nugetBinary))
{
CurrentBuildError(ToString("NuGet binary is missing (%s)", nugetBinary.CString()));
return;
}
StringVector stringVector;
String platforms;
StringVector processedPlatforms;
String configs;
for (unsigned i = 0; i < curBuild_->configurations_.Size(); i++)
{
stringVector.Push(ToString("/p:Configuration=%s", curBuild_->configurations_[i].CString()));
}
configs = String::Joined(stringVector, " ");
stringVector.Clear();
for (unsigned i = 0; i < curBuild_->platforms_.Size(); i++)
{
// map platform
String platform = curBuild_->platforms_[i];
if (platform == "windows" || platform == "macosx" || platform == "linux")
{
ATOMIC_LOGINFOF("Platform \"%s\" mapped to \"desktop\"", platform.CString());
//.........这里部分代码省略.........