本文整理汇总了C++中sqf::Parameters::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Parameters::size方法的具体用法?C++ Parameters::size怎么用?C++ Parameters::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqf::Parameters
的用法示例。
在下文中一共展示了Parameters::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populateQuery
void SqlCustDataSource::populateQuery(string query, Sqf::Parameters& params, CustomDataQueue& queue)
{
for (int i = 0; i < params.size(); i++)
{
query = boost::algorithm::replace_nth_copy(query, "?", i, Sqf::GetStringAny(params.at(i)));
}
auto custRes = getDB()->queryParams(query.c_str());
while (custRes->fetchRow())
{
Sqf::Parameters custParams;
for (int i = 0; i < custRes->numFields(); i++)
{
int val = custRes->at(i).getInt32();
if (val == 0 && custRes->at(i).getString() != "0")
{
custParams.push_back(custRes->at(i).getString());
}
else
{
custParams.push_back(val);
}
}
queue.push(custParams);
}
}
示例2: customExecute
bool SqlCustDataSource::customExecute(string query, Sqf::Parameters& params) {
static SqlStatementID stmtId;
auto stmt = getDB()->makeStatement(stmtId, query);
for (int i = 0; i < params.size(); i++)
{
try
{
stmt->addInt32(lexical_cast<int>(params.at(i)));
}
catch (bad_lexical_cast)
{
stmt->addString(lexical_cast<string>(params.at(i)));
}
}
bool exRes = stmt->execute();
poco_assert(exRes == true);
return exRes;
}
示例3: playerUpdate
Sqf::Value HiveExtApp::playerUpdate( Sqf::Parameters params )
{
int characterId = Sqf::GetIntAny(params.at(0));
CharDataSource::FieldsType fields;
try
{
if (!Sqf::IsNull(params.at(1)))
{
Sqf::Parameters worldSpaceArr = boost::get<Sqf::Parameters>(params.at(1));
if (worldSpaceArr.size() > 0)
{
Sqf::Value worldSpace = worldSpaceArr;
fields["worldspace"] = worldSpace;
}
}
if (!Sqf::IsNull(params.at(2)))
{
Sqf::Parameters inventoryArr = boost::get<Sqf::Parameters>(params.at(2));
if (inventoryArr.size() > 0)
{
Sqf::Value inventory = inventoryArr;
fields["inventory"] = inventory;
}
}
if (!Sqf::IsNull(params.at(3)))
{
Sqf::Parameters backpackArr = boost::get<Sqf::Parameters>(params.at(3));
if (backpackArr.size() > 0)
{
Sqf::Value backpack = backpackArr;
fields["backpack"] = backpack;
}
}
if (!Sqf::IsNull(params.at(4)))
{
Sqf::Parameters medicalArr = boost::get<Sqf::Parameters>(params.at(4));
if (medicalArr.size() > 0)
{
for (size_t i=0;i<medicalArr.size();i++)
{
if (Sqf::IsAny(medicalArr[i]))
{
logger().warning("update.medical["+lexical_cast<string>(i)+"] changed from any to []");
medicalArr[i] = Sqf::Parameters();
}
}
Sqf::Value medical = medicalArr;
fields["medical"] = medical;
}
}
if (!Sqf::IsNull(params.at(5)))
{
bool justAte = boost::get<bool>(params.at(5));
if (justAte) fields["just_ate"] = true;
}
if (!Sqf::IsNull(params.at(6)))
{
bool justDrank = boost::get<bool>(params.at(6));
if (justDrank) fields["just_drank"] = true;
}
if (!Sqf::IsNull(params.at(7)))
{
int moreKillsZ = boost::get<int>(params.at(7));
if (moreKillsZ > 0) fields["zombie_kills"] = moreKillsZ;
}
if (!Sqf::IsNull(params.at(8)))
{
int moreKillsH = boost::get<int>(params.at(8));
if (moreKillsH > 0) fields["headshots"] = moreKillsH;
}
if (!Sqf::IsNull(params.at(9)))
{
int distanceWalked = static_cast<int>(Sqf::GetDouble(params.at(9)));
if (distanceWalked > 0) fields["DistanceFoot"] = distanceWalked;
}
if (!Sqf::IsNull(params.at(10)))
{
int durationLived = static_cast<int>(Sqf::GetDouble(params.at(10)));
if (durationLived > 0) fields["survival_time"] = durationLived;
}
if (!Sqf::IsNull(params.at(11)))
{
Sqf::Parameters currentStateArr = boost::get<Sqf::Parameters>(params.at(11));
if (currentStateArr.size() > 0)
{
Sqf::Value currentState = currentStateArr;
fields["state"] = currentState;
}
}
if (!Sqf::IsNull(params.at(12)))
{
int moreKillsHuman = boost::get<int>(params.at(12));
if (moreKillsHuman > 0) fields["survivor_kills"] = moreKillsHuman;
}
if (!Sqf::IsNull(params.at(13)))
{
int moreKillsBandit = boost::get<int>(params.at(13));
if (moreKillsBandit > 0) fields["bandit_kills"] = moreKillsBandit;
}
//.........这里部分代码省略.........