MyGUI  3.4.1
MyGUI_WidgetUserData.cpp
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #include "MyGUI_Precompiled.h"
8 #include "MyGUI_WidgetUserData.h"
9 #include "MyGUI_Constants.h"
10 
11 namespace MyGUI
12 {
13 
14  void UserData::setUserString(const std::string& _key, const std::string& _value)
15  {
16  mMapUserString[_key] = _value;
17  }
18 
20  const std::string& UserData::getUserString(const std::string& _key) const
21  {
22  MapString::const_iterator iter = mMapUserString.find(_key);
23  if (iter != mMapUserString.end())
24  return iter->second;
26  }
27 
29  {
30  return mMapUserString;
31  }
32 
33  bool UserData::clearUserString(const std::string& _key)
34  {
35  MapString::iterator iter = mMapUserString.find(_key);
36  if (iter != mMapUserString.end())
37  {
38  mMapUserString.erase(iter);
39  return true;
40  }
41  return false;
42  }
43 
44  bool UserData::isUserString(const std::string& _key) const
45  {
46  return mMapUserString.find(_key) != mMapUserString.end();
47  }
48 
50  {
51  mMapUserString.clear();
52  }
53 
55  {
56  mUserData = _data;
57  }
58 
60  {
61  mInternalData = _data;
62  }
63 
64 } // namespace MyGUI
static const std::string & getEmptyString()
bool isUserString(const std::string &_key) const
void _setInternalData(Any _data)
void setUserData(Any _data)
const std::string & getUserString(const std::string &_key) const
void setUserString(const std::string &_key, const std::string &_value)
bool clearUserString(const std::string &_key)
const MapString & getUserStrings() const
std::map< std::string, std::string > MapString
Definition: MyGUI_Types.h:39