YSTest: File.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

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

- 文件列表
- 文件成员

File.h
浏览该文件的文档.
1 /*
2 © 2009-2015 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_Service_File_h_
29 #define YSL_INC_Service_File_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Core_YCoreUtilities
33
34 namespace YSLib
35 {
36
37 namespace IO
38 {
39
48 YF_API YB_NONNULL(1) UniqueFile
49 OpenFile(const char*, int, mode_t = 0);
50
51
59 template<typename _tChar>
60 YB_NONNULL(1) void
61 TryRemove(const _tChar* path)
62 {
63 if(YB_UNLIKELY(!uremove(path) && errno != ENOENT))
64 ThrowFileOperationFailure("Failed removing destination file '"
65 + IO::MakePathString(path) + "'.");
66 }
67
68 template<typename _tChar>
69 YB_NONNULL(1) void
70 TryUnlink(const _tChar* path)
71 {
72 if(YB_UNLIKELY(!uunlink(path) && errno != ENOENT))
73 ThrowFileOperationFailure("Failed unlinking destination file '"
74 + IO::MakePathString(path) + "'.");
75 }
77
78 } // namespace IO;
79
80 } // namespace YSLib;
81
82 #endif
83
YSLib::IO::YB_NONNULL
YF_API YB_NONNULL(1) UniqueFile OpenFile(const char *
打开文件。
Definition: File.h:60
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
platform::MakePathString
MakePathString
Definition: FileIO.h:61
platform::UniqueFile
unique_ptr_from< FileDescriptor::Deleter > UniqueFile
Definition: FileIO.h:427
YSLib::IO::mode_t
YF_API mode_t
Definition: File.h:49
YB_UNLIKELY
#define YB_UNLIKELY(_expr)
分支预测提示。
Definition: ydef.h:438
YSLib::IO::OpenFile
UniqueFile OpenFile(const char *filename, int omode, mode_t pmode)
Definition: File.cpp:38
YModules.h
platform::uunlink
bool uunlink(const char *path) ynothrowv
Definition: FileIO.cpp:1035
YSLib::path
YF_API const char * path
Definition: Initialization.h:74
IO
platform::uremove
bool uremove(const char *path) ynothrowv
Definition: FileIO.cpp:1044
YF_API
#define YF_API
Definition: Platform.h:56