Kiwano Engine v1.3.x
Common.h
1// Copyright (c) 2016-2018 Kiwano - Nomango
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE.
20
21#pragma once
22#include <list>
23#include <map>
24#include <queue>
25#include <set>
26#include <sstream>
27#include <stack>
28#include <string>
29#include <unordered_map>
30#include <unordered_set>
31#include <kiwano/macros.h>
32#include <kiwano/core/String.h>
33#include <kiwano/core/Function.h>
34#include <kiwano/core/Singleton.h>
35#include <kiwano/core/Any.h>
36#include <kiwano/core/Allocator.h>
37#include <kiwano/core/BitOperator.h>
38#include <kiwano/core/Flag.h>
39
40namespace kiwano
41{
42
45using InputStream = std::istream;
46
49using OutputStream = std::ostream;
50
53using StringStream = std::stringstream;
54
57using WideStringStream = std::wstringstream;
58
61template <typename _Ty, typename _Alloc = std::allocator<_Ty>>
62using Vector = std::vector<_Ty, _Alloc>;
63
66template <typename _Ty, typename _Alloc = std::allocator<_Ty>>
67using List = std::list<_Ty, _Alloc>;
68
71template <typename _Ty, typename _Alloc = std::allocator<_Ty>>
72using Deque = std::deque<_Ty, _Alloc>;
73
76template <typename _Ty, typename _Container = Deque<_Ty>>
77using Queue = std::queue<_Ty, _Container>;
78
81template <typename _Kty, typename _Compare = std::less<_Kty>, typename _Alloc = std::allocator<_Kty>>
82using Set = std::set<_Kty, _Compare, _Alloc>;
83
86template <typename _Ty1, typename _Ty2>
87using Pair = std::pair<_Ty1, _Ty2>;
88
91template <typename _Kty, typename _Hash = std::hash<_Kty>, typename _Keq = std::equal_to<_Kty>,
92 typename _Alloc = std::allocator<_Kty>>
93using UnorderedSet = std::unordered_set<_Kty, _Hash, _Keq, _Alloc>;
94
97template <typename _Ty, typename _Container = Deque<_Ty>>
98using Stack = std::stack<_Ty, _Container>;
99
102template <typename _Kty, typename _Ty, typename _Compare = std::less<_Kty>,
103 typename _Alloc = std::allocator<Pair<const _Kty, _Ty>>>
104using Map = std::map<_Kty, _Ty, _Compare, _Alloc>;
105
108template <typename _Kty, typename _Ty, typename _Hash = std::hash<_Kty>, typename _Keq = std::equal_to<_Kty>,
109 typename _Alloc = std::allocator<Pair<const _Kty, _Ty>>>
110using UnorderedMap = std::unordered_map<_Kty, _Ty, _Hash, _Keq, _Alloc>;
111
115{
116protected:
117 Noncopyable() = default;
118
119private:
120 Noncopyable(const Noncopyable&) = delete;
121
122 Noncopyable& operator=(const Noncopyable&) = delete;
123};
124
125} // namespace kiwano
不可拷贝对象
Definition: Common.h:115