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学习笔记(19)--label 、label atlas
  • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
  • Cocos2d-x学习(一):HelloWorld
  • cocos2dx在xcode下开发,编译到android上(2)
  • cocos2d 设置屏幕默认方向
  • Cocos2d-x 2.0 之 Actions “三板斧” 之一
  • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、
  • cocos2d-x学习笔记(18)--游戏打包(windows平台)
  • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
?? - ?? - ÝřŝžľŘÝź - TAGąęÇŠ - RSSśŠÔÄ - ??
Copyright © 2004-2024 上海卓卓网络科技有限公司