void LayerManager::_load(xml::xmlNodePtr _node, const std::string & _file) { // берем детей и крутимся, основной цикл xml::xmlNodeIterator layer = _node->getNodeIterator(); while (layer.nextNode(XML_TYPE)) { std::string name, tmp; Ogre::ushort start = 0, count = 1, height = 1; if ( false == layer->findAttribute("name", name)) { MYGUI_LOG(Warning, "Attribute 'name' not found {file : " << _file << "}"); continue; } if (layer->findAttribute("height", tmp)) height = utility::parseUShort(tmp); else { MYGUI_LOG(Warning, "Attribute 'Height' not found {file : '" << _file << "' , name : " << name << "}"); } if (layer->findAttribute("count", tmp)) count = utility::parseUShort(tmp); else { MYGUI_LOG(Warning, "Attribute 'Count' not found {file : '" << _file << "' , name : " << name << "}"); } if (layer->findAttribute("start", tmp)) start = utility::parseUShort(tmp); else { MYGUI_LOG(Warning, "Attribute 'Start' not found {file : '" << _file << "' , name : " << name << "}"); } // а вот теперь добавляем слой mMapLayer[name] = new LayerInfo(name, start, count, height); }; }
void Gui::_load(xml::xmlNodePtr _node, const std::string & _file) { // берем детей и крутимс¤, основной цикл xml::xmlNodeIterator node = _node->getNodeIterator(); while (node.nextNode(XML_TYPE)) { std::string source; if (false == node->findAttribute("file", source)) continue; std::string group = node->findAttribute("group"); MYGUI_LOG(Info, "Load ini file '" << source << "' from " << (group.empty() ? "current path" : "resource group : ") << group); _loadImplement(source, group, false, "", INSTANCE_TYPE_NAME); }; }
void LayerManager::_load(xml::xmlNodePtr _node, const std::string & _file) { // берем детей и крутимся, основной цикл xml::xmlNodeIterator layer = _node->getNodeIterator(); while (layer.nextNode(XML_TYPE)) { std::string name; if ( false == layer->findAttribute("name", name)) { MYGUI_LOG(Warning, "Attribute 'name' not found {file : " << _file << "}"); continue; } mLayerKeepers.push_back(new LayerKeeper(name, utility::parseBool(layer->findAttribute("overlapped")), utility::parseBool(layer->findAttribute("peek")) )); }; }
void InputManager::_load(xml::xmlNodePtr _node, const std::string & _file) { xml::xmlNodeIterator lang = _node->getNodeIterator(); while (lang.nextNode(XML_TYPE)) { std::string name; if ( false == lang->findAttribute("name", name)) continue; std::vector<std::string> chars = utility::split(lang->getBody()); if (chars.size() == INPUT_COUNT_LOAD_CHAR) { // сначала проверяем есть ли такой язык уже MapLang::iterator iter = mMapLanguages.find(name); MYGUI_ASSERT(iter == mMapLanguages.end(), "language '" << name << "' already exist"); // создаем язык mMapLanguages[name] = LangInfo(); iter = mMapLanguages.find(name); iter->second.resize(INPUT_COUNT_LOAD_CHAR); LangInfo & lang = iter->second; // и заполняем его for (size_t j=0; j<INPUT_COUNT_LOAD_CHAR; j++) { unsigned int ch = utility::parseUInt(chars[j]); if (INPUT_CHARSET_LIMIT < ch) { lang[j] = 0; MYGUI_LOG(Warning, "character with code '" << ch << "' out of range"); } else lang[j] = (Char)ch; } } else { MYGUI_LOG(Warning, "Quantity of characters is not " << INPUT_COUNT_LOAD_CHAR); } }; // обязательно обновляем итератор, так как не гарантируеться его сохранение mCurrentLanguage = mMapLanguages.find(INPUT_DEFAULT_LANGUAGE); }