本文整理汇总了C++中PJsonVal::GetObjBool方法的典型用法代码示例。如果您正苦于以下问题:C++ PJsonVal::GetObjBool方法的具体用法?C++ PJsonVal::GetObjBool怎么用?C++ PJsonVal::GetObjBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PJsonVal
的用法示例。
在下文中一共展示了PJsonVal::GetObjBool方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleScope
TNodeJsRf24Radio* TNodeJsRf24Radio::NewFromArgs(const v8::FunctionCallbackInfo<v8::Value>& Args) {
v8::Isolate* Isolate = v8::Isolate::GetCurrent();
v8::HandleScope HandleScope(Isolate);
PJsonVal ParamJson = TNodeJsUtil::GetArgJson(Args, 0);
const int PinCE = ParamJson->GetObjInt("pinCE");
const int PinCSN = ParamJson->GetObjInt("pinCSN");
const uint16 MyId = (uint16) ParamJson->GetObjInt("id");
const PJsonVal SensorJsonV = ParamJson->GetObjKey("sensors");
const bool Verbose = ParamJson->GetObjBool("verbose", false);
const PNotify Notify = Verbose ? TNotify::StdNotify : TNotify::NullNotify;
Notify->OnNotify(TNotifyType::ntInfo, "Parsing configuration ...");
TStrIntH SensorNmIdH;
TStrIntH SensorIdNodeIdH;
for (int SensorN = 0; SensorN < SensorJsonV->GetArrVals(); SensorN++) {
const PJsonVal SensorJson = SensorJsonV->GetArrVal(SensorN);
const TStr& SensorId = SensorJson->GetObjStr("id");
SensorNmIdH.AddDat(SensorId, SensorJson->GetObjInt("internalId"));
SensorIdNodeIdH.AddDat(SensorId, SensorJson->GetObjInt("nodeId"));
}
Notify->OnNotify(TNotifyType::ntInfo, "Calling cpp constructor ...");
return new TNodeJsRf24Radio(MyId, PinCE, PinCSN, SensorNmIdH, SensorIdNodeIdH, Notify);
}
示例2: ParseJson
PStemmer TStemmer::ParseJson(const PJsonVal& StemmerVal, const bool& RealWordP) {
if (StemmerVal->IsBool()) {
return TStemmer::New(StemmerVal->GetBool() ? stmtPorter : stmtNone, RealWordP);
} else if (StemmerVal->IsObj()) {
TStr StemmerType = StemmerVal->GetObjStr("type", "none");
const bool RealWordP = StemmerVal->GetObjBool("realWord", RealWordP);
return TStemmer::New((StemmerType == "porter") ? stmtPorter : stmtNone, RealWordP);
}
throw TExcept::New("Unknown stemmer definiton " + StemmerVal->SaveStr());
}
示例3: New
PTokenizer THtml::New(const PJsonVal& ParamVal) {
// get stopwords
PSwSet SwSet = ParamVal->IsObjKey("stopwords") ?
TSwSet::ParseJson(ParamVal->GetObjKey("stopwords")) :
TSwSet::New(swstNone);
// get stemmer
PStemmer Stemmer = ParamVal->IsObjKey("stemmer") ?
TStemmer::ParseJson(ParamVal->GetObjKey("stemmer"), false) :
TStemmer::New(stmtNone, false);
const bool ToUcP = ParamVal->GetObjBool("uppercase", true);
return new THtml(SwSet, Stemmer, ToUcP);
}
示例4:
TOnlineHistogram::TOnlineHistogram(const PJsonVal& ParamVal) {
EAssertR(ParamVal->IsObjKey("lowerBound"), "TOnlineHistogram: lowerBound key missing!");
EAssertR(ParamVal->IsObjKey("upperBound"), "TOnlineHistogram: upperBound key missing!");
// bounded lowest point
TFlt LBound = ParamVal->GetObjNum("lowerBound");
// bounded highest point
TFlt UBound = ParamVal->GetObjNum("upperBound");
EAssertR(LBound < UBound, "TOnlineHistogram: Lower bound should be smaller than upper bound");
// number of equal bins ? (not counting possibly infinite ones)
TInt Bins = ParamVal->GetObjInt("bins", 5);
EAssertR(Bins > 0, "TOnlineHistogram: Number of bins should be greater than 0");
// include infinities in the bounds?
TBool AddNegInf = ParamVal->GetObjBool("addNegInf", false);
TBool AddPosInf = ParamVal->GetObjBool("addPosInf", false);
MinCount = ParamVal->GetObjInt("initMinCount", 0);
Init(LBound, UBound, Bins, AddNegInf, AddPosInf);
};
示例5: EAssertR
//
// TBackupProfile
//
TBackupProfile::TBackupProfile(const PJsonVal& SettingsJson, const TStr& Destination_, const TStr& ProfileName_)
{
Destination = Destination_;
if (Destination.Len() > 0 && (Destination.LastCh() != '\\' || Destination.LastCh() != '/'))
Destination += "/";
ProfileName = ProfileName_;
if (!TDir::Exists(Destination))
TDir::GenDir(Destination);
VersionsToKeep = SettingsJson->GetObjInt("versionsToKeep", 1);
PJsonVal FoldersJson = SettingsJson->GetObjKey("folders");
EAssertR(FoldersJson->IsArr(), "Expected to get an array of folders");
for (int N = 0; N < FoldersJson->GetArrVals(); N++) {
PJsonVal FolderJson = FoldersJson->GetArrVal(N);
TBackupFolderInfo FolderInfo;
FolderInfo.Folder = FolderJson->GetObjStr("folder");
if (FolderJson->IsObjKey("extensions"))
FolderJson->GetObjStrV("extensions", FolderInfo.Extensions);
if (FolderInfo.Extensions.IsIn("*"))
FolderInfo.Extensions.Clr();
FolderInfo.IncludeSubfolders = FolderJson->GetObjBool("includeSubfolders");
if (FolderJson->IsObjKey("skipIfContaining"))
FolderJson->GetObjStrV("skipIfContaining", FolderInfo.SkipIfContainingV);
FolderV.Add(FolderInfo);
}
// load logs of the previous backups
ProfileLogFile = Destination + ProfileName + "/backupInfo.json";
if (TFile::Exists(ProfileLogFile)) {
PJsonVal LogJson = TJsonVal::GetValFromStr(TStr::LoadTxt(ProfileLogFile));
if (LogJson->IsArr()) {
for (int N = 0; N < LogJson->GetArrVals(); N++) {
PJsonVal Log = LogJson->GetArrVal(N);
LogV.Add(TBackupLogInfo(Log));
}
}
}
}