本文整理汇总了C++中JsonValue::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ JsonValue::GetString方法的具体用法?C++ JsonValue::GetString怎么用?C++ JsonValue::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonValue
的用法示例。
在下文中一共展示了JsonValue::GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: identityFile
TEST(PersistentCognitoIdentityProvider_JsonImpl_Test, TestConstructorWhenFileIsAvaiable)
{
JsonValue theIdentityPoolWeWant;
theIdentityPoolWeWant.WithString("IdentityId", "TheIdentityWeWant");
//this should test the legacy case.
//the next test case will cover the current spec in detail.
JsonValue logins;
logins.WithString("TestLoginName", "TestLoginValue");
theIdentityPoolWeWant.WithObject("Logins", logins);
JsonValue someOtherIdentityPool;
someOtherIdentityPool.WithString("IdentityId", "SomeOtherIdentity");
JsonValue identityDoc;
identityDoc.WithObject("IdentityPoolWeWant", theIdentityPoolWeWant);
identityDoc.WithObject("SomeOtherIdentityPool", someOtherIdentityPool);
Aws::String filePath = ComputeIdentityFilePath();
std::ofstream identityFile(filePath.c_str());
identityFile << identityDoc.WriteReadable();
identityFile.flush();
identityFile.close();
PersistentCognitoIdentityProvider_JsonFileImpl identityProvider("IdentityPoolWeWant", "accountId", filePath.c_str());
FileSystemUtils::RemoveFileIfExists(filePath.c_str());
ASSERT_TRUE(identityProvider.HasIdentityId());
ASSERT_EQ(theIdentityPoolWeWant.GetString("IdentityId"), identityProvider.GetIdentityId());
ASSERT_TRUE(identityProvider.HasLogins());
ASSERT_EQ(1u, identityProvider.GetLogins().size());
ASSERT_EQ("TestLoginName", identityProvider.GetLogins().begin()->first);
ASSERT_EQ("TestLoginValue", identityProvider.GetLogins().begin()->second.accessToken);
}
开发者ID:fabregaszy,项目名称:aws-sdk-cpp,代码行数:34,代码来源:PersistentCognitoIdentityProvider_JsonFileImplTest.cpp
示例2: Load
bool TournamentConfig::Load(const std::string &fileName)
{
JsonValue json;
bool ret = JsonReader::ParseFile(json, fileName);
if (ret)
{
std::string value;
if (json.GetValue("version", value))
{
if (value == TOURNAMENT_CONFIG_VERSION)
{
// Setup tournament configuration
mOptions.turns.clear();
JsonValue tournament = json.FindValue("tournament");
if (tournament.GetArray().Size() > 0U)
{
for (JsonArray::Iterator iter = tournament.GetArray().Begin(); iter != tournament.GetArray().End(); ++iter)
{
if (iter->IsObject())
{
JsonValue value = iter->GetObj().GetValue("type");
Tarot::Distribution shuffle;
if (value.IsString())
{
if (value.GetString() == "custom")
{
shuffle.mType = Tarot::Distribution::CUSTOM_DEAL;
value = iter->GetObj().GetValue("file");
if (value.IsString())
{
shuffle.mFile = value.GetString();
}
else
{
ret = false;
}
}
else if (value.GetString() == "random")
{
shuffle.mType = Tarot::Distribution::RANDOM_DEAL;
}
else if (value.GetString() == "numbered")
{
shuffle.mType = Tarot::Distribution::NUMBERED_DEAL;
shuffle.mSeed = iter->GetObj().GetValue("number").GetInteger();
// FIXME we can add a test on the type here before setting the seed
}
else
{
TLogError("Unsupported deal type value");
ret = false;
}
}
if (ret)
{
mOptions.turns.push_back(shuffle);
}
}
}
}
else
{
TLogError("No tournament details");
ret = false;
}
}
else
{
TLogError("Wrong tournament configuration file version");
ret = false;
}
}
else
{
TLogError("Cannot read tournament configuration file version");
ret = false;
}
}
else
{
TLogError("Cannot open tournament configuration file" + fileName);
}
if (!ret)
{
// Overwrite old file with default value
mOptions = GetDefault();
ret = Save(fileName);
}
mLoaded = true;
return ret;
}
示例3:
AttributeValueByteBuffer::AttributeValueByteBuffer(const JsonValue& jsonValue)
{
m_b = HashingUtils::Base64Decode(jsonValue.GetString("B"));
}