本文整理汇总了C++中json::Value::HasKey方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::HasKey方法的具体用法?C++ Value::HasKey怎么用?C++ Value::HasKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::Value
的用法示例。
在下文中一共展示了Value::HasKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseStageConnections
void CompositorLoader::ParseStageConnections(CompositeStageConnections& connections, const json::Value& stageJson)
{
if (stageJson.HasKey("input") && stageJson["input"].GetType() == ArrayVal)
{
Array inputArray = stageJson["input"].ToArray();
for (auto it = inputArray.begin(); it != inputArray.end(); ++it)
{
connections.AddRenderTargetInput(it->ToString(""));
}
}
if (stageJson.HasKey("output") && stageJson["output"].GetType() == ArrayVal)
{
Array inputArray = stageJson["output"].ToArray();
for (auto it = inputArray.begin(); it != inputArray.end(); ++it)
{
connections.AddRenderTarget(it->ToString(""));
}
}
if (stageJson.HasKey("depthBuffer") && stageJson["depthBuffer"].GetType() == StringVal)
{
connections.SetDepthBuffer(stageJson["depthBuffer"].ToString());
}
}
示例2: ParseStage
void CompositorLoader::ParseStage(ResourceManager& resourceManager, Compositor::Ptr& compositor, const json::Value& stageJson)
{
if (stageJson.HasKey("disabled") && stageJson["disabled"].ToBool(false))
{
return;
}
if (!stageJson.HasKey("stage") || stageJson["stage"].GetType() != StringVal)
{
throw FormatException("stages[].stage needs to be a string containing the relvative path to a CompositeStage");
}
CompositeStageConnections connections;
ParseStageConnections(connections, stageJson);
std::string stageFilename = stageJson["stage"].ToString();
CompositeStage::Ptr stage = resourceManager.LoadResource<CompositeStage>(stageFilename);
if (stageJson.HasKey("shaderValues"))
{
Array defaultValues = stageJson["shaderValues"].ToArray();
for (auto it = defaultValues.begin(); it != defaultValues.end(); ++it)
{
JsonTypeHelper::ParseValueIntoParameters(stage->GetStateParameters(), *it);
}
}
compositor->AddCompositeStage(stage, connections);
}
示例3: ParseSampler
Sampler::Ptr SamplerLoader::ParseSampler(ResourceManager& resourceManager, const json::Value& root)
{
if (root.GetType() == StringVal)
{
return resourceManager.LoadResource<Sampler>(root.ToString());
}
SamplerDescription description;
description.samplingMode = ParseSamplingMode(root["sampling"].ToString("basic"));
description.anisotropicEnabled = root["anisotropicEnabled"].ToBool(false);
description.minFilter = ParseInterpolatioMode(root["minFilter"].ToString("linear"));
description.magFilter = ParseInterpolatioMode(root["magFilter"].ToString("linear"));
description.mipFilter = ParseInterpolatioMode(root["mipFilter"].ToString("linear"));
description.uWrap = ParseEdgeSampling(root["uWrap"].ToString("clamp"));
description.vWrap = ParseEdgeSampling(root["vWrap"].ToString("clamp"));
description.wWrap = ParseEdgeSampling(root["wWrap"].ToString("clamp"));
description.useMipMap = root["useMipMap"].ToBool(description.useMipMap);
description.mipBias = root["mipBias"].ToFloat(description.mipBias);
description.minLOD = root["minLOD"].ToFloat(description.minLOD);
description.maxLOD = root["maxLOD"].ToFloat(description.maxLOD);
description.compareFunction = JsonTypeHelper::ParseCompareFunction(root["compareFunction"].ToString("never"));
description.maxAnisotropy = root["maxAnisotropy"].ToInt(description.maxAnisotropy);
if (root.HasKey("borderColor"))
{
description.borderColor = JsonTypeHelper::ParseColor(root["borderColor"]);
}
return resourceManager.GetGraphics()->CreateSampler(description);
}