YSTest  PreAlpha_b371_20130102
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
Helper Functions

助手功能/函数。 更多...

函数

template<bool _bIsPositive, typename _tScalar1 , typename _tScalar2 >
_tScalar1 & ystdex::delta_assign (_tScalar1 &_x, _tScalar2 &_y)
 编译期选择加法/减法复合赋值运算。
 
Drawing::FontCache & FetchDefaultFontCache ()
 取默认字体缓存。
 
Devices::Screen & FetchDefaultScreen ()
 取默认屏幕。
 
shared_ptr< Shell > YSLib::FetchShellHandle () ynothrow
 取当前应用程序线程空间中活动的 Shell 句柄。
 
bool YSLib::Activate (const shared_ptr< Shell > &hShl)
 激活 Shell 对象:控制权转移给此对象以维持单线程运行。
 
template<typename _type >
ValueObject YSLib::MakeValueObjectByPtr (_type *p)
 使用指针构造 ValueObject 实例。
 
template<VisualEvent _vID>
GEvent< void(typename
EventTypeMapping< _vID >
::HandlerType::EventArgsType)> & 
YSLib::Components::FetchEvent (VisualEventMap &m)
 取控件事件。
 
template<VisualEvent _vID>
GEvent< void(typename
EventTypeMapping< _vID >
::HandlerType::EventArgsType)> & 
YSLib::Components::FetchEvent (AController &controller)
 取部件事件。
 
template<VisualEvent _vID>
GEvent< void(typename
EventTypeMapping< _vID >
::HandlerType::EventArgsType)> & 
YSLib::Components::FetchEvent (IWidget &wgt)
 取部件事件。
 
void YSLib::Components::RequestFocus (IWidget &wgt)
 向部件容器释放获得焦点,成功后向自身发送 GotFocus 事件。
 
void YSLib::Components::ReleaseFocus (IWidget &wgt)
 释放焦点,成功后向自身发送 LostFocus 事件。
 
IWidget * YSLib::Components::FetchContainerPtr (const IWidget &wgt)
 取部件的容器指针。
 
IWidget * YSLib::Components::FetchFocusingPtr (IWidget &wgt)
 取焦点对象指针。
 
const Point & YSLib::Components::GetLocationOf (const IWidget &wgt)
 取部件位置。
 
const Size & YSLib::Components::GetSizeOf (const IWidget &wgt)
 取部件大小。
 

变量

 YSL_END
 Shell 快捷操作。
 
template<class _type , class _tHandle >
_type & HandleToReference (_tHandle h) ythrow(std
 句柄转换:对象引用。
 
template<class _tShell >
_tShell & FetchShell ()
 取指定 Shell 句柄对应的 Shell 引用 。
 
template<class _tShl >
shared_ptr< Shell > FetchStored ()
 取全局 Shell 句柄。
 
template<class _tShl >
void ReleaseStored ()
 释放全局 Shell 。
 
bool IsNowShell (const shared_ptr< Shell > &hShl)
 判断句柄指定的 Shell 是否为当前线程空间中运行的 Shell 。
 
errno_t NowShellTo (const shared_ptr< Shell > &hShl)
 向句柄指定的 Shell 对象转移线程控制权。
 
template<class _tShl >
errno_t NowShellToNew ()
 向新建 Shell 对象转移控制权。
 
template<class _tShl >
errno_t NowShellToStored ()
 向全局 Shell 管理器的对象转移控制权。
 
void SetShellTo (const shared_ptr< Shell > &hShl, Messaging::Priority p=0x80)
 通过主消息队列向指定 Shell 对象转移控制权。
 
template<class _tShl >
void SetShellToNew ()
 通过主消息队列向新建 Shell 对象转移控制权。
 
template<class _tShl >
void SetShellToStored ()
 通过主消息队列向全局 Shell 管理器内的对象转移控制权。
 
template<class _tShl >
void CallStoredAtOnce ()
 封装向全局 Shell 管理器内的对象转移控制权。
 
template<class _tShl >
void CallStored ()
 封装通过消息队列向全局 Shell 管理器内的对象转移控制权。
 
Color GenerateRandomColor ()
 
template<typename _tOut , typename _tGen >
void ScrDraw (_tOut buf, _tGen &&f)
 全屏幕描点。
 
shared_ptr< Image > CreateSharedScreenImage (ConstBitmapPtr p)
 新建屏幕图像。
 
template<typename _tPixel >
_tPixel * CreateRawBitmap (const _tPixel *s, size_t n)
 使用 new 分配空间并复制无压缩位图。
 
YF_API void RemoveGlobalTasks ()
 从全局消息队列中移除所有后台消息。
 
yconstexpr const char * DefaultTimeFormat ("%04u-%02u-%02u %02u:%02u:%02u")
 默认时间格式字符串。
 
YF_API const char * TranslateTime (const std::tm &, const char *=DefaultTimeFormat)
 格式化时间字符串。
 
YF_API const char * TranslateTime (const std::time_t &, const char *=DefaultTimeFormat) ythrow(GeneralEvent)
 
auto YSLib::begin (ValueNode &node) -> decltype(node.GetBegin())
 迭代器包装,用于 range-based for 。
 
auto YSLib::begin (const ValueNode &node) -> decltype(node.GetBegin())
 
auto YSLib::end (ValueNode &node) -> decltype(node.GetEnd())
 
auto YSLib::end (const ValueNode &node) -> decltype(node.GetEnd())
 

详细描述

助手功能/函数。

仅帮助简化编码形式或确定接口,并不包含编译期之后逻辑功能实现的代码设施。

自从
build 252

函数说明

bool YSLib::Activate ( const shared_ptr< Shell > &  hShl)
inline

激活 Shell 对象:控制权转移给此对象以维持单线程运行。

前置条件
断言: bool(hShl)
警告
不保证线程安全性。

在文件 yapp.h141 行定义.

参考 FetchAppInstance() , 以及 YAssert.

参考自 YSLib::Components::Console::Console(),YSL_BEGIN::Init(),main(),NowShellTo(),ShlTextReader::OnKeyDown() , 以及 YSLib::Components::InputTimer::Refresh().

函数调用图:

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

auto YSLib::begin ( ValueNode &  node) -> decltype(node.GetBegin())
inline

迭代器包装,用于 range-based for 。

自从
build 330

在文件 ValueNode.h178 行定义.

参考自 YSLib::IO::Path::GetRelativePath(),YSLib::Messaging::MessageQueue::Peek() , 以及 YSLib::Messaging::MessageQueue::Pop().

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

auto YSLib::begin ( const ValueNode &  node) -> decltype(node.GetBegin())
inline

在文件 ValueNode.h183 行定义.

template<class _tShl >
void CallStored ( )
inline

封装通过消息队列向全局 Shell 管理器内的对象转移控制权。

自从
早于 build 132

在文件 ShellHelper.h237 行定义.

template<class _tShl >
void CallStoredAtOnce ( )
inline

封装向全局 Shell 管理器内的对象转移控制权。

自从
早于 build 132

在文件 ShellHelper.h226 行定义.

template<typename _tPixel >
_tPixel* CreateRawBitmap ( const _tPixel *  s,
size_t  n 
)

使用 new 分配空间并复制无压缩位图。

自从
build 213

在文件 ShellHelper.h286 行定义.

参考 YB_LIKELY.

shared_ptr<Image> CreateSharedScreenImage ( ConstBitmapPtr  p)
inline

新建屏幕图像。

自从
build 213

在文件 ShellHelper.h275 行定义.

参考 MainScreenHeight() , 以及 MainScreenWidth().

函数调用图:

yconstexpr const char* DefaultTimeFormat ( "%04u-%02u-%02u %02u:%02u:%02u"  )

默认时间格式字符串。

自从
build 307
template<bool _bIsPositive, typename _tScalar1 , typename _tScalar2 >
_tScalar1& ystdex::delta_assign ( _tScalar1 &  _x,
_tScalar2 &  _y 
)
inline

编译期选择加法/减法复合赋值运算。

自从
build 284

在文件 functional.hpp349 行定义.

auto YSLib::end ( ValueNode &  node) -> decltype(node.GetEnd())
inline
auto YSLib::end ( const ValueNode &  node) -> decltype(node.GetEnd())
inline

在文件 ValueNode.h194 行定义.

Drawing::FontCache& FetchDefaultFontCache ( )
inline

取默认字体缓存。

自从
build 219

在文件 DSMain.h212 行定义.

参考 FetchGlobalInstance() , 以及 DSApplication::GetFontCache().

参考自 FetchDefaultTypeface(),YSLib::Drawing::FontCache::GetDefaultTypefacePtr() , 以及 InitializeSystemFontCache().

函数调用图:

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

Devices::Screen& FetchDefaultScreen ( )
inline

取默认屏幕。

自从
build 219

在文件 DSMain.h223 行定义.

参考 FetchGlobalInstance() , 以及 DSApplication::GetScreenUp().

函数调用图:

template<VisualEvent _vID>
GEvent<void( typename EventTypeMapping<_vID>::HandlerType ::EventArgsType)>& YSLib::Components::FetchEvent ( VisualEventMap &  m)

取控件事件。

注解
需要确保 EventTypeMapping 中有对应的 EventType ,否则无法匹配此函数模板。
若控件事件不存在则自动添加空事件。

在文件 ycontrol.h137 行定义.

参考 EventT , 以及 GetEvent().

函数调用图:

template<VisualEvent _vID>
GEvent<void( typename EventTypeMapping<_vID>::HandlerType ::EventArgsType)>& YSLib::Components::FetchEvent ( AController &  controller)

取部件事件。

模板参数
_vID指定事件类型。
参数
controller指定部件的控制器。
异常
BadControl异常中立:无事件映射表:由 GetController 抛出。
注解
需要确保 EventTypeMapping 中有对应的 EventType ,否则无法匹配此函数模板。
若控件事件不存在则自动添加空事件。
自从
build 195

在文件 ycontrol.h154 行定义.

参考 EventT , 以及 YSLib::Components::AController::GetItemRef().

函数调用图:

template<VisualEvent _vID>
GEvent<void( typename EventTypeMapping<_vID>::HandlerType ::EventArgsType)>& YSLib::Components::FetchEvent ( IWidget &  wgt)
inline

取部件事件。

模板参数
_vID指定事件类型。
参数
wgt指定部件。
异常
BadControl异常中立:无事件映射表:由 GetController 抛出。
注解
需要确保 EventTypeMapping 中有对应的 EventType ,否则无法匹配此函数模板。
若控件事件不存在则自动添加空事件。
自从
build 237

在文件 ycontrol.h171 行定义.

参考 YSLib::Components::IWidget::GetController().

函数调用图:

IWidget* YSLib::Components::FetchFocusingPtr ( IWidget &  wgt)
inline

取焦点对象指针。

返回
若为保存了子部件中的焦点对象的容器则返回指针,否则返回 nullptr
自从
build 239

在文件 ywidget.h141 行定义.

参考 YSLib::Components::IWidget::GetView() , 以及 YSLib::Components::View::pFocusing.

参考自 ClearFocusingOf(),IsFocused(),YSLib::Components::Panel::operator-=() , 以及 YSLib::Components::GUIState::ResponseKey().

函数调用图:

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

template<class _tShell >
_tShell& FetchShell ( )
inline

取指定 Shell 句柄对应的 Shell 引用 。

自从
build 205

在文件 ShellHelper.h109 行定义.

参考 YSLib::FetchShellHandle() , 以及 YAssert.

函数调用图:

shared_ptr<Shell> YSLib::FetchShellHandle ( )
inline

取当前应用程序线程空间中活动的 Shell 句柄。

警告
应用程序实例初始化前不保证线程安全性。

在文件 yapp.h129 行定义.

参考 FetchAppInstance().

参考自 FetchShell().

函数调用图:

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

template<class _tShl >
shared_ptr<Shell> FetchStored ( )
inline

取全局 Shell 句柄。

自从
build 195

在文件 ShellHelper.h127 行定义.

Color GenerateRandomColor ( )
inline
自从
build 360

在文件 ShellHelper.h249 行定义.

参考自 FrmAbout::FrmAbout() , 以及 ShlExplorer::ShlExplorer().

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

template<class _type , class _tHandle >
_type& HandleToReference ( _tHandle  h)
inline

句柄转换:对象引用。

自从
早于 build 132

在文件 ShellHelper.h94 行定义.

参考 ystdex::raw() , 以及 YB_LIKELY.

函数调用图:

bool IsNowShell ( const shared_ptr< Shell > &  hShl)
inline

判断句柄指定的 Shell 是否为当前线程空间中运行的 Shell 。

自从
早于 build 132

在文件 ShellHelper.h149 行定义.

参考 FetchAppInstance().

函数调用图:

template<typename _type >
ValueObject YSLib::MakeValueObjectByPtr ( _type *  p)
inline

使用指针构造 ValueObject 实例。

自从
build 233

在文件 yobject.h383 行定义.

参考自 DeclResource().

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

errno_t NowShellTo ( const shared_ptr< Shell > &  hShl)
inline

向句柄指定的 Shell 对象转移线程控制权。

自从
早于 build 132

在文件 ShellHelper.h159 行定义.

参考 YSLib::Activate().

参考自 NowShellToNew() , 以及 NowShellToStored().

函数调用图:

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

template<class _tShl >
errno_t NowShellToNew ( )
inline

向新建 Shell 对象转移控制权。

自从
早于 build 132

在文件 ShellHelper.h170 行定义.

参考 NowShellTo().

函数调用图:

template<class _tShl >
errno_t NowShellToStored ( )
inline

向全局 Shell 管理器的对象转移控制权。

自从
早于 build 132

在文件 ShellHelper.h181 行定义.

参考 NowShellTo().

函数调用图:

void YSLib::Components::ReleaseFocus ( IWidget &  wgt)
inline

释放焦点,成功后向自身发送 LostFocus 事件。

在文件 yfocus.h93 行定义.

参考 ReleaseFocusFrom().

参考自 Hide(),YSLib::Components::MenuHost::HideRaw() , 以及 ReleaseFocusCascade().

函数调用图:

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

template<class _tShl >
void ReleaseStored ( )
inline

释放全局 Shell 。

自从
build 195

在文件 ShellHelper.h138 行定义.

YF_API void RemoveGlobalTasks ( )

从全局消息队列中移除所有后台消息。

自从
build 320

在文件 ShellHelper.cpp54 行定义.

参考 FetchGlobalInstance().

函数调用图:

void YSLib::Components::RequestFocus ( IWidget &  wgt)
inline

向部件容器释放获得焦点,成功后向自身发送 GotFocus 事件。

在文件 yfocus.h83 行定义.

参考 RequestFocusFrom().

参考自 OnTouchDown_RequestToTopFocused(),RequestFocusCascade(),Show() , 以及 YSLib::Components::MenuHost::ShowRaw().

函数调用图:

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

template<typename _tOut , typename _tGen >
void ScrDraw ( _tOut  buf,
_tGen &&  f 
)

全屏幕描点。

注解
颜色由坐标决定。
自从
build 360

在文件 ShellHelper.h263 行定义.

参考 MainScreenHeight(),MainScreenWidth(),yforward , 以及 yunseq.

参考自 FetchImage().

函数调用图:

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

void SetShellTo ( const shared_ptr< Shell > &  hShl,
Messaging::Priority  p = 0x80 
)
inline

通过主消息队列向指定 Shell 对象转移控制权。

自从
早于 build 132

在文件 ShellHelper.h191 行定义.

参考自 ShlReader::Exit(),SetShellToNew(),SetShellToStored() , 以及 ShlExplorer::ShlExplorer().

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

template<class _tShl >
void SetShellToNew ( )
inline

通过主消息队列向新建 Shell 对象转移控制权。

自从
早于 build 132

在文件 ShellHelper.h204 行定义.

参考 SetShellTo().

函数调用图:

template<class _tShl >
void SetShellToStored ( )
inline

通过主消息队列向全局 Shell 管理器内的对象转移控制权。

自从
早于 build 132

在文件 ShellHelper.h215 行定义.

参考 SetShellTo().

函数调用图:

YF_API const char* TranslateTime ( const std::tm &  ,
const char *  = DefaultTimeFormat 
)

格式化时间字符串。

自从
build 307

在文件 ShellHelper.cpp83 行定义.

参考自 ShlHexBrowser::ShlHexBrowser() , 以及 TranslateTime().

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

YF_API const char* TranslateTime ( const std::time_t &  ,
const char *  = DefaultTimeFormat 
)

在文件 ShellHelper.cpp93 行定义.

参考 TranslateTime() , 以及 YB_UNLIKELY.

函数调用图:

变量说明

YSL_END

Shell 快捷操作。

自从
早于 build 132

在文件 shlds.h160 行定义.