neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
neogfx.hpp
Go to the documentation of this file.
1// neogfx.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 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 <neolib/neolib.hpp>
23#include <string>
24#include <string_view>
25#include <boost/multiprecision/cpp_int.hpp>
26using namespace boost::multiprecision;
27
29#include <neolib/core/uuid.hpp>
34#include <neolib/core/any.hpp>
35#include <neolib/core/enum.hpp>
37#include <neolib/core/deque.hpp>
38#include <neolib/core/list.hpp>
43#include <neolib/app/logger.hpp>
44#include <neogfx/app/i18n.hpp>
45
46namespace services = neolib::services;
47
48namespace neogfx
49{
50 using namespace neolib::stdint_suffix;
51 using namespace std::string_literals;
52 using namespace std::string_view_literals;
53
54 using neolib::sfinae;
55
56 using neolib::to_const;
57
58 using neolib::lifetime;
61
65 using neolib::ref_ptr;
68 using neolib::make_ref;
73
75
78
79 using neolib::optional;
81
82 using neolib::variant;
83 using neolib::none;
84 using neolib::none_t;
85
86 using neolib::cache;
87 using neolib::invalid;
89
90 using neolib::any;
91 using neolib::any_cast;
92
93 using neolib::i_enum_t;
94 using neolib::enum_t;
96
97 using neolib::i_vector;
98 using neolib::vector;
99
100 using neolib::i_deque;
101 using neolib::deque;
102
103 using neolib::i_list;
104 using neolib::list;
105
106 using neolib::i_string;
107 using neolib::string;
108 using neolib::to_string;
109 namespace string_literals
110 {
111 using namespace neolib::string_literals;
112 }
113 using namespace string_literals;
114
115 string const empty_string;
116
117 using neolib::uuid;
118
120
121 using namespace neolib::services;
122
123 using neolib::operator<<;
124 using neolib::operator>>;
125
128
129 // convert strings with different traits and/or character types to neolib::string
130 template <typename CharT, typename Traits, typename Allocator>
131 inline const string to_string(const std::basic_string<CharT, Traits, Allocator>& aString)
132 {
133 static_assert(sizeof(CharT) == sizeof(char));
134 return string{ reinterpret_cast<const char*>(aString.c_str()), aString.size() };
135 }
136
137 // convert character array (primarily for UTF-8 string literals) to neolib::string
138 template <typename CharT, std::size_t Size>
139 inline const string to_string(const CharT (&aString)[Size])
140 {
141 static_assert(sizeof(CharT) == sizeof(char));
142 auto const correctedSize = (aString[Size - 1] == '\0' ? Size - 1 : Size);
143 return correctedSize > 0 ? string{ reinterpret_cast<const char*>(&aString[0]), correctedSize } : string{};
144 }
145
146 struct not_yet_implemented : std::runtime_error
147 {
148 not_yet_implemented(std::string const& aDetail = {}) :
149 std::runtime_error{ "neoGFX: Functionality not yet implemented" + (aDetail.empty() ? "" : " (" + aDetail + ")") } {}
150 };
151
152 class i_layout_item;
153 class i_widget;
154 namespace debug
155 {
156#ifdef NEOGFX_DEBUG
157 extern void* item;
158 extern i_layout_item* layoutItem;
159 extern i_widget* renderItem;
160 extern bool renderGeometryText; // todo: make a debug logger category
161#endif // NEOGFX_DEBUG
163 }
164}
neolib::logger::logger< 9999 > logger
Definition neogfx.hpp:162
std::string to_string(note const &aNote)
string const empty_string
Definition neogfx.hpp:115
const flush_t flush
Definition i_logger.hpp:78
const endl_t endl
Definition i_logger.hpp:77
typename detail::abstract_type< T >::type abstract_t
Definition neolib.hpp:178
std::optional< T > cache
Definition neolib.hpp:216
std::string to_string(const i_version &aVersion)
Definition i_version.hpp:66
const abstract_t< T > & to_abstract(const T &aArgument)
Definition neolib.hpp:181
constexpr auto invalid
Definition neolib.hpp:218
basic_enum< Enum > enum_t
Definition enum.hpp:128
ref_ptr< T > dynamic_pointer_cast(ref_ptr< U > const &aOther) noexcept
ref_ptr< ConcreteType > make_ref(Args &&... args)
to_const_reference_t< T > to_const(T &&object)
Definition neolib.hpp:113
i_basic_enum< std::underlying_type_t< T > > i_enum_t
Definition i_enum.hpp:211
ref_ptr< T > const_pointer_cast(ref_ptr< U > const &aOther) noexcept
ref_ptr< T > static_pointer_cast(ref_ptr< U > const &aOther) noexcept
StringT enum_to_string(Enum aEnumerator, bool aMustEnumerate=false)
Definition i_enum.hpp:78
std::monostate none_t
Definition variant.hpp:110
const none_t none
Definition variant.hpp:111
void clear_cache(cache< T > &aCachedVariable)
Definition neolib.hpp:221
T any_cast(const any &operand)
Definition any.hpp:267
ref_ptr< T > reinterpret_pointer_cast(ref_ptr< U > const &aOther) noexcept
Definition plf_hive.h:79
not_yet_implemented(std::string const &aDetail={})
Definition neogfx.hpp:148