MyGUI_WidgetUserData.cpp
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#include "MyGUI_Precompiled.h"
#include "MyGUI_WidgetUserData.h"
#include "MyGUI_Constants.h"
namespace MyGUI
{
void UserData::setUserString(std::string_view _key, std::string_view _value)
{
mapSet(mMapUserString, _key, _value);
}
std::string_view UserData::getUserString(std::string_view _key) const
{
MapString::const_iterator iter = mMapUserString.find(_key);
if (iter != mMapUserString.end())
return iter->second;
return {};
}
const MapString& UserData::getUserStrings() const
{
return mMapUserString;
}
bool UserData::clearUserString(std::string_view _key)
{
MapString::iterator iter = mMapUserString.find(_key);
if (iter != mMapUserString.end())
{
mMapUserString.erase(iter);
return true;
}
return false;
}
bool UserData::isUserString(std::string_view _key) const
{
return mMapUserString.find(_key) != mMapUserString.end();
}
void UserData::clearUserStrings()
{
mMapUserString.clear();
}
void UserData::setUserData(Any _data)
{
mUserData = std::move(_data);
}
void UserData::_setInternalData(Any _data)
{
mInternalData = std::move(_data);
}
} // 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