MyGUI: MyGUI_WidgetUserData.cpp Source File

MyGUI 3.2.2

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 UserData::UserData()
15 {
16 }
17
18 UserData::~UserData()
19 {
20 }
21
22 void UserData::setUserString(const std::string& _key, const std::string& _value)
23 {
24 mMapUserString[_key] = _value;
25 }
26
28 const std::string& UserData::getUserString(const std::string& _key) const
29 {
30 MapString::const_iterator iter = mMapUserString.find(_key);
31 if (iter != mMapUserString.end())
32 return iter->second;
33 return Constants::getEmptyString();
34 }
35
36 const MapString& UserData::getUserStrings() const
37 {
38 return mMapUserString;
39 }
40
41 bool UserData::clearUserString(const std::string& _key)
42 {
43 MapString::iterator iter = mMapUserString.find(_key);
44 if (iter != mMapUserString.end())
45 {
46 mMapUserString.erase(iter);
47 return true;
48 }
49 return false;
50 }
51
52 bool UserData::isUserString(const std::string& _key) const
53 {
54 return mMapUserString.find(_key) != mMapUserString.end();
55 }
56
57 void UserData::clearUserStrings()
58 {
59 mMapUserString.clear();
60 }
61
62 void UserData::setUserData(Any _data)
63 {
64 mUserData = _data;
65 }
66
67 void UserData::_setInternalData(Any _data)
68 {
69 mInternalData = _data;
70 }
71
72 } // namespace MyGUI
MyGUI_WidgetUserData.h
MyGUI_Constants.h
MyGUI::UserData::~UserData
virtual ~UserData()
Definition: MyGUI_WidgetUserData.cpp:18
MyGUI::UserData::setUserString
void setUserString(const std::string &_key, const std::string &_value)
Definition: MyGUI_WidgetUserData.cpp:22
MyGUI::Any
Definition: MyGUI_Any.h:63
MyGUI::UserData::getUserString
const std::string & getUserString(const std::string &_key) const
Definition: MyGUI_WidgetUserData.cpp:28
MyGUI_Precompiled.h
MyGUI::Constants::getEmptyString
static const std::string & getEmptyString()
Definition: MyGUI_Constants.h:24
MyGUI::UserData::clearUserStrings
void clearUserStrings()
Definition: MyGUI_WidgetUserData.cpp:57
MyGUI::UserData::clearUserString
bool clearUserString(const std::string &_key)
Definition: MyGUI_WidgetUserData.cpp:41
MyGUI::UserData::_setInternalData
void _setInternalData(Any _data)
Definition: MyGUI_WidgetUserData.cpp:67
MyGUI::UserData::isUserString
bool isUserString(const std::string &_key) const
Definition: MyGUI_WidgetUserData.cpp:52
MyGUI::UserData::UserData
UserData()
Definition: MyGUI_WidgetUserData.cpp:14
MyGUI::UserData::getUserStrings
const MapString & getUserStrings() const
Definition: MyGUI_WidgetUserData.cpp:36
MyGUI::MapString
std::map< std::string, std::string > MapString
Definition: MyGUI_Types.h:38
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::UserData::setUserData
void setUserData(Any _data)
Definition: MyGUI_WidgetUserData.cpp:62