YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
platform 命名空间参考

默认平台命名空间。 更多...

命名空间

namespace  ColorSpace
 系统默认颜色空间。
 
namespace  Consoles
 控制台接口。
 
namespace  KeyCodes
 本机按键编码。
 

类

exception  HFileNode
 文件系统节点迭代器。 更多...
 
struct  CursorInfo
 屏幕指针设备光标信息。 更多...
 
class  MappedFile
 只读内存映射文件。 更多...
 
class  Color
 颜色。 更多...
 

类型定义

typedef char NativePathCharType
 本机路径字符类型。
 
typedef NativePathCharType PATHSTR [256]
 本机路径字符串类型。
 
typedef NativePathCharType FILENAMESTR [256]
 本机文件名类型。
 
typedef std::bitset
< KeyBitsetWidth > 
KeyInput
 本机输入类型。
 
typedef std::int16_t SPos
 屏幕坐标度量。
 
typedef std::uint16_t SDst
 屏幕坐标距离。
 
typedef std::uint16_t PixelType
 LibNDS 兼容像素。
 
typedef PixelType * BitmapPtr
 
typedef const PixelType * ConstBitmapPtr
 

函数

void YDebugSetStatus (bool=true)
 调试模式:设置状态。
 
bool YDebugGetStatus ()
 调试模式:取得状态。
 
void YDebugBegin ()
 调试模式:显示控制台。
 
void YDebug ()
 调试模式:按键继续。
 
void YDebug (const char *)
 调试模式:显示控制台字符串,按键继续。
 
int yprintf (const char *,...)
 调试模式 printf :显示控制台格式化输出 ,按键继续。
 
int uopen (const char *filename, int oflag) ynothrow
 以 UTF-8 文件名无缓冲打开文件。
 
int uopen (const char *filename, int oflag, int pmode) ynothrow
 以 UTF-8 文件名无缓冲打开文件。
 
int uopen (const char16_t *filename, int oflag) ynothrow
 以 UCS-2LE 文件名无缓冲打开文件。
 
int uopen (const char16_t *filename, int oflag, int pmode) ynothrow
 以 UCS-2LE 文件名无缓冲打开文件。
 
std::FILE * ufopen (const char *filename, const char *mode) ynothrow
 以 UTF-8 文件名打开文件。
 
std::FILE * ufopen (const char16_t *filename, const char16_t *mode) ynothrow
 以 UCS-2LE 文件名打开文件。
 
bool ufexists (const char *) ynothrow
 判断指定 UTF-8 文件名的文件是否存在。
 
bool ufexists (const char16_t *) ynothrow
 判断指定 UCS-2 文件名的文件是否存在。
 
template<class _tString >
bool ufexists (const _tString &str) ynothrow
 判断指定字符串为文件名的文件是否存在。
 
bool direxists (const_path_t) ynothrow
 判断指定路径的目录是否存在。
 
bool udirexists (const_path_t) ynothrow
 判断指定 UTF-8 路径的目录是否存在。
 
template<class _tString >
bool udirexists (const _tString &str) ynothrow
 判断指定字符串为文件名的文件是否存在。
 
char * getcwd_n (char *buf, std::size_t size) ynothrow
 当第一参数非空时取当前工作目录复制至指定缓冲区中。
 
char16_t * u16getcwd_n (char16_t *buf, std::size_t size) ynothrow
 当第一参数非空时取当前工作目录( UCS2-LE 编码)复制至指定缓冲区中。
 
int uchdir (const_path_t) ynothrow
 切换当前工作路径至指定的 UTF-8 字符串。
 
bool mkdirs (const_path_t) ynothrow
 按路径新建一个或多个目录。
 
bool truncate (std::FILE *, std::size_t) ynothrow
 截断文件至指定长度。
 
bool IsAbsolute (const_path_t)
 判断指定路径字符串是否表示一个绝对路径。
 
std::size_t GetRootNameLength (const_path_t)
 取指定路径的文件系统根节点名称的长度。
 
void WaitForInput ()
 等待任意按键。
 
yconstexpr std::size_t KeyBitsetWidth (32)
 按键并行位宽。
 
void StartTicks ()
 开始 tick 计时。
 
std::uint32_t GetTicks ()
 取 tick 数。
 
