当前位置: 首页>>代码示例>>C++>>正文


C++ PJsonVal类代码示例

本文整理汇总了C++中PJsonVal的典型用法代码示例。如果您正苦于以下问题:C++ PJsonVal类的具体用法?C++ PJsonVal怎么用?C++ PJsonVal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PJsonVal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NewArr

PJsonVal TJsonVal::NewArr(const TStrV& StrV) {
  PJsonVal Val = TJsonVal::NewArr();
  for (int StrN = 0; StrN < StrV.Len(); StrN++) {
    Val->AddToArr(TJsonVal::NewStr(StrV[StrN]));
  }
  return Val;
}
开发者ID:lstopar,项目名称:qminer,代码行数:7,代码来源:json.cpp

示例2: MergeObj

// extend/update the object with values from Val
// this and Val should be an Object and not an array or something else
void TJsonVal::MergeObj(const PJsonVal& Val) {
  EAssert(Val->IsObj() && IsObj());
  for (int N = 0; N < Val->GetObjKeys(); N++) {
    const TStr Key = Val->GetObjKey(N);
    AddToObj(Key, Val->GetObjKey(Key));
  }
}
开发者ID:lstopar,项目名称:qminer,代码行数:9,代码来源:json.cpp

示例3: HandleScope

PJsonVal TNodeJsStreamAggr::SaveJson(const int& Limit) const {
	if (!SaveJsonFun.IsEmpty()) {
		v8::Isolate* Isolate = v8::Isolate::GetCurrent();
		v8::HandleScope HandleScope(Isolate);

		v8::Local<v8::Function> Callback = v8::Local<v8::Function>::New(Isolate, SaveJsonFun);
		v8::Local<v8::Object> GlobalContext = Isolate->GetCurrentContext()->Global();
		const unsigned Argc = 1;
		v8::Local<v8::Value> ArgV[Argc] = { v8::Number::New(Isolate, Limit) };
		v8::TryCatch TryCatch;
		v8::Local<v8::Value> ReturnVal = Callback->Call(GlobalContext, Argc, ArgV);
		if (TryCatch.HasCaught()) {
			TryCatch.ReThrow();	
			return TJsonVal::NewObj();
		}
		QmAssertR(ReturnVal->IsObject(), "Stream aggr JS callback: saveJson didn't return an object.");
		PJsonVal Res = TNodeJsUtil::GetObjJson(ReturnVal->ToObject());

		QmAssertR(Res->IsDef(), "Stream aggr JS callback: saveJson didn't return a valid JSON.");
		return Res;
	}
	else {
		return TJsonVal::NewObj();
	}
}
开发者ID:Zala,项目名称:qminer,代码行数:25,代码来源:qm_nodejs_streamaggr.cpp

示例4: GetJson

