本文整理汇总了C++中json::Value::append方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::append方法的具体用法?C++ Value::append怎么用?C++ Value::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::Value
的用法示例。
在下文中一共展示了Value::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DupLabel
void CRpcHelper::DupLabel( const address_str& addr, const label_str& label )
{
Json::Value args;
args.append( addr );
args.append( label );
std::string ret = m_rpc->Send( "setaccount", args );
}
示例2: EnterPassword
void CRpcHelper::EnterPassword( const std::string& pass )
{
Json::Value args;
args.append( pass );
args.append( 3 );
std::string ret = m_rpc->Send( "walletpassphrase", args );
}
示例3: NewMulSigAddr
CRpcHelper::address_str CRpcHelper::NewMulSigAddr(
const pubkey_str& PubKey1,
const pubkey_str& PubKey2,
const pubkey_str& PubKey3 )
{
Json::Value keys;
keys.append( PubKey1 );
keys.append( PubKey2 );
if( PubKey3.size() )
{
keys.append( PubKey3 );
}
Json::Value args;
args.append( 2 );
args.append( keys );
mini_booklist bakbook = GetMiniBookList();
address_str ret = address_str( m_rpc->Send( "addmultisigaddress", args ) );
label_str old_label = bakbook[ret];
if( old_label.size() )
{
args.append( old_label );
std::string ret = m_rpc->Send( "addmultisigaddress", args );
}
return ret;
}
示例4: GetKLineData
void KLineProdcut::GetKLineData(const string& startTime, Json::Value& data)
{
_rwlock.rdlock();
Json::Value js_datalist;
Json::Value js_datelist;
KlineInfoList::iterator ipos = _klineInfolist.begin();
KlineInfoList::iterator iend = _klineInfolist.end();
for (; ipos != iend; ipos++)
{
Json::Value object;
//开盘价
object.append(ipos->second._open);
//收盘价
object.append(ipos->second._close);
//最高价
object.append(ipos->second._high);
//最低价
object.append(ipos->second._low);
js_datalist.append(object);
js_datelist.append(QuoteUtils::timeToFmt(ipos->first));
}
data["dataList"] = js_datalist;
data["dateList"] = js_datelist;
_rwlock.unlock();
}
示例5: SendAmount
CRpcHelper::txid_str CRpcHelper::SendAmount( const address_str& addr, double fAmount )
{
Json::Value args;
args.append( addr );
args.append( fAmount );
std::string txid = m_rpc->Send( "sendtoaddress", args );
return txid_str( txid );
}
示例6:
/**
* Returns JSON array from input Vector structure
*/
Json::Value SkeletonRepresentationJSON::jsonAddPoint3(Eigen::Vector3f point)
{
Json::Value jsonVector;
jsonVector.append(point.x);
jsonVector.append(point.y);
jsonVector.append(point.z);
return jsonVector;
}
示例7: asJsonTypeValuePair
Json::Value GmResultDigest::asJsonTypeValuePair() const {
// TODO(epoger): The current implementation assumes that the
// result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
Json::Value jsonTypeValuePair;
if (fIsValid) {
jsonTypeValuePair.append(Json::Value(kJsonKey_Hashtype_Bitmap_64bitMD5));
jsonTypeValuePair.append(Json::UInt64(fHashDigest));
} else {
jsonTypeValuePair.append(Json::Value("INVALID"));
}
return jsonTypeValuePair;
}
示例8: onSerialize
Json::Value SpriteRenderer::onSerialize( const std::string& property )
{
if( property == "Texture" )
return Json::Value( Assets::use().findTexture( getTexture() ) );
else if( property == "Size" )
{
sf::Vector2f s = getSize();
Json::Value v;
v.append( Json::Value( s.x ) );
v.append( Json::Value( s.y ) );
return v;
}
else if( property == "Origin" )
{
sf::Vector2f o = getOrigin();
Json::Value v;
v.append( Json::Value( o.x ) );
v.append( Json::Value( o.y ) );
return v;
}
else if( property == "OriginPercent" )
{
sf::Vector2f o = getOriginPercent();
Json::Value v;
v.append( Json::Value( o.x ) );
v.append( Json::Value( o.y ) );
return v;
}
else if( property == "Color" )
{
sf::Color c = getColor();
Json::Value v;
v.append( Json::Value( c.r ) );
v.append( Json::Value( c.g ) );
v.append( Json::Value( c.b ) );
v.append( Json::Value( c.a ) );
return v;
}
else if( property == "RenderStates" )
{
Json::Value v;
v[ "blendMode" ] = Serialized::serializeCustom< sf::BlendMode >( "BlendMode", m_renderStates.blendMode );
v[ "shader" ] = Json::Value( Assets::use().findShader( m_renderStates.shader ) );
return v;
}
else if( property == "Material" )
return m_material.serialize();
else if( property == "MaterialValidation" )
return Json::Value( m_materialValidation );
else
return Component::onSerialize( property );
}
示例9: writeMapInfo
//@debug later online
void MapModel::writeMapInfo(bool backup){
//const char* route = "parallelSpace.parallelSpaceHandler.notifyRefreshPlayer";
//Json::Value root;
//Json::FastWriter writer;
//root["uid"] = PlayerManager::getInstance()->getCurPlayer()->getUID();
//CCPomeloWrapper::getInstance()->notify(route, writer.write(root), nullptr);
ResourceModel *rm = ResourceModel::getModel();
string filename = mapName + ".info";
if (backup)
filename += ".backup";
FILE *fp = rm->OpenFileW(filename);
CCASSERT(fp != nullptr, "write map info fail");
const char* route = "parallelSpace.parallelSpaceHandler.writeMapInfo";
Json::Value msg;
Json::FastWriter writer;
for (auto &building : _buildings){
fprintf(fp, "%d %.0f %.0f %d %s\n", building->getID(), building->getCoord().x, building->getCoord().y, building->getZ(), building->getOwner().c_str());
Json::Value record;
record["GID"] = building->getID();
record["coordX"] = (int)building->getCoord().x;
record["coordY"] = (int)building->getCoord().y;
record["coordZ"] = (int)building->getZ();
record["owner"] = building->getOwner();
record["mapCoord"] = mapName.substr(0, SZ(mapName) - 4);
msg.append(record);
}
if (backup){
for (auto &troop : _troops){
fprintf(fp, "%d %.0f %.0f %d %s\n", troop->getID(), troop->getCoord().x, troop->getCoord().y, troop->getZ(), troop->getOwner().c_str());
Json::Value record;
record["GID"] = troop->getID();
record["coordX"] = (int)troop->getCoord().x;
record["coordY"] = (int)troop->getCoord().y;
record["coordZ"] = (int)troop->getZ();
record["owner"] = troop->getOwner();
record["mapCoord"] = mapName.substr(0, SZ(mapName) - 4);
msg.append(record);
}
}
fclose(fp);
CCPomeloWrapper::getInstance()->request(route, writer.write(msg), nullptr);
}
示例10: toJson
Json::Value Envelope::toJson()
{
Json::Value output;
output["type"] = "Polygon";
Json::Value nw;
nw.append(minVals.latitude);
nw.append(minVals.longitude);
output["coordinates"].append(nw);
Json::Value sw;
sw.append(minVals.latitude);
sw.append(maxVals.longitude);
output["coordinates"].append(sw);
Json::Value se;
se.append(maxVals.latitude);
se.append(maxVals.longitude);
output["coordinates"].append(se);
Json::Value ne;
ne.append(maxVals.latitude);
ne.append(minVals.longitude);
output["coordinates"].append(ne);
output["coordinates"].append(nw);
return output;
}
示例11: toJson
Json::Value Bounds::toJson() const
{
Json::Value json;
json.append(m_min.x);
json.append(m_min.y);
if (is3d()) json.append(m_min.z);
json.append(m_max.x);
json.append(m_max.y);
if (is3d()) json.append(m_max.z);
return json;
}
示例12: putMatch
bool UserDao::putMatch(User user, User userToMatch){
/**Actualizo los matchs del usuario que invoco la peticion**/
Json::Value root;
Json::Value data;
vector<string> idUserMatchs = user.getIdUserMatchs();
idUserMatchs.push_back(userToMatch.getId());
for(string id : idUserMatchs){
data.append(id);
}
user.setIdUserMatchs(idUserMatchs);
root["idUserMatchs"] = data;
DBtuple keyIdUserMatchs(user.getId() + "_idUserMatchs");
keyIdUserMatchs.value = jsonParser.valueToString(root);
bool userMatchOk = this->dataBase->put(keyIdUserMatchs);
//Actualizo los matchs del candidato
Json::Value rootCandidate;
Json::Value dataCandidate;
vector<string> idUserToMatchs = userToMatch.getIdUserMatchs();
idUserToMatchs.push_back(user.getId());
for(string id : idUserToMatchs){
dataCandidate.append(id);
}
rootCandidate["idUserMatchs"] = dataCandidate;
DBtuple keyIdUserToMatchs(userToMatch.getId() + "_idUserMatchs");
keyIdUserToMatchs.value = jsonParser.valueToString(rootCandidate);
bool userToMatchOk = this->dataBase->put(keyIdUserToMatchs);
//Saco el usuario desde el candidato
Json::Value rootUserCandidate;
Json::Value dataUserCandidate;
for(string id : userToMatch.getIdUserCandidatesMatchs()){
id = cleanString(id);
if(user.getId().compare(id.c_str()) != 0){
dataUserCandidate.append(id);
}
}
rootUserCandidate["idUserCandidatesMatchs"] = dataUserCandidate;
DBtuple keyIdUserCandidateMatchs(userToMatch.getId() + "_idUserCandidatesMatchs");
keyIdUserCandidateMatchs.value = jsonParser.valueToString(rootUserCandidate);
bool userToMatchCandidateOk = this->dataBase->put(keyIdUserCandidateMatchs);
if(userMatchOk && userToMatchOk && userToMatchCandidateOk){
return true;
}
return false;
}
示例13: json_string
std::string Socket::json_string()
{
srand(time(NULL));
int size ;
while(1)
{
size = 50;//rand() % 100 ;
if(size > 0)
{
break ;
}
}
Json::Value root ;
Json::Value arr ;
while(size)
{
Json::Value elem ;
char title[128] = "";
char summary[128]="";
sprintf(title , "tile_%d", size);
sprintf(summary, "summary_%d", size);
elem["title"] = title ;
elem["summary"] = summary ;
arr.append(elem);
size -- ;
}
root["files"]=arr ;
Json::FastWriter writer ;
Json::StyledWriter stlwriter ;
return stlwriter.write(root);
}
示例14: ret
Json::Value
STPath::getJson (int) const
{
Json::Value ret (Json::arrayValue);
for (auto it: mPath)
{
Json::Value elem (Json::objectValue);
int iType = it.getNodeType ();
elem[jss::type] = iType;
elem[jss::type_hex] = strHex (iType);
if (iType & STPathElement::typeAccount)
elem[jss::account] = to_string (it.getAccountID ());
if (iType & STPathElement::typeCurrency)
elem[jss::currency] = to_string (it.getCurrency ());
if (iType & STPathElement::typeIssuer)
elem[jss::issuer] = to_string (it.getIssuerID ());
ret.append (elem);
}
return ret;
}
示例15: operator
void ResponseTask::operator()() {
Json::Value response;
if (getDependencyCount() > _resultTaskIndex) {
response = generateResponseJson();
}
size_t status = 200;
if (!_error_messages.empty()) {
Json::Value errors;
for (const auto& msg : _error_messages) {
errors.append(Json::Value(msg));
}
response["error"] = errors;
status = 500;
}
LOG4CXX_DEBUG(_logger, response);
Json::FastWriter fw;
if (_group_commit) {
io::GroupCommitter::getInstance().push(
std::tuple<net::AbstractConnection*, size_t, std::string>(connection, status, fw.write(response)));
} else {
connection->respond(fw.write(response), status);
}
}