MyGUI: MyGUI_WidgetUserData.cpp Source File

MyGUI 3.4.3

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
11namespace MyGUI
12{
13
14 void UserData::setUserString(std::string_view _key, std::string_view _value)
15 {
16 mapSet(mMapUserString, _key, _value);
17 }
18
20 std::string_view UserData::getUserString(std::string_view _key) const
21 {
22 MapString::const_iterator iter = mMapUserString.find(_key);
23 if (iter != mMapUserString.end())
24 return iter->second;
25 return {};
26 }
27
28 const MapString& UserData::getUserStrings() const
29 {
30 return mMapUserString;
31 }
32
33 bool UserData::clearUserString(std::string_view _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(std::string_view _key) const
45 {
46 return mMapUserString.find(_key) != mMapUserString.end();
47 }
48
49 void UserData::clearUserStrings()
50 {
51 mMapUserString.clear();
52 }
53
54 void UserData::setUserData(Any _data)
55 {
56 mUserData = std::move(_data);
57 }
58
59 void UserData::_setInternalData(Any _data)
60 {
61 mInternalData = std::move(_data);
62 }
63
64} // namespace MyGUI
MyGUI_Constants.h
MyGUI_Precompiled.h
MyGUI_WidgetUserData.h
MyGUI::Any
Definition MyGUI_Any.h:56
MyGUI::UserData::clearUserString
bool clearUserString(std::string_view _key)
Definition MyGUI_WidgetUserData.cpp:33
MyGUI::UserData::isUserString
bool isUserString(std::string_view _key) const
Definition MyGUI_WidgetUserData.cpp:44
MyGUI::UserData::setUserString
void setUserString(std::string_view _key, std::string_view _value)
Definition MyGUI_WidgetUserData.cpp:14
MyGUI::UserData::getUserString
std::string_view getUserString(std::string_view _key) const
Definition MyGUI_WidgetUserData.cpp:20
MyGUI::UserData::_setInternalData
void _setInternalData(Any _data)
Definition MyGUI_WidgetUserData.cpp:59
MyGUI::UserData::setUserData
void setUserData(Any _data)
Definition MyGUI_WidgetUserData.cpp:54
MyGUI::UserData::clearUserStrings
void clearUserStrings()
Definition MyGUI_WidgetUserData.cpp:49
MyGUI::UserData::getUserStrings
const MapString & getUserStrings() const
Definition MyGUI_WidgetUserData.cpp:28
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::mapSet
void mapSet(Map &map, std::string_view key, const Value &value)
Definition MyGUI_Macros.h:36
MyGUI::MapString
std::map< std::string, std::string, std::less<> > MapString
Definition MyGUI_Types.h:40