• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ json::ValueIterator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: parseCamera

void JsonParser::parseCamera(Json::Value &root){
    LOG_DEBUG("Parsing Camera.");
    bool foundCamera = false;    
        // Options
    for( Json::ValueIterator itr = root.begin() ; itr != root.end() ; itr++ ) {
        std::string key = itr.key().asString();
        if (key == "renderCam") {
            foundCamera = true;
            
                // read all standard data
            double r_fieldOfView = getDoubleAttr("fov", *itr);
            Transform r_transform = getTransformAttr("transforms", *itr);

                // TODO: check for any ones we've skipped and warn the user
            
                // TODO: handle errors gracefully
            
                // apply read data
            (*renderEnv->globals)[FieldOfView] = r_fieldOfView;
            cameraTransform = new Transform(r_transform);

            LOG_DEBUG("Done parsing Camera.\n");
            break;
        }
    }
    if (!foundCamera) {
        LOG_WARNING("No render camera found in file " << filename << ".");
    }
}
开发者ID:espennordahl,项目名称:Aurora,代码行数:29,代码来源:jsonParser.cpp


示例2: DumpJsonTree

void JsonArchive::DumpJsonTree(Json::Value* root, int depth)
{
	if (root == NULL)
	{
		root = &m_Root;
	}

	depth += 1;
	printf( " {type=[%d], size=%d}", root->type(), root->size() );

	if( root->size() > 0 )
	{
		printf("\n");
		for( Json::ValueIterator itr = root->begin() ; itr != root->end() ; itr++ )
		{
			// Print depth.
			for( int tab = 0 ; tab < depth; tab++)
			{
			   printf("-");
			}
			printf(" subvalue(%s) -", itr.memberName());
			DumpJsonTree( &(*itr), depth);
		}
	}
	else
	{
		printf(" ");
		PrintJsonValue(root);
		printf( "\n" );
	}
}
开发者ID:klhurley,项目名称:EffectsManager,代码行数:31,代码来源:JsonArchive.cpp


示例3: parseMaterials

void JsonParser::parseMaterials(Json::Value &root){
    LOG_DEBUG("Parsing Materials.");
    bool foundMaterials = false;
    for( Json::ValueIterator itr = root.begin() ; itr != root.end() ; itr++ ) {
        std::string key = itr.key().asString();
        if (key == "materials") {
            foundMaterials = true;
            
                // loop through materials
            Json::Value objRoot = *itr;
            for( Json::ValueIterator objItr = objRoot.begin() ; objItr != objRoot.end() ; objItr++ ) {
                std::string matName = objItr.key().asString();
                LOG_DEBUG("Found material: " << matName);
                
                    // we first check if we're dealing with a light or mesh
                std::string matType = getStringAttr("type", *objItr);
                Material * mat = getMaterial(matType, matName, *objItr, renderEnv); 
            
                    // add to shading engine
                renderEnv->shadingEngine->registerMaterial(matName, mat);
            }       
            LOG_DEBUG("Done parsing materials.\n");
            break;
        }
    }
    if (!foundMaterials) {
        LOG_WARNING("No materials found in file " << filename << ".");
    }
}
开发者ID:espennordahl,项目名称:Aurora,代码行数:29,代码来源:jsonParser.cpp


示例4: getLangs

Translator::Langs Translator::getLangs() const
{
	_curlBuffer = "";
	Translator::Langs langs;
	std::string mylang = getMyLang();
	if(mylang.empty())
		mylang = "en";	// default

	std::string url = "https://translate.yandex.net/api/v1.5/tr.json/getLangs?key=";
	url += getApiKey();
	url += "&ui=";
	url += mylang;

	curl_easy_setopt(curl, CURLOPT_URL, url.c_str());;
	CURLcode res = curl_easy_perform(curl);
	if(res != CURLE_OK)
	{
		// error
	}


	Json::Reader reader;
	Json::Value root;
	reader.parse(_curlBuffer, root);

	for(Json::ValueIterator it = root["langs"].begin(); it != root["langs"].end(); it++)
	{
		langs.push_back(std::make_pair(	
										it.key().asString(),  	// key
										(*it).asString()		// value
									));
	}

	return langs;
}
开发者ID:qeed,项目名称:Translator,代码行数:35,代码来源:Translator.cpp


示例5: JsonParseOrder

void Com::JsonParseOrder(Order_t* order){
    Json::Value root;   // will contains the root value after parsing.
    Json::Reader reader;
   
    bool parsingSuccessful = reader.parse( buffer, root );
    
    if ( !parsingSuccessful )
    {
        std::cout  << "Failed to parse configuration\n"
        << reader.getFormattedErrorMessages();
        return;
    }

    order->orderId = root["order_id"].asInt();

   for( Json::ValueIterator itr = root["recipe"].begin() ; itr != root["recipe"].end() ; itr++ ) {
#ifdef DEBUG
        std::cout << itr.key().asString() << " " << *itr;
#endif
        order->ingredients.push_back(makeIngredientItem(itr.key().asString(), (*itr).asInt()));
   }
#ifdef DEBUG
    printf("parsing passed\n");
#endif
}
开发者ID:SmartCocktailFactory,项目名称:factorymaster,代码行数:25,代码来源:com.cpp


示例6: input

/**
 * Read a map of {list_name : class_list} from json
 */
std::unordered_map<std::string, std::vector<std::string> > ConfigFiles::load_class_lists() {
  std::unordered_map<std::string, std::vector<std::string> > lists;
  std::string class_lists_filename;
  this->m_json.get("class_lists", "", class_lists_filename);

  if (class_lists_filename.empty()) {
    return lists;
  }

  std::ifstream input(class_lists_filename);
  Json::Reader reader;
  Json::Value root;
  bool parsing_succeeded = reader.parse(input, root);
  always_assert_log(parsing_succeeded, "Failed to parse class list json from file: %s\n%s",
                    class_lists_filename.c_str(),
                    reader.getFormattedErrorMessages().c_str());

  for (Json::ValueIterator it = root.begin(); it != root.end(); ++it) {
    std::vector<std::string> class_list;
    Json::Value current_list = *it;
    for (Json::ValueIterator list_it = current_list.begin(); list_it != current_list.end(); ++list_it) {
      lists[it.key().asString()].push_back((*list_it).asString());
    }
  }

  lists["secondary_dex_head.list"] = get_coldstart_classes();

  return lists;
}
开发者ID:JoelMarcey,项目名称:redex,代码行数:32,代码来源:ConfigFiles.cpp


示例7: fileContent

std::map<std::string, std::string>
jsonValueToAccount(Json::Value& value, const std::string& accountId) {
    auto idPath_ = fileutils::get_data_dir() + DIR_SEPARATOR_STR + accountId;
    fileutils::check_dir(idPath_.c_str(), 0700);
    auto detailsMap = DRing::getAccountTemplate(value[DRing::Account::ConfProperties::TYPE].asString());

    for( Json::ValueIterator itr = value.begin() ; itr != value.end() ; itr++ ) {
        if (itr->asString().empty())
            continue;
        if (itr.key().asString().compare(DRing::Account::ConfProperties::TLS::CA_LIST_FILE) == 0) {
            std::string fileContent(itr->asString());
            fileutils::saveFile(idPath_ + DIR_SEPARATOR_STR "ca.key", {fileContent.begin(), fileContent.end()}, 0600);

        } else if (itr.key().asString().compare(DRing::Account::ConfProperties::TLS::PRIVATE_KEY_FILE) == 0) {
            std::string fileContent(itr->asString());
            fileutils::saveFile(idPath_ + DIR_SEPARATOR_STR "dht.key", {fileContent.begin(), fileContent.end()}, 0600);

        } else if (itr.key().asString().compare(DRing::Account::ConfProperties::TLS::CERTIFICATE_FILE) == 0) {
            std::string fileContent(itr->asString());
            fileutils::saveFile(idPath_ + DIR_SEPARATOR_STR "dht.crt", {fileContent.begin(), fileContent.end()}, 0600);
        } else
            detailsMap[itr.key().asString()] = itr->asString();
    }

    return detailsMap;
}
开发者ID:savoirfairelinux,项目名称:ring-daemon,代码行数:26,代码来源:archiver.cpp