std::uint64_t GetHighResolutionTicks ()
 取高精度 tick 数。
 
yconstfn std::uint8_t FetchAlpha (PixelType px)
 取像素 Alpha 值。
 
yconstfn PixelType FetchOpaque (PixelType px)
 取不透明像素。
 
yconstfn PixelType FetchPixel (std::uint8_t r, std::uint8_t g, std::uint8_t b)
 
void YConsoleInit (std::uint8_t dspIndex, Color fc=ColorSpace::White, Color bc=ColorSpace::Black)
 启动控制台。
 
bool InitVideo ()
 初始化视频输出。
 
YB_NORETURN void terminate () ynothrow
 异常终止函数。
 

详细描述

默认平台命名空间。

类型定义说明

在文件 Video.h 第 143 行定义.

在文件 Video.h 第 144 行定义.

typedef NativePathCharType platform::FILENAMESTR[256]

本机文件名类型。

自从
build 286

在文件 FileSystem.h 第 121 行定义.

typedef std::bitset<KeyBitsetWidth> platform::KeyInput

本机输入类型。

自从
build 298

支持并行按键的缓冲区数据类型。

在文件 Keys.h 第 61 行定义.

本机路径字符类型。

自从
build 286

在文件 FileSystem.h 第 80 行定义.

typedef NativePathCharType platform::PATHSTR[256]

本机路径字符串类型。

自从
build 286

在文件 FileSystem.h 第 116 行定义.

typedef std::uint16_t platform::PixelType

LibNDS 兼容像素。

注解
ABGR1555 。

在文件 Video.h 第 50 行定义.

typedef std::uint16_t platform::SDst

屏幕坐标距离。

在文件 Video.h 第 37 行定义.

typedef std::int16_t platform::SPos

屏幕坐标度量。

在文件 Video.h 第 36 行定义.

函数说明

bool platform::direxists ( const_path_t  path)

判断指定路径的目录是否存在。

自从
build 324

在文件 FileSystem.cpp 第 263 行定义.

参考自 udirexists().

这是这个函数的调用关系图:

yconstfn std::uint8_t platform::FetchAlpha ( PixelType  px)

取像素 Alpha 值。

自从
build 313

在文件 Video.h 第 56 行定义.

参考自 YSLib::Drawing::blitAlphaBlend() , 以及 YSLib::Drawing::BlitTransparentLoop< _bPositiveScan >::operator()().

这是这个函数的调用关系图:

yconstfn PixelType platform::FetchOpaque ( PixelType  px)

取不透明像素。

自从
build 297

在文件 Video.h 第 66 行定义.

参考自 YSLib::Drawing::blitAlphaBlend() , 以及 YSLib::Drawing::BlitTransparentLoop< _bPositiveScan >::operator()().

这是这个函数的调用关系图:

yconstfn PixelType platform::FetchPixel ( std::uint8_t  r,
std::uint8_t  g,
std::uint8_t  b 
)

在文件 Video.h 第 76 行定义.

参考自 platform::Color::operator PixelType().

这是这个函数的调用关系图:

char * platform::getcwd_n ( char *  buf,
std::size_t  size 
)

当第一参数非空时取当前工作目录复制至指定缓冲区中。

参数
buf缓冲区起始指针。
size缓冲区长。
返回
若成功为 buf ,否则为空指针。
弃用:
特定平台上的编码不保证是 UTF-8 。
自从
build 324

在文件 FileSystem.cpp 第 294 行定义.

参考 YB_LIKELY.

std::uint64_t platform::GetHighResolutionTicks ( )

取高精度 tick 数。

注解
单位为纳秒。
调用 StartTicks 。
警告
首次调用 StartTicks 前非线程安全。
自从
build 291

在文件 Timer.cpp 第 152 行定义.

参考 StartTicks().

参考自 YSLib::Timers::HighResolutionClock::now() , 以及 FPSCounter::Refresh().

函数调用图:

这是这个函数的调用关系图:

std::size_t platform::GetRootNameLength ( const_path_t  path)

取指定路径的文件系统根节点名称的长度。

在文件 FileSystem.cpp 第 467 行定义.

参考自 YSLib::IO::Path::GetRootName().

这是这个函数的调用关系图:

std::uint32_t platform::GetTicks ( )

取 tick 数。

