MyGUI  3.2.0
MyGUI_WidgetUserData.cpp
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #include "MyGUI_Precompiled.h"
23 #include "MyGUI_WidgetUserData.h"
24 #include "MyGUI_Constants.h"
25 
26 namespace MyGUI
27 {
28 
30  {
31  }
32 
34  {
35  }
36 
37  void UserData::setUserString(const std::string& _key, const std::string& _value)
38  {
39  mMapUserString[_key] = _value;
40  }
41 
43  const std::string& UserData::getUserString(const std::string& _key) const
44  {
45  MapString::const_iterator iter = mMapUserString.find(_key);
46  if (iter != mMapUserString.end())
47  return iter->second;
49  }
50 
52  {
53  return mMapUserString;
54  }
55 
56  bool UserData::clearUserString(const std::string& _key)
57  {
58  MapString::iterator iter = mMapUserString.find(_key);
59  if (iter != mMapUserString.end())
60  {
61  mMapUserString.erase(iter);
62  return true;
63  }
64  return false;
65  }
66 
67  bool UserData::isUserString(const std::string& _key) const
68  {
69  return mMapUserString.find(_key) != mMapUserString.end();
70  }
71 
73  {
74  mMapUserString.clear();
75  }
76 
78  {
79  mUserData = _data;
80  }
81 
83  {
84  mInternalData = _data;
85  }
86 
87 } // namespace MyGUI