MyGUI: MyGUI_Macros.h Source File

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_
MyGUI_Prerequest.h
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::ALPHA_MAX
constexpr float ALPHA_MAX
Definition MyGUI_Macros.h:20
MyGUI::MYGUI_FLAG
constexpr unsigned int MYGUI_FLAG(uint8_t num)
Definition MyGUI_Macros.h:24
MyGUI::ALPHA_MIN
constexpr float ALPHA_MIN
Definition MyGUI_Macros.h:21
MyGUI::ITEM_NONE
constexpr size_t ITEM_NONE
Definition MyGUI_Macros.h:19
MyGUI::MYGUI_FLAG_NONE
constexpr unsigned int MYGUI_FLAG_NONE
Definition MyGUI_Macros.h:23