注解
单位为毫秒。
调用 StartTicks 。
警告
首次调用 StartTicks 前非线程安全。

在文件 Timer.cpp 第 139 行定义.

参考 StartTicks().

参考自 YSL_BEGIN::GetTickPoint().

函数调用图:

这是这个函数的调用关系图:

bool platform::InitVideo ( )

初始化视频输出。

警告
不保证线程安全性。

在文件 Video.cpp 第 133 行定义.

参考 platform_ex::ResetVideo().

参考自 Deactivate() , 以及 DSApplication::DSApplication().

函数调用图:

这是这个函数的调用关系图:

bool platform::IsAbsolute ( const_path_t  path)

判断指定路径字符串是否表示一个绝对路径。

自从
build 152

在文件 FileSystem.cpp 第 446 行定义.

yconstexpr std::size_t platform::KeyBitsetWidth ( 32  )

按键并行位宽。

注解
不少于实际表示的 KeyPad 按键数。
自从
build 298

参考自 platform_ex::UpdateKeyStates().

这是这个函数的调用关系图:

bool platform::mkdirs ( const_path_t  cpath)

按路径新建一个或多个目录。

自从
build 324

在文件 FileSystem.cpp 第 363 行定义.

参考 YCL_PATH_DELIMITER.

void platform::StartTicks ( )

开始 tick 计时。

警告
首次调用前非线程安全。

在文件 Timer.cpp 第 101 行定义.

参考 yunseq().

参考自 GetHighResolutionTicks(),GetTicks() , 以及 YSL_BEGIN::Init().

函数调用图:

这是这个函数的调用关系图:

void platform::terminate ( )

异常终止函数。

自从
build 319

在文件 ycommon.cpp 第 37 行定义.

参考自 HandleFatalError(),InitializeEnviornment() , 以及 ShowFatalError().

这是这个函数的调用关系图:

bool platform::truncate ( std::FILE *  fp,
std::size_t  size 
)

截断文件至指定长度。

前置条件
指定文件需已经打开并可写。
返回
操作是否成功。
注解
不改变文件读写位置。
自从
build 341

若文件不足指定长度,扩展并使用空字节填充;否则保留起始指定长度的字节。

在文件 FileSystem.cpp 第 381 行定义.

参考自 YSLib::File::Truncate().

这是这个函数的调用关系图:

char16_t * platform::u16getcwd_n ( char16_t *  buf,
std::size_t  size 
)

当第一参数非空时取当前工作目录( UCS2-LE 编码)复制至指定缓冲区中。

参数
buf缓冲区起始指针。
size缓冲区长。
返回
若成功为 buf ,否则为空指针。
自从
build 324

在文件 FileSystem.cpp 第 302 行定义.

参考 MBCSToUCS2() , 以及 YB_LIKELY.

参考自 GetNowDirectory().

函数调用图:

这是这个函数的调用关系图:

int platform::uchdir ( const_path_t  path)

切换当前工作路径至指定的 UTF-8 字符串。

Bug:
MinGW32 环境下非线程安全。
自从
build 324

在文件 FileSystem.cpp 第 345 行定义.

参考自 YSLib::IO::ChangeDirectory().

这是这个函数的调用关系图:

bool platform::udirexists ( const_path_t  path)

判断指定 UTF-8 路径的目录是否存在。

Bug:
MinGW32 环境下非线程安全。
自从
build 324

在文件 FileSystem.cpp 第 272 行定义.

参考 direxists().

参考自 YSLib::IO::Path::IsDirectory() , 以及 udirexists().

函数调用图:

这是这个函数的调用关系图:

template<class _tString >
bool platform::udirexists ( const _tString &  str)
inline

判断指定字符串为文件名的文件是否存在。

注解
使用 NTCTS 参数 udirexists 实现。
自从
build 326

在文件 FileSystem.h 第 238 行定义.

参考 udirexists().

函数调用图:

bool platform::ufexists ( const char *  filename)

判断指定 UTF-8 文件名的文件是否存在。

注解
使用 ufopen 实现。
前置条件
断言:参数非空。
自从
build 324

在文件 FileSystem.cpp 第 232 行定义.

参考 ystdex::fexists(),ufopen() , 以及 yconstraint.

参考自 GetDesktopDownHandle(),LoadConfiguration() , 以及 ufexists().

函数调用图:

这是这个函数的调用关系图:

bool platform::ufexists ( const char16_t *  filename)

判断指定 UCS-2 文件名的文件是否存在。

注解
使用 ufopen 实现。
前置条件
断言:参数非空。
自从
build 324

在文件 FileSystem.cpp 第 250 行定义.

参考 ufopen() , 以及 yconstraint.

函数调用图:

template<class _tString >
bool platform::ufexists ( const _tString &  str)
inline

判断指定字符串为文件名的文件是否存在。

注解
使用 NTCTS 参数 ufexists 实现。
自从
build 324

在文件 FileSystem.h 第 212 行定义.

参考 ufexists().

函数调用图:

std::FILE * platform::ufopen ( const char *  filename,
const char *  mode 
)

以 UTF-8 文件名打开文件。

参数
filename文件名,意义同 std::fopen 。
mode打开模式,基本语义同 ISO C99 ,具体行为取决于实现。
前置条件
断言:filename && mode && *mode != 0 。
Bug:
MinGW32 环境下非线程安全。
自从
build 299

在文件 FileSystem.cpp 第 188 行定义.

参考 yconstraint.

参考自 ufexists().

这是这个函数的调用关系图:

std::FILE * platform::ufopen ( const char16_t *  filename,
const char16_t *  mode 
)

以 UCS-2LE 文件名打开文件。

参数
filename文件名,意义同 std::fopen 。
mode打开模式,基本语义同 ISO C99 ,具体行为取决于实现。
前置条件
断言:filename && mode && *mode != 0 。
自从
build 324

在文件 FileSystem.cpp 第 209 行定义.

参考 yconstraint.

int platform::uopen ( const char *  filename,
int  oflag 
)

以 UTF-8 文件名无缓冲打开文件。

参数
filename文件名,意义同 POSIX ::open 。
oflag打开标识,基本语义同 POSIX 2003 ,具体行为取决于实现。
前置条件
断言:filename 。
Bug:
MinGW32 环境下非线程安全。
自从
build 324

在文件 FileSystem.cpp 第 111 行定义.

参考 yconstraint.

int platform::uopen ( const char *  filename,
int  oflag,
int  pmode 
)

以 UTF-8 文件名无缓冲打开文件。

参数
filename文件名,意义同 POSIX ::open 。
oflag打开标识,基本语义同 POSIX 2003 ,具体行为取决于实现。
pmode打开模式,基本语义同 POSIX 2003 ,具体行为取决于实现。
前置条件
断言:filename 。
Bug:
MinGW32 环境下非线程安全。
自从
build 324

在文件 FileSystem.cpp 第 130 行定义.

参考 yconstraint.

int platform::uopen ( const char16_t *  filename,
int  oflag 
)

以 UCS-2LE 文件名无缓冲打开文件。

参数
filename文件名,意义同 POSIX ::open 。
oflag打开标识,基本语义同 POSIX 2003 ,具体行为取决于实现。
前置条件
断言:filename 。
自从
build 324

在文件 FileSystem.cpp 第 149 行定义.

参考 yconstraint.

int platform::uopen ( const char16_t *  filename,
int  oflag,
int  pmode 
)

以 UCS-2LE 文件名无缓冲打开文件。

参数
filename文件名,意义同 POSIX ::open 。
oflag打开标识,基本语义同 POSIX 2003 ,具体行为取决于实现。
pmode打开模式,基本语义同 POSIX 2003 ,具体行为取决于实现。
前置条件
断言:filename 。
自从
build 324

在文件 FileSystem.cpp 第 168 行定义.

参考 yconstraint.

void platform::WaitForInput ( )

等待任意按键。

在文件 Input.cpp 第 41 行定义.

参考 platform_ex::FetchKeyDownState() , 以及 platform_ex::UpdateKeyStates().

参考自 YSLib::UI::Console::Pause(),YDebug() , 以及 yprintf().

函数调用图:

这是这个函数的调用关系图:

void platform::YConsoleInit ( std::uint8_t  dspIndex,
Color  fc = ColorSpace::White,
Color  bc = ColorSpace::Black 
)

启动控制台。

注解
fc 为前景色,bc为背景色。

参考自 InitializeEnviornment() , 以及 YDebugBegin().

这是这个函数的调用关系图: