cocos2d-x开发: 一切应该从配置文件读取开始(6)
来源:未知 责任编辑:责任编辑 发表时间:2015-03-01 01:33 点击:次
	   
	
	  
	  
	  
p>162         {
p>163             buffer.erase(0, trim.length());
p>164             if(!isAll) { break; }
p>165         }
p>166         while(!buffer.empty() && (buffer.rfind(trim) == (buffer.length() - trim.length())))
p>167         {
p>168             buffer.erase(buffer.length() - trim.length(), trim.length());
p>169             if(!isAll) { break; }
p>170         }
p>171     }
p>172     void INICache::parseLine(const std::string& buffer)
p>173     {
p>174         if(buffer.empty()) { return; }
p>175         switch (buffer[0])
p>176         {
p>177         case '#':
p>178         case '%':
p>179             return;
p>180         case '[':
p>181             {
p>182                 std::string section = this->parseSection(buffer, std::string("["), std::string("]"));
p>183                 this->trimString(section, std::string(" "), true);
p>184                 if(!section.empty()) { this->M_currentSection_ = section; }
p>185             }
p>186             return;
p>187         default:
p>188             {
p>189                 if(buffer.find(std::string("=")) != std::string::npos && !this->M_currentSection_.empty())
p>190                 {
p>191                     std::string key = this->parseSection(buffer, std::string(""), std::string("="));
p>192                     this->trimString(key, std::string(" "), true);
p>193                     std::string value = this->parseSection(buffer, std::string("="), std::string(""));
p>194                     this->trimString(value, std::string(" "), true);
p>195                     if(!key.empty()) { this->propsMap_[this->M_currentSection_][key] = value; }
p>196                 }
p>197             }
p>198             return;
	
	
        
        
        
	
        相关新闻>>
最新推荐更多>>>
              
          - 发表评论
- 
				
- 最新评论 进入详细评论页>>

![cocos2d_x+lua[2]](/uploads/allimg/131030/110J64609-0-lp.jpg)








