MyGUI 3.4.3
MyGUI_Macros.h
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#ifndef MYGUI_MACROS_H_
8#define MYGUI_MACROS_H_
9
10#include "MyGUI_Prerequest.h"
11#include <limits>
12#include <cstddef>
13#include <cstdint>
14#include <string_view>
15
16namespace MyGUI
17{
18
19 constexpr size_t ITEM_NONE = (std::numeric_limits<size_t>::max)();
20 constexpr float ALPHA_MAX = 1.0f;
21 constexpr float ALPHA_MIN = 0.0f;
22
23 constexpr unsigned int MYGUI_FLAG_NONE = 0;
24 constexpr unsigned int MYGUI_FLAG(uint8_t num)
25 {
26 return 1U << num;
27 }
28
35 template<class Map, class Value>
36 inline void mapSet(Map& map, std::string_view key, const Value& value)
37 {
38 auto it = map.find(key);
39 if (it == map.end())
40 map.emplace(key, value);
41 else
42 it->second = value;
43 }
44
45} // namespace MyGUI
46
47#endif // MYGUI_MACROS_H_
void mapSet(Map &map, std::string_view key, const Value &value)
constexpr float ALPHA_MAX
constexpr unsigned int MYGUI_FLAG(uint8_t num)
constexpr float ALPHA_MIN
constexpr size_t ITEM_NONE
constexpr unsigned int MYGUI_FLAG_NONE