MyGUI: MyGUI_Any.cpp Source File

MyGUI 3.4.3

MyGUI_Any.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_Any.h"
9
10namespace MyGUI
11{
12
13 const Any Any::Null{};
14
15 Any::Any() = default;
16
17 Any::Any(const Any& other) :
18 mContent(other.mContent ? other.mContent->clone() : nullptr)
19 {
20 }
21
22 Any::Any(Any&& other) noexcept = default;
23
24 Any::~Any() = default;
25
26 Any& Any::operator=(const Any& rhs)
27 {
28 mContent = rhs.mContent ? rhs.mContent->clone() : nullptr;
29 return *this;
30 }
31
32 Any& Any::operator=(Any&& rhs) noexcept = default;
33
34 bool Any::empty() const
35 {
36 return !mContent;
37 }
38
39 const std::type_info& Any::getType() const
40 {
41 return mContent ? mContent->getType() : typeid(void);
42 }
43
44 bool Any::compare(const Any& other) const
45 {
46 if (mContent == nullptr && other.mContent == nullptr)
47 return true;
48 return mContent != nullptr && other.mContent != nullptr && mContent->compare(other.mContent);
49 }
50
51} // namespace MyGUI
MyGUI_Any.h
MyGUI_Precompiled.h
MyGUI::Any
Definition MyGUI_Any.h:56
MyGUI::Any::operator=
Any & operator=(const ValueType &rhs)
Definition MyGUI_Any.h:71
MyGUI::Any::~Any
~Any()
MyGUI::Any::getType
const std::type_info & getType() const
Definition MyGUI_Any.cpp:39
MyGUI::Any::empty
bool empty() const
Definition MyGUI_Any.cpp:34
MyGUI::Any::compare
bool compare(const Any &other) const
Definition MyGUI_Any.cpp:44
MyGUI::Any::Any
Any()
MyGUI::Any::Null
static const Any Null
Definition MyGUI_Any.h:58
MyGUI
Definition MyGUI_ActionController.h:15