neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
object.hpp
Go to the documentation of this file.
1// object.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2018, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <boost/type_index.hpp>
23#include <neolib/neolib.hpp>
25#include <neolib/core/map.hpp>
26#include <neolib/app/object.hpp>
27#include <neogfx/core/event.hpp>
30
31namespace neogfx
32{
33 template <typename Base = i_object>
34 class object : public neolib::object<Base>, public i_properties
35 {
37 public:
39 public:
40 // meta
41 i_object& as_object() override
42 {
43 return *this;
44 }
45 // type
46 public:
47 void class_name(neolib::i_string& aClassName) const override
48 {
49 aClassName += neolib::string{ "object" };
50 }
52 {
53 return neogfx::object_type{};
54 }
55 // i_property_owner
56 public:
58 {
59 // default is to do nothing
60 }
61 public:
62 const i_properties& properties() const override
63 {
64 return *this;
65 }
67 {
68 return *this;
69 }
70 // i_properties
71 public:
72 void register_property(i_property& aProperty) override
73 {
74 iProperties.emplace(aProperty.name(), &aProperty);
75 }
76 const neogfx::property_map& property_map() const override
77 {
78 return iProperties;
79 }
80 // state
81 private:
83 };
84}
virtual const i_string & name() const =0
void property_changed(i_property &) override
Definition object.hpp:57
i_object & as_object() override
Definition object.hpp:41
void class_name(neolib::i_string &aClassName) const override
Definition object.hpp:47
neogfx::object_type object_type() const override
Definition object.hpp:51
const neogfx::property_map & property_map() const override
Definition object.hpp:76
const i_properties & properties() const override
Definition object.hpp:62
void register_property(i_property &aProperty) override
Definition object.hpp:72
i_properties & properties() override
Definition object.hpp:66