MyGUI 3.5.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"
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
void mapSet(Map &map, std::string_view key, const Value &value)
std::map< std::string, std::string, std::less<> > MapString
Definition MyGUI_Types.h:39