PJsonVal TBackupLogInfo::GetJson() const
{
    PJsonVal RetJson = TJsonVal::NewObj("folderName", FolderName);
    RetJson->AddToObj("secsNeeded", SecsNeeded);
    RetJson->AddToObj("logInfo", LogInfo);
    return RetJson;
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:7,代码来源:folderbackup.cpp

示例5: EAssert

void TJsonVal::GetArrNumV(TFltV& FltV) const {
    EAssert(IsArr());
    for (int FltN = 0; FltN < GetArrVals(); FltN++) {
        PJsonVal ArrVal = GetArrVal(FltN);
        EAssert(ArrVal->IsNum());
        FltV.Add(ArrVal->GetNum());
    }
}
开发者ID:lstopar,项目名称:qminer,代码行数:8,代码来源:json.cpp

示例6: GetOrder

PJsonVal TGraphCascade::GetOrder() const {
    PJsonVal OrderArr = TJsonVal::NewArr();
    int Len = NIdSweep.Len();
    for (int NodeN = 0; NodeN < Len; NodeN++) {
        TStr NodeNm = NodeIdNmH.GetDat(NIdSweep[NodeN]);
        OrderArr->AddToArr(NodeNm);
    }
    return OrderArr;
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:9,代码来源:graphprocess.cpp

示例7: ProcessEnabled

void TGraphCascade::ProcessEnabled(const PJsonVal& EnabledList) {
    int Len = EnabledList->GetArrVals();
    for (int ElN = 0; ElN < Len; ElN++) {
        TStr NodeNm = EnabledList->GetArrVal(ElN)->GetStr();
        if (NodeNmIdH.IsKey(NodeNm)) {
            EnabledNodeIdH.AddKey(NodeNmIdH.GetDat(NodeNm));
        }
    }
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:9,代码来源:graphprocess.cpp

示例8: SaveLogs

// save the logs of the backups to the log file
void TBackupProfile::SaveLogs() const
{
    TJsonValV ArrV;
    for (int N = 0; N < LogV.Len(); N++)
        ArrV.Add(LogV[N].GetJson());
    PJsonVal JsonArr = TJsonVal::NewArr(ArrV);
    TStr JsonStr = JsonArr->SaveStr();
    JsonStr.SaveTxt(ProfileLogFile);
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:10,代码来源:folderbackup.cpp

示例9: HandleScope

v8::Local<v8::Value> TNodeJsYL40Adc::TReadTask::WrapResult() {
	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::EscapableHandleScope HandleScope(Isolate);

	PJsonVal ResJson = TJsonVal::NewObj();
	for (int InputN = 0; InputN < Adc->InputNumNmKdV.Len(); InputN++) {
		ResJson->AddToObj(Adc->InputNumNmKdV[InputN].Dat, ValV[InputN]);
	}

	return HandleScope.Escape(TNodeJsUtil::ParseJson(Isolate, ResJson));
}
开发者ID:lstopar,项目名称:HomeDevelopment,代码行数:11,代码来源:rpinode.cpp

示例10: 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);
}
开发者ID:Austindeadhead,项目名称:qminer,代码行数:12,代码来源:tokenizer.cpp

示例11: HandleScope

void TNodeJsFOut::writeJson(const v8::FunctionCallbackInfo<v8::Value>& Args) {
    v8::Isolate* Isolate = v8::Isolate::GetCurrent();
    v8::HandleScope HandleScope(Isolate);
    
    PJsonVal JsonVal = TNodeJsUtil::GetArgJson(Args, 0);
    TStr JsonStr = JsonVal->SaveStr();
    
    TNodeJsFOut* JsFOut = ObjectWrap::Unwrap<TNodeJsFOut>(Args.This());
    EAssertR(!JsFOut->SOut.Empty(), "Output stream already closed!");
    JsonStr.Save(*JsFOut->SOut);
    
    Args.GetReturnValue().Set(Args.Holder());
}
开发者ID:quintelligence,项目名称:qminer,代码行数:13,代码来源:fs_nodejs.cpp

示例12: GetGraph

PJsonVal TGraphCascade::GetGraph() const {
    PJsonVal G = TJsonVal::NewObj();
    for (TNGraph::TNodeI NI = Graph.BegNI(); NI < Graph.EndNI(); NI++) {
        TStr NodeNm = NodeIdNmH.GetDat(NI.GetId());
        PJsonVal ParentsArr = TJsonVal::NewArr();
        int InDeg = NI.GetInDeg();
        for (int ParentN = 0; ParentN < InDeg; ParentN++) {
            TStr ParentNm = NodeIdNmH.GetDat(NI.GetInNId(ParentN));
            ParentsArr->AddToArr(ParentNm);
        }
        G->AddToObj(NodeNm, ParentsArr);
    }
    return G;
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:14,代码来源:graphprocess.cpp

示例13: GenGraph

TGraphCascade::TGraphCascade(const PJsonVal& Params) {
    // build graph and node name-id maps
    PJsonVal Dag = Params->GetObjKey("dag");
    GenGraph(Dag);
    // read enabled (ignore the ones missing from the graph)
    PJsonVal EnabledNodeIdH = Params->GetObjKey("enabledNodes");
    ProcessEnabled(EnabledNodeIdH);
    PruneGraph();
    InitTimestamps();
    // read models
    PJsonVal NodeModels = Params->GetObjKey("nodeModels");
    ProcessModels(NodeModels);
    TimeUnit = Params->GetObjInt("timeUnit", 1000);
    Rnd.PutSeed(Params->GetObjInt("randSeed", 0));
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:15,代码来源:graphprocess.cpp

示例14: AddToObj

void TJsonVal::AddToObj(const PJsonVal& Val) {
  EAssert(Val->IsObj());
  int KeyId = Val->KeyValH.FFirstKeyId();
  while (Val->KeyValH.FNextKeyId(KeyId)) {
    AddToObj(Val->KeyValH.GetKey(KeyId), Val->KeyValH[KeyId]);
  }
}
开发者ID:lstopar,项目名称:qminer,代码行数:7,代码来源:json.cpp

示例15: LastVal

TEma::TEma(const PJsonVal& ParamVal) : LastVal(TFlt::Mn), InitP(false) {
    // type
    TStr TypeStr = ParamVal->GetObjStr("emaType");
    if (TypeStr == "previous") { 
        Type = etPreviousPoint;
    } else if (TypeStr == "linear") {
        Type = etLinear;
    } else if (TypeStr == "next") {
        Type = etNextPoint;
    } else {
        throw TExcept::New("Unknown ema type " + TypeStr);
    }
    // rest
    TmInterval = ParamVal->GetObjNum("interval");
    InitMinMSecs = ParamVal->GetObjInt("initWindow", 0);
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:16,代码来源:signalproc.cpp


注:本文中的PJsonVal类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。