YSTest: YAdaptor.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

YAdaptor.h
浏览该文件的文档.
1 /*
2 © 2010-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_Adaptor_YAdaptor_h_
29 #define YSL_INC_Adaptor_YAdaptor_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Adaptor_YNew // for <cstddef>, <cstdint>, <climits>,
33 // mandated <new>, mandated <initializer_list>, <string>, <list>, <map>,
34 // mandated <utility>;
35 #include <libdefect/cmath.h> // for <cmath>, std::round;
36 #include <ystdex/algorithm.hpp> // for mandated header, mandated <type_traits>,
37 // mandated <algorithm>, ystdex::min, ystdex::max;
38 #include <ystdex/functional.hpp> // for mandated header, mandated <functional>,
39 // ystdex::seq_apply, ystdex::unseq_apply;
40 #include YFM_YCLib_Keys // for platform::basic_types, mandated <bitset>,
41 // YCLib key space;
42 #include YFM_YCLib_Debug // for <array>, <deque>, <forward_list>, <istream>,
43 // <ostream>, <queue>, <set>, <stack>, <unordered_map>, <unordered_set>,
44 // YFM_YCLib_Container, <vector>, '*string_view', forward_as_tuple, get,
45 // ignore, make_pair, make_tuple, pair, tie, tuple, tuple_cat, size;
46 #include YFM_YCLib_Timer
47 #include YFM_YCLib_FileIO // for uopen, 'uf*', 'up*', etc;
48 #include YFM_YCLib_FileSystem
49 #include YFM_YCLib_Video // for MonoType, AlphaType, Color;
50 #include YFM_YCLib_Mutex // for ystdex::noncopyable, ystdex::nonmovable,
51 // Threading, Concurrency;
52 #include YFM_YCLib_Reference // for <memory>, '*_ptr', 'make*_ptr',
53 // lref;
54
59 namespace YSLib
60 {
61
63 using namespace platform::basic_types;
64
66 using ystdex::_t;
67
73 using ystdex::seq_apply;
74 using ystdex::unseq_apply;
76
82 using ystdex::noncopyable;
84 using ystdex::nonmovable;
86
92 using std::round;
94
100
102 #if __cplusplus >= 201402L
103 using std::min;
104 using std::max;
105 #else
106 using ystdex::min;
109 using ystdex::max;
110 #endif
111
112
113
114
116
117 using platform::forward_as_tuple;
118 using platform::get;
119 using platform::ignore;
120 using platform::make_pair;
121 using platform::make_tuple;
122 using platform::pair;
123 using platform::tie;
124 using platform::tuple;
125 using platform::tuple_cat;
126
128 using platform::begin;
130 using platform::end;
131
132 using platform::array;
133 using platform::deque;
134 using platform::forward_list;
135 using platform::list;
136 using platform::vector;
137
138 using platform::map;
139 using platform::multimap;
140 using platform::multiset;
141 using platform::set;
142
143 using platform::unordered_map;
144 using platform::unordered_multimap;
145 using platform::unordered_multiset;
146 using platform::unordered_set;
147
148 using platform::stack;
149 using platform::priority_queue;
150 using platform::queue;
151
153 using platform::size;
154
156 using platform::basic_string;
157
158 using platform::string;
159 using platform::wstring;
160 using platform::sfmt;
161 using platform::vsfmt;
162
163 using platform::to_string;
164 using platform::to_wstring;
165
167
168 using platform::basic_string_view;
169 using platform::string_view;
171 using platform::u16string_view;
172 using platform::wstring_view;
174
175 using platform::bad_weak_ptr;
176 using platform::const_pointer_cast;
177 using platform::dynamic_pointer_cast;
178 using platform::enable_shared_from_this;
179 using platform::get_deleter;
181 using platform::make_observer;
182 using platform::make_shared;
183 using platform::make_unique;
185 using platform::make_unique_default_init;
186 using platform::get_raw;
188 using platform::observer_ptr;
189 using platform::owner_less;
190 using platform::reset;
191 using platform::share_raw;
192 using platform::shared_ptr;
193 using platform::static_pointer_cast;
194 using platform::unique_raw;
195 using platform::unique_ptr;
197 using platform::unique_ptr_from;
198 using platform::weak_ptr;
199
200 using platform::lref;
202
204
205 using platform::nptr;
206 using platform::tidy_ptr;
207 using platform::pointer_iterator;
209
214 using platform::Threading::unlock_delete;
215
216
221 using namespace platform::Concurrency;
226 using namespace platform::Descriptions;
227
233 using platform::usystem;
236
242 using platform::Logger;
243 using platform::FetchCommonLogger;
245
252 using platform::Nonnull;
254 using platform::CheckIter;
255 using platform::Deref;
257
263 using platform::uaccess;
266 using platform::uopen;
267 using platform::ufopen;
268 using platform::ufexists;
270 using platform::upclose;
272 using platform::upopen;
274 using platform::ugetcwd;
276 using platform::uchdir;
278 using platform::umkdir;
280 using platform::urmdir;
282 using platform::uunlink;
284 using platform::uremove;
287
288 using platform::basic_filebuf;
289 using platform::filebuf;
290 using platform::wfilebuf;
292 using platform::basic_ifstream;
294 using platform::basic_ofstream;
295 using platform::basic_fstream;
297 using platform::ifstream;
299 using platform::ofstream;
300 using platform::fstream;
302 using platform::wifstream;
304 using platform::wofstream;
305 using platform::wfstream;
307
308
309 //系统处理函数。
310 using platform::terminate;
311
312 //基本图形定义。
313 using platform::SPos;
314 using platform::SDst;
315
316 //基本输出接口。
317 using platform::InitVideo;
318
319 //计时器和时钟。
320 using platform::GetTicks;
321 using platform::GetHighResolutionTicks;
322
323 //输入类型。
325 using platform::KeyIndex;
327 using platform::KeyBitsetWidth;
328 using platform::KeyInput;
330 namespace KeyCategory = platform::KeyCategory;
331 namespace KeyCodes = platform::KeyCodes;
332
334 using platform::FindFirstKey;
336 using platform::FindNextKey;
338 using platform::MapKeyChar;
339
341 namespace Drawing
342 {
343
345 using platform::XYZAMaskTrait;
347 using platform::AXYZMaskTrait;
349 using platform::BGRA;
351 using platform::RGBA;
353 using platform::Pixel;
358 using platform::FetchAlpha;
359 using platform::FetchOpaque;
361
363 using platform::MonoType;
364 using platform::AlphaType;
366 using platform::Color;
367 namespace ColorSpace = platform::ColorSpace;
368
369 } // namespace Drawing;
370
371 namespace IO
372 {
373
379 using platform::MakePathString;
381 using platform::mode_t;
382 using platform::FileDescriptor;
383 using platform::UniqueFile;
384 using platform::DefaultPMode;
385 using platform::omode_conv;
386 using platform::omode_convb;
388 using platform::FileOperationFailure;
390 using platform::ThrowFileOperationFailure;
392 using platform::GetFileAccessTimeOf;
394 using platform::GetFileModificationTimeOf;
396 using platform::GetFileModificationAndAccessTimeOf;
397 using platform::FetchNumberOfLinks;
398 using platform::EnsureUniqueFile;
400
401 using platform::HaveSameContents;
402 using platform::IsNodeShared;
403
405 using platform::NodeCategory;
406
407 using platform::CreateHardLink;
408 using platform::CreateSymbolicLink;
410
412 using platform::DirectorySession;
413 using platform::HDirectory;
414 using platform::FileIterator;
416 using platform::IsAbsolute;
419 using platform::FetchRootNameLength;
421 using NativePathView = basic_string_view<HDirectory::NativeChar>;
423
424 } // namespace IO;
425
426 } // namespace YSLib;
427
428 #endif
429
platform::DefaultPMode
YF_API YB_STATELESS mode_t DefaultPMode() ynothrow
取默认权限。
Definition: FileIO.cpp:716
platform::mode_t
::mode_t mode_t
文件模式类型。
Definition: FileIO.h:108
ystdex::to_string
std::string to_string(const std::thread::id &)
转换 thread::id 为字符串表示。
cmath.h
标准库实现 修正。
ystdex::sfmt
auto sfmt(const _tChar *fmt,...) -> decltype(vsfmt(fmt, std::declval< std::va_list >()))
以 C 标准输出格式的输出 std::basic_string 实例的对象。
Definition: string.hpp:1140
ystdex::string_view
basic_string_view< char > string_view
Definition: string_view.hpp:415
platform::containers::string
basic_string< char > string
Definition: Container.h:101
platform::Nonnull
_type && Nonnull(_type &&p) ynothrow
断言并返回非空指针。
Definition: Debug.h:411
platform::InitVideo
YF_API bool InitVideo()
初始化视频输出。
Definition: Video.cpp:43
platform::Descriptions
平台描述空间。
Definition: YCommon.h:144
platform::ColorSpace
系统默认颜色空间。
Definition: Video.h:413
ystdex::unseq_apply
void unseq_apply(_func &&f, _tParams &&...args)
无序调用。
Definition: functional.hpp:241
platform::KeyCodes
本机按键编码。
Definition: Keys.h:203
YSLib::IO::FileDescriptor
YF_API const char *YF_API FileDescriptor
Definition: YSLib/Service/FileSystem.h:575
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
platform::KeyCategory
按键类别。
Definition: Keys.h:94
platform::NodeCategory
NodeCategory
文件节点类别。
Definition: FileIO.h:117
platform::RGBA
union _vA::IntegerType RGBA
Definition: Video.h:193
platform::AlphaType
octet AlphaType
Definition: Video.h:289
ystdex::reset
bool reset(std::unique_ptr< _type > &p)
Definition: memory.hpp:584
ystdex::get_raw
_type * get_raw(_type *const &p)
Definition: memory.hpp:550
Color
Pixel Color
Definition: CharRenderer.cpp:58
platform::IsNodeShared
bool IsNodeShared(FileDescriptor, FileDescriptor) ynothrow
Definition: FileIO.cpp:1219
ystdex::const_pointer_cast
std::unique_ptr< _tDst > const_pointer_cast(std::unique_ptr< _type > p)
Definition: memory.hpp:896
platform::GetFileModificationTimeOf
GetFileModificationTimeOf
Definition: FileIO.h:1199
ystdex::wstring_view
basic_string_view< wchar_t > wstring_view
Definition: string_view.hpp:418
platform::uchdir
bool uchdir(const char *path) ynothrowv
Definition: FileIO.cpp:1023
platform::uopen
int uopen(const char *filename, int oflag, mode_t pmode) ynothrowv
Definition: FileIO.cpp:804
platform::uaccess
int uaccess(const char *path, int amode) ynothrowv
Definition: FileIO.cpp:781
platform::MakePathString
MakePathString
Definition: FileIO.h:61
platform::ufexists
bool ufexists(const char *filename) ynothrowv
Definition: FileIO.cpp:875
platform::usystem
YF_API int usystem(const char *)
执行 UTF-8 字符串的环境命令。
Definition: YCommon.cpp:53
platform::UniqueFile
unique_ptr_from< FileDescriptor::Deleter > UniqueFile
Definition: FileIO.h:427
platform::upclose
int upclose(std::FILE *fp) ynothrowv
Definition: FileIO.cpp:892
ystdex::share_raw
std::shared_ptr< _type > share_raw(_type *p, _tParams &&...args)
Definition: memory.hpp:664
platform::Concurrency
Definition: Mutex.h:47
functional.hpp
函数和可调用对象。
platform::umkdir
bool umkdir(const char *path) ynothrowv
Definition: FileIO.cpp:1025
platform::FetchCommonLogger
YF_API Logger & FetchCommonLogger()
取公共日志记录器。
Definition: Debug.cpp:223
platform::Deref
yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:440
ystdex::_t
typename _type::type _t
嵌套类型别名。
Definition: type_traits.hpp:96
platform::CreateSymbolicLink
void CreateSymbolicLink(const char *dst, const char *src, bool is_dir)
Definition: YCLib/FileSystem.cpp:240
platform::SPos
std::int16_t SPos
屏幕坐标度量。
Definition: Video.h:42
ystdex::static_pointer_cast
std::unique_ptr< _tDst > static_pointer_cast(std::unique_ptr< _type > p)
智能指针转换。
Definition: memory.hpp:847
ystdex::cpp2014::make_unique
enable_if_t<!is_array< _type >::value, std::unique_ptr< _type > > make_unique(_tParams &&...args)
使用 new 和指定参数构造指定类型的 std::unique_ptr 对象。
Definition: memory.hpp:729
ystdex::size
auto size(const _tRange &c) -> decltype(c.size())
类容器访问。
Definition: range.hpp:233
ystdex::basic_string_view
Definition: string_view.hpp:49
platform::AXYZMaskTrait
AXYZ 掩码特征。
Definition: Video.h:111
platform::references::unique_ptr_from
unique_ptr< ystdex::defer_element< ystdex::unique_ptr_pointer< void, _tDeleter >, _tDefault >, _tDeleter > unique_ptr_from
取删除器对应的 unique_ptr 实例。
Definition: Reference.h:83
platform::uunlink
bool uunlink(const char *path) ynothrowv
Definition: FileIO.cpp:1035
platform::containers::wstring
basic_string< wchar_t > wstring
Definition: Container.h:108
platform::FindFirstKey
YF_API KeyIndex FindFirstKey(const KeyInput &) ynothrow
找到输入缓冲区记录中最小的按键编码。
Definition: Keys.cpp:38
YModules.h
platform::basic_types
Definition: Platform.h:414
IO
ystdex::make_unique_default_init
enable_if_t<!is_array< _type >::value, std::unique_ptr< _type > > make_unique_default_init()
Definition: memory.hpp:756
platform::GetHighResolutionTicks
YF_API std::uint64_t GetHighResolutionTicks() ynothrow
取高精度 tick 数。
Definition: Timer.cpp:88
platform::DirectorySession
目录会话：表示打开的目录。
Definition: YCLib/FileSystem.h:416
ystdex::max
const _type & max(const _type &a, const _type &b, _fComp comp=less< _type >())
取较大的元素。
Definition: algorithm.hpp:543
platform::FindNextKey
YF_API KeyIndex FindNextKey(const KeyInput &, KeyIndex) ynothrow
找到输入缓冲区记录中大于指定编码的最小的按键编码。
Definition: Keys.cpp:48
platform::FileOperationFailure
表示文件操作失败的异常。
Definition: FileIO.h:1142
platform::uremove
bool uremove(const char *path) ynothrowv
Definition: FileIO.cpp:1044
platform::BGRA
union _vA::IntegerType BGRA
Definition: Video.h:136
Drawing
platform::Logger
日志记录器。
Definition: Debug.h:86
ystdex::nonmovable
Definition: base.h:81
platform::references::tidy_ptr
nptr< observer_ptr< _type >> tidy_ptr
Definition: Reference.h:93
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:67
ystdex::unlock_delete
threading::unlock_delete< _tMutex, _tLock > unlock_delete
解锁删除器：默认使用标准库互斥量和锁。
Definition: concurrency.h:52
ystdex::vsfmt
_tString vsfmt(const _tChar *fmt, std::va_list args)
以 C 标准输出格式的输出 std::basic_string 实例的对象。
Definition: string.hpp:1111
ystdex::u16string_view
basic_string_view< char16_t > u16string_view
Definition: string_view.hpp:416
platform::KeyIndex
size_t KeyIndex
按键索引类型：标识特定的按键在按键集合中的位置。
Definition: Keys.h:42
platform::CreateHardLink
void CreateHardLink(const char *dst, const char *src)
Definition: YCLib/FileSystem.cpp:208
platform::containers::basic_string
std::basic_string< _tChar, _tTraits, _tAlloc > basic_string
满足 ISO C++03 std::basic_string 但不保证满足 ISO C++11 的实现。
Definition: Container.h:98
platform::HaveSameContents
bool HaveSameContents(const char *path_a, const char *path_b, mode_t mode)
Definition: FileIO.cpp:1155
platform::GetTicks
YF_API std::uint32_t GetTicks() ynothrow
取 tick 数。
Definition: Timer.cpp:76
ystdex::noncopyable
不可复制对象：禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
Definition: base.h:41
platform::omode_convb
std::ios_base::sync_with_stdio(sync)) YF_API YB_STATELESS int omode_conv(std YF_API YB_STATELESS int omode_convb(std::ios_base::openmode) ynothrow
ISO C++ 标准输入输出接口打开模式转换为 POSIX 文件打开模式。
Definition: FileIO.cpp:768
ColorSpace
platform::urmdir
bool urmdir(const char *path) ynothrowv
Definition: FileIO.cpp:1033
platform::ugetcwd
char * ugetcwd(char *buf, size_t size) ynothrowv
Definition: FileIO.cpp:939
platform::MonoType
octet MonoType
Definition: Video.h:288
ystdex::make_shared
std::shared_ptr< _type > make_shared(std::initializer_list< _tValue > il)
使用指定类型的初始化列表构造指定类型的 std::shared_ptr 对象。
Definition: memory.hpp:819
platform::terminate
YB_NORETURN YF_API void terminate() ynothrow
异常终止函数。
Definition: YCommon.cpp:42
ystdex::make_observer
observer_ptr< _type > make_observer(_type *p)
Definition: memory.hpp:1042
ystdex::min
const _type & min(const _type &a, const _type &b, _fComp comp=less< _type >())
取较小的元素。
Definition: algorithm.hpp:521
ystdex::to_wstring
std::wstring to_wstring(unsigned char val)
Definition: string.hpp:998
ystdex::cpp2011::begin
_type * begin(_type(&&array)[_vN])
Definition: range.hpp:46
platform::upopen
std::FILE * upopen(const char *filename, const char *mode) ynothrowv
Definition: FileIO.cpp:906
ystdex::seq_apply
void seq_apply(_func &&)
顺序递归调用。
Definition: functional.hpp:225
algorithm.hpp
泛型算法。
platform::GetFileModificationAndAccessTimeOf
GetFileModificationAndAccessTimeOf
Definition: FileIO.h:1221
platform::HDirectory
目录句柄：表示打开的目录和内容迭代状态。
Definition: YCLib/FileSystem.h:500
ystdex::unique_raw
std::unique_ptr< _type > unique_raw(_pSrc *p)
Definition: memory.hpp:617
platform::CheckIter
_type && CheckIter(_type &&i) ynothrow
检查迭代器。
Definition: Debug.h:424
platform::ufopen
std::FILE * ufopen(const char *filename, const char *mode) ynothrowv
Definition: FileIO.cpp:828
ystdex::cpp2011::end
_type * end(_type(&&array)[_vN])
Definition: range.hpp:54
platform::XYZAMaskTrait
XYZA 掩码特征。
Definition: Video.h:92
platform::EnsureUniqueFile
UniqueFile EnsureUniqueFile(const char *dst, mode_t mode, size_t allowed_links, bool share)
Definition: FileIO.cpp:1122
platform::GetFileAccessTimeOf
GetFileAccessTimeOf
Definition: FileIO.h:1179
platform::omode_conv
int omode_conv(std::ios_base::openmode mode) ynothrow
Definition: FileIO.cpp:740
ystdex::dynamic_pointer_cast
std::unique_ptr< _tDst > dynamic_pointer_cast(std::unique_ptr< _type > &p)
Definition: memory.hpp:861
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:43
YSLib::IO::IsAbsolute
IsAbsolute
Definition: YSLib/Service/FileSystem.h:351