示例8:

Objects::Object::Object(Json::Value data) :
 self_data( data ), self_x(0), self_y(0), self_w(0), self_h(0)
{
  Json::Value dimensions = data["dimensions"];
  if ( dimensions.isObject() )
  {
    // Coordinates are stored as doubles, but interpretted as either
    // pixel coordinates or fractional. If ANY dimension is a double, then
    // they all should be (why would you use a double coordinate otherwise?)

    self_coordType = Objects::NON_NORM;

    for ( Json::ValueIterator itr  = dimensions.begin();
                              itr != dimensions.end();
                              itr ++ )
    {
      string key = itr.key().asString();

      if (dimensions[ key ] . isDouble() )
      {
        self_coordType = Objects::NORM;
        break;
      }
    }

    self_x = dimensions["x"].asDouble();
    self_y = dimensions["y"].asDouble();

  }
}
开发者ID:VolatileStorm,项目名称:CernVM-Graphics,代码行数:30,代码来源:objects.cpp


示例9: deserializeEquippedItems

void ItemEquipper::deserializeEquippedItems(Json::Value& root) {
	Item* item;
	
    for (Json::ValueIterator it = root.begin(); it != root.end(); it++) {
		item = new Item();
		item->deserialize(*it);
        _equippedItems[it.key().asInt()] = item;
    }
}
开发者ID:johanekholm,项目名称:hex-game,代码行数:9,代码来源:Item.cpp


示例10: readFromFile

bool CannyReader::readFromFile()
{
	Timer aTimer;
	std::ifstream cannyFile(srcFile);
	cannyFile.precision(20);
	if (cannyFile.is_open()) {
		std::stringstream buffer;
		buffer << cannyFile.rdbuf();

		std::string contents(buffer.str());
		cout << "Time to Read: " << aTimer.elapsed() << endl;
		aTimer.restart();

		Json::Value root;
		Json::Reader reader;
		bool parsingSuccessful = reader.parse( contents, root );
		cout << "Time to parse: " << aTimer.elapsed() << endl;
		aTimer.restart();
		if (parsingSuccessful)
		{
			for( Json::ValueIterator outer = root.begin() ; outer != root.end() ; outer++ ) {
				int camNum = outer.key().asInt();

				Json::Value oneCam = root[camNum];

				for( Json::ValueIterator itr = oneCam.begin() ; itr != oneCam.end() ; itr++ ) {
					vector<Line_Segment *>* lineSegments = new vector<Line_Segment *>();

					int key = atoi(itr.key().asCString());

					Json::Value jsonSegments = oneCam[itr.key().asCString()];
					for( Json::ValueIterator itr2 = jsonSegments.begin() ; itr2 != jsonSegments.end() ; itr2++ ) {
						Json::Value jsonSeg = jsonSegments[itr2.key().asInt()];
						Line_Segment* seg = (Line_Segment *) malloc(sizeof(Line_Segment));
						seg->row1 = jsonSeg["r1"].asInt();
						seg->col1 = jsonSeg["c1"].asInt();
						seg->row2 = jsonSeg["r2"].asInt();
						seg->col2 = jsonSeg["c2"].asInt();

						lineSegments->push_back(seg);
					}
					precomputedCannySegments[camNum][key] = lineSegments;
				}
			}
			cannyFile.close();
			cout << "Time to reconstruct: " << aTimer.elapsed() << endl;

			return true;
		}
		else {
			return false;
		}
	}
	return false;
}
开发者ID:alexlee-gk,项目名称:surgical,代码行数:55,代码来源:CannyReader.cpp


示例11: Dropped

std::list<std::string> CJSONHandler::ParseAvailLanguagesTX(std::string strJSON, bool bIsXBMCCore, std::string strURL)
{
  Json::Value root;   // will contains the root value after parsing.
  Json::Reader reader;
  std::string lang;
  std::list<std::string> listLangs;

  bool parsingSuccessful = reader.parse(strJSON, root );
  if ( !parsingSuccessful )
  {
    CLog::Log(logERROR, "CJSONHandler::ParseAvailLanguagesTX: no valid JSON data");
    return listLangs;
  }

  const Json::Value langs = root;
  std::string strLangsToFetch;
  std::string strLangsToDrop;
  std::string strLangsBlacklisted;

  for(Json::ValueIterator itr = langs.begin() ; itr != langs.end() ; itr++)
  {
    lang = itr.key().asString();
    if (lang == "unknown")
      CLog::Log(logERROR, "JSONHandler: ParseLangs: no language code in json data. json string:\n %s", strJSON.c_str());

    Json::Value valu = *itr;
    std::string strCompletedPerc = valu.get("completed", "unknown").asString();
    std::string strModTime = valu.get("last_update", "unknown").asString();

    bool bLangBlacklisted = g_LCodeHandler.CheckIfLangCodeBlacklisted(lang);

    // we only add language codes to the list which has a minimum ready percentage defined in the xml file
    // we make an exception with all English derived languages, as they can have only a few srings changed
    if (lang.find("en_") != std::string::npos || strtol(&strCompletedPerc[0], NULL, 10) > g_Settings.GetMinCompletion()-1 || !bIsXBMCCore)
    {
      if (!bLangBlacklisted)
      {
        strLangsToFetch += lang + ": " + strCompletedPerc + ", ";
        listLangs.push_back(lang);
        g_Fileversion.SetVersionForURL(strURL + "translation/" + lang + "/?file", strModTime);
      }
      else
      {
	strLangsBlacklisted += lang + ": " + strCompletedPerc + ", ";
      }
    }
    else
      strLangsToDrop += lang + ": " + strCompletedPerc + ", ";
  };
  CLog::Log(logINFO, "JSONHandler: ParseAvailLangs: Languages to be Fetcehed: %s", strLangsToFetch.c_str());
  CLog::Log(logINFO, "JSONHandler: ParseAvailLangs: Languages to be Dropped (not enough completion): %s", strLangsToDrop.c_str());
  CLog::Log(logINFO, "JSONHandler: ParseAvailLangs: Languages to be Dropped due they are blacklisted: %s",strLangsBlacklisted.c_str());
  return listLangs;
};
开发者ID:alanwww1,项目名称:xbmc-txupdate,代码行数:54,代码来源:JSONHandler.cpp


示例12: getChatId

string HandlerChat::getChatId(string remitente,string destinatario){
	/**Busca el chat id de la conversacion sino existe lo crea.**/
	Json::Value chatsId=getChatsIdValueFromDestinatario(destinatario);
	string id="";
	for( Json::ValueIterator itr = chatsId.begin() ; itr != chatsId.end() ; itr++ ){
		if((*itr).asString()==remitente){
			id=itr.key().asString();
		}
	}
	return id;
}
开发者ID:AndresOtero,项目名称:TallerII-Tinder,代码行数:11,代码来源:HandlerChat.cpp


示例13: updateRegistry

bool updateRegistry(Json::Value &jsonRoot, Json::Value &outputRoot)
{
	bool success = true;
	for (Json::ValueIterator iter = jsonRoot.begin(); iter != jsonRoot.end(); iter++) {
		Json::Value solutionsRoot = jsonRoot.get(iter.memberName(), Json::Value());
		Json::Value solutionsOutput;
		for(Json::ValueIterator itr = solutionsRoot["settings"].begin() ; itr != solutionsRoot["settings"].end() ; itr++ )
		{
			bool missingValue = false;
			Json::Value currentOption;
			const char * path = solutionsRoot["options"]["path"].asCString();
			const char * valueName = itr.memberName();
			long valueToSet = solutionsRoot["settings"][valueName].asUInt();
			
		    wstring updatedPath = toWideChar(path);
			wstring updatedValueName = toWideChar(valueName);
			long value = -1;
			try
			{
				value = getDwordValue(hKeyFromString(solutionsRoot["options"]["hKey"].asCString()), updatedPath.c_str(), updatedValueName.c_str());
			} catch (int exCode)
			{
				currentOption["statusCode"] = exCode;
				currentOption["oldValue"] = Json::Value();
				currentOption["newValue"] = Json::Value();
				success = false;
				missingValue = true;
			}

			bool valueSet = setDwordValue(hKeyFromString(solutionsRoot["options"]["hKey"].asCString()), updatedPath.c_str(), updatedValueName.c_str(), valueToSet);
			if (missingValue)
			{
				currentOption["oldValue"] = Json::Value();
			} else {
				currentOption["oldValue"] = value;
			}
			try
			{
				currentOption["newValue"] = getDwordValue(hKeyFromString(solutionsRoot["options"]["hKey"].asCString()), updatedPath.c_str(), updatedValueName.c_str());
			} catch (int exceptionCode) {
				// TODO Handle gracefully.
			}
			if (!valueSet)
			{
				success = false;
				currentOption["newValue"] = value;
			}
		
			solutionsOutput[valueName] = currentOption;
		}
		outputRoot[iter.memberName()]["results"] = solutionsOutput;
	}
	return success;
}
开发者ID:bsheytanov,项目名称:windows,代码行数:54,代码来源:RegistrySettingsHandler.cpp


示例14: record

void ofApp::record(){
    ofFile newfile(ofToDataPath("coordinates.json"), ofFile::WriteOnly);
    string time = ofToString(ofGetElapsedTimef());
    for(Json::ValueIterator i = untimedData.begin() ; i != untimedData.end(); i++) {
        string id = i.key().asString();
        data[id][time]["position"] = untimedData[id]["position"];
        data[ofToString(id)][time]["rotation"] = untimedData[id]["rotation"];
        cout << data;
    }
    if (data != ofxJSONElement::null)
        newfile << data;
    sound.play();
}
开发者ID:ralphlizard,项目名称:drone-tracker-2,代码行数:13,代码来源:ofApp.cpp


示例15: jsonToVariantList

qpid::types::Variant::Map agocontrol::jsonToVariantMap(Json::Value value) {
	Variant::Map map;
	try {
		for (Json::ValueIterator it = value.begin(); it != value.end(); it++) {
			// printf("%s\n",it.key().asString().c_str());
			// printf("%s\n", (*it).asString().c_str());
			if ((*it).size() > 0) {
				// cout << "JSON Type: " << (*it).type() << endl;
				// cout << "Key: " << it.key().asString() << endl;
				if ((*it).type() == 6) {
					map[it.key().asString()] = jsonToVariantList((*it));
				} else if ((*it).type() == 7) {
					map[it.key().asString()] = jsonToVariantMap((*it));
				}
			} else {
				if ((*it).isString()) map[it.key().asString()] = (*it).asString();
				if ((*it).isBool()) map[it.key().asString()] = (*it).asBool();
				if ((*it).isInt()) map[it.key().asString()] = (*it).asInt();
				if ((*it).isUInt()) map[it.key().asString()] = (*it).asUInt();
				if ((*it).isDouble()) map[it.key().asString()] = (*it).asDouble();
			}
		}	
	} catch (const std::exception& error) {
		cout << "ERROR! Exception during JSON->Variant::Map conversion!" << endl;
		stringstream errorstring;
		errorstring << error.what();
		cout << "EXCEPTION: " << errorstring.str() << endl;
	}
	return map;
}
开发者ID:JoakimLindbom,项目名称:agocontrol,代码行数:30,代码来源:agoclient.cpp


示例16: if

void Objects::StringDisplay::update()
{
  // Make sure repeated calls to this function don't simply add strings
  self_displayStrings.clear();

  Json::Value strings;
  strings = self_data["strings"];

  if (self_data["external"].isBool())
    if (self_data["external"] == true)
    {
      string resource = self_data["resource"].asString();
      string node     = self_data["node"].asString();
      strings = Resources::getResourceNode(resource, node);
    }
  

  //Create array of human readable strings. New entry every "self_maxLines"
  //lines
  stringstream outputStream;
  int lineN = 0;
  for (Json::ValueIterator itr = strings.begin(); 
       itr != strings.end(); 
       itr++)
  {
    //Stored as "key" : "value", so extract these
    string key = itr.key().asString();
    Json::Value value = strings[key];
 
    //buffer key and do appropriate thing for value
    outputStream << key << self_delimiter;
    if (value.type() == Json::stringValue)
      outputStream << value.asString();
    else if (value.isNumeric())
      outputStream << value.asDouble();
    outputStream << "\n";

    lineN++;
    if ( lineN == self_maxLines )
    {
      self_displayStrings.push_back(outputStream.str());
      lineN = 0;
      outputStream.str("");
    }

  }
  //Add remaining string
  self_displayStrings.push_back( outputStream.str() );
}
开发者ID:VolatileStorm,项目名称:CernVM-Graphics,代码行数:49,代码来源:objects.cpp


示例17: decode_from_json_object

void SiteLanguagePackage::decode_from_json_object(const Json::Value &root)
{
    Json::Value tmp;
    
    if ( root.isObject() && root.isMember("LanguageMap") ) {
        const Json::Value map_LanguageMap = root["LanguageMap"];
        if ( !map_LanguageMap.isNull() ) {
            for( Json::ValueIterator it = map_LanguageMap.begin(); it != map_LanguageMap.end(); ++it ) {
            
                std::string key = it.key().asString();
                LanguageMap[key] = map_LanguageMap[key].asString();
            }
        }
    }   
}
开发者ID:YouLooksLikeNotDelicious,项目名称:websrv,代码行数:15,代码来源:SiteLanguage.cpp


示例18: readChat

string HandlerChat::readChat(string chatString,string user,string messageId,string conversationId){
	/**Leo la CANT_MENSAJES desde mensajeId del chat desde la vista del usuario.Actualiza los estados con los
	 * ultimos mensajes leidos en la conversacion.**/
	Json::Value chat=jsonParse.stringToValue(chatString);
	Json::Value lastsMessages;
	Json::Value lastsMessagesMsg= Json::Value(Json::arrayValue);
	LOG(DEBUG)<<chatString;
	int lastMessageRead;
	int lastMessageId=chat["message_id"].asInt();
	if(chat["User1"].asString()==user){
		lastMessageRead=chat["LastMessage2"].asInt();
		chat["LastMessage1"]=0;
	}else{
		lastMessageRead=chat["LastMessage1"].asInt();
		chat["LastMessage2"]=0;
	}
	Json::Value messages=chat["Messages"];
	int messageIdSearch=atoi(messageId.c_str());
	for( Json::ValueIterator itr = messages.begin() ; itr != messages.end() ; itr++ ){
		LOG(INFO)<<"id "<<itr.key().asString();
		int currentMessageId=atoi(itr.key().asString().c_str());
		int min=messageIdSearch-CANT_MESSAGES;
		if((currentMessageId<=messageIdSearch)&&(currentMessageId>=(min))){
			Json::Value Message=*itr;
			if(currentMessageId>=(lastMessageId-lastMessageRead)){
				Message["status"]="D";
			}else{
				Message["status"]="R";
			}
			Message["message_id"]=itr.key().asString();
			lastsMessagesMsg.append(Message);
		}
	}
	lastsMessages["messages"]=lastsMessagesMsg;
	int bottomMessageId=messageIdSearch-CANT_MESSAGES;
	if(bottomMessageId<0){
		bottomMessageId=0;
	}
	lastsMessages["LastMessageId"]=bottomMessageId;
	string lastsMessagesString=this->jsonParse.valueToString(lastsMessages);
	chatString=this->jsonParse.valueToString(chat);
	LOG(DEBUG)<<chatString;
	DBtuple putChat("chat_"+conversationId,chatString);
	DB->put(putChat);
	return lastsMessagesString;
}
开发者ID:AndresOtero,项目名称:TallerII-Tinder,代码行数:46,代码来源:HandlerChat.cpp


示例19: parseOptions

void JsonParser::parseOptions(Json::Value &root){
    LOG_DEBUG("Parsing Options.");
    bool foundOptions = false;
        // Options
    for( Json::ValueIterator itr = root.begin() ; itr != root.end() ; itr++ ) {
        std::string key = itr.key().asString();
        if (key == "options") {
            foundOptions = true;
            
                // read all standard data
            int r_pixelSamples =   getIntAttr("pixelsamples", *itr);
            int r_lightSamples =   getIntAttr("lightsamples", *itr);
            int r_mindepth =       getIntAttr("mindepth", *itr);
            int r_maxdepth =       getIntAttr("maxdepth", *itr);
            int r_resolution[2];   getIntArrayAttr("resolution", *itr, 2, r_resolution);
            std::string r_fileName = getStringAttr("filename", *itr);
            r_fileName = stringTemplate(r_fileName);
                // TODO: check for any ones we've skipped and warn the user
            
                // TODO: handle errors gracefully
            
                // apply to globals
            LOG_DEBUG("Setting pixel samples to: " << r_pixelSamples);
            (*renderEnv->globals)[PixelSamples] = (double)r_pixelSamples;
            LOG_DEBUG("Setting light samples to: " << r_lightSamples);
            (*renderEnv->globals)[LightSamples] = (double)r_lightSamples;
            LOG_DEBUG("Setting min trace depth to: " << r_mindepth);
            (*renderEnv->globals)[MinDepth] = (double)r_mindepth;
            LOG_DEBUG("Setting max trace depth to: " << r_maxdepth);
            (*renderEnv->globals)[MaxDepth] = (double)r_maxdepth;
            LOG_DEBUG("Setting resolution to: " << r_resolution[0] << " * " << r_resolution[1]);
            (*renderEnv->globals)[ResolutionX] = r_resolution[0];
            (*renderEnv->globals)[ResolutionY] = r_resolution[1];
            LOG_DEBUG("Setting file output to: " << r_fileName);
            (*renderEnv->stringGlobals)["fileName"] = r_fileName;
            
            // We're done, so we exit out of root iterator loop
            LOG_DEBUG("Done parsing Options.\n");
            break;
        }
    }
    if (!foundOptions) {
        LOG_WARNING("No options found in file " << filename << ".");
    }
}
开发者ID:espennordahl,项目名称:Aurora,代码行数:45,代码来源:jsonParser.cpp


示例20: decode_from_json_object

void BuyCountData::decode_from_json_object(const Json::Value &root)
{
    Json::Value tmp;

    

    
    if ( root.isObject() && root.isMember("buyCountMap") ) {
        const Json::Value map_buyCountMap = root["buyCountMap"];
        if ( !map_buyCountMap.isNull() ) {
            for( Json::ValueIterator it = map_buyCountMap.begin(); it != map_buyCountMap.end(); ++it ) {
            
                std::string key = it.key().asString();
                buyCountMap[key] = map_buyCountMap[key].asString();
            }
        }
    }   
}
开发者ID:YouLooksLikeNotDelicious,项目名称:websrv,代码行数:18,代码来源:Request.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ json::value类代码示例发布时间:2022-05-31
下一篇:
C++ json::Value类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap