35 const std::string
XML_TYPE(
"Resource");
57 if (!mIsInitialise)
return;
66 mMapLoadXmlDelegate.clear();
69 mIsInitialise =
false;
81 VectorGuid vector_guid;
87 std::string id, type, name;
95 if (mResourcesID.find(guid) != mResourcesID.end())
103 MYGUI_LOG(Warning,
"dublicate resource name '" << name <<
"'");
106 vector_guid.push_back(guid);
109 if (
object ==
nullptr)
111 MYGUI_LOG(Error,
"resource type '" << type <<
"' not found");
118 if (!guid.
empty()) mResourcesID[guid] = resource;
119 if (!name.empty())
mResources[name] = resource;
122 if (!vector_guid.empty())
124 mListFileGuid[_file] = vector_guid;
131 for (MapVectorString::iterator item=mListFileGuid.begin(); item!=mListFileGuid.end(); ++item)
133 for (VectorGuid::iterator item2=item->second.begin(); item2!=item->second.end(); ++item2)
152 MYGUI_LOG(Info,
"Load ini file '" << source <<
"'");
159 MapLoadXmlDelegate::iterator iter = mMapLoadXmlDelegate.find(_key);
160 MYGUI_ASSERT(iter == mMapLoadXmlDelegate.end(),
"name delegate is exist");
166 MapLoadXmlDelegate::iterator iter = mMapLoadXmlDelegate.find(_key);
167 if (iter != mMapLoadXmlDelegate.end()) mMapLoadXmlDelegate.erase(iter);
175 MYGUI_LOG(Error, _instance <<
" : '" << _file <<
"', not found");
194 if ( (
nullptr == root) || (root->
getName() !=
"MyGUI") )
196 MYGUI_LOG(Error, _instance <<
" : '" << _file <<
"', tag 'MyGUI' not found");
204 MapLoadXmlDelegate::iterator iter = mMapLoadXmlDelegate.find(type);
205 if (iter != mMapLoadXmlDelegate.end())
207 if ((!_match) || (type == _type)) (*iter).second(root, _file, version);
210 MYGUI_LOG(Error, _instance <<
" : '" << _file <<
"', type '" << _type <<
"' not found");
216 MYGUI_LOG(Error, _instance <<
" : '" << _file <<
"', delegate for type '" << type <<
"'not found");
224 while (node.
next(
"MyGUI"))
229 MapLoadXmlDelegate::iterator iter = mMapLoadXmlDelegate.find(type);
230 if (iter != mMapLoadXmlDelegate.end())
232 (*iter).second(node.
current(), _file, version);
236 MYGUI_LOG(Error, _instance <<
" : '" << _file <<
"', delegate for type '" << type <<
"'not found");
241 MYGUI_LOG(Error, _instance <<
" : '" << _file <<
"', tag 'type' not found");
251 MapResourceID::iterator iter = mResourcesID.find(_id);
252 if (iter == mResourcesID.end())
271 if (_item ==
nullptr)
return;
282 MapResourceID::iterator
id = mResourcesID.find(_item->
getResourceID());
283 if (
id != mResourcesID.end())
284 mResourcesID.erase(
id);