YSTest: YCoreUtilities.cpp 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

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

- 文件列表
- 文件成员

YCoreUtilities.cpp
浏览该文件的文档.
1 /*
2 © 2014-2015, 2017 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 #include "YSLib/Core/YModules.h"
29 #include YFM_YSLib_Core_YCoreUtilities
30 #include <cstdlib> // for std::getenv;
31
32 namespace YSLib
33 {
34
35 void
36 ArgumentsVector::Reset(int argc, char* argv[])
37 {
38 Arguments.clear();
39 Arguments.reserve(CheckNonnegative<size_t>(argc, "argument number"));
40 for(size_t i(0); i < size_t(argc); ++i)
41 Arguments.push_back(Nonnull(argv[i]));
42 }
43
44
45 bool
46 FetchEnvironmentVariable(string& res, const char* var)
47 {
48 if(const auto val = std::getenv(Nonnull(var)))
49 {
50 res = val;
51 return true;
52 }
53 return {};
54 }
55
56 } // namespace YSLib;
57
YSLib::ArgumentsVector::Arguments
vector< string > Arguments
Definition: YCoreUtilities.h:382
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
platform::size_t
YF_API size_t
Definition: FileIO.h:1353
YSLib::i
return i
Definition: YCoreUtilities.h:176
platform::Nonnull
_type && Nonnull(_type &&p) ynothrowv
断言并返回非空参数。
Definition: Debug.h:422
YModules.h
YSLib::ArgumentsVector::Reset
void Reset(int, char *[])
设置值。
Definition: YCoreUtilities.cpp:36
YSLib::FetchEnvironmentVariable
bool FetchEnvironmentVariable(string &res, const char *var)
Definition: YCoreUtilities.cpp:46