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

值类型对象类。 更多...

#include <yobject.h>

YSLib::ValueObject 的协作图:

Public 成员函数

 ValueObject ()=default
 无参数构造。
 
template<typename _type , typename = typename std::enable_if<!std::is_same<_type&, ValueObject&>::value, int>::type>
 ValueObject (_type &&obj)
 构造:使用对象引用。
 
template<typename _type >
 ValueObject (_type *p, PointerTag)
 构造:使用对象指针。
 
 ValueObject (const ValueObject &)=default
 复制构造:默认实现。
 
 ValueObject (ValueObject &&)=default
 转移构造:默认实现。
 
 ~ValueObject ()=default
 析构:默认实现。
 
bool operator! () const ynothrow
 判断是否为空。
 
bool operator== (const ValueObject &) const
 
 operator bool () const ynothrow
 判断是否非空。
 
template<typename _type >
_type & GetObject ()
 
template<typename _type >
const _type & GetObject () const
 
const std::type_info & GetType () const ynothrow
 
void Clear () ynothrow
 
void Swap (ValueObject &vo) ynothrow
 交换。
 
ValueObjectoperator= (const ValueObject &)=default
 
ValueObjectoperator= (ValueObject &&)=default
 
template<typename _type >
_type & Access ()
 访问指定类型对象。

异常
std::bad_cast空实例或类型检查失败 。

 
template<typename _type >
const _type & Access () const
 
template<typename _type >
_type * AccessPtr () ynothrow
 访问指定类型对象指针。
 
template<typename _type >
const _type * AccessPtr () const ynothrow
 

Public 属性

ystdex::any content
 

Private 成员函数

template<typename _type >
_type & GetMutableObject () const
 取指定类型的对象。
 

详细描述

值类型对象类。

前置条件
满足 CopyConstructible 。
警告
非虚析构。
若修改子节点的 name 则行为未定义。
自从
build 217

具有值语义和深复制语义的对象。

在文件 yobject.h231 行定义.

构造及析构函数说明

YSLib::ValueObject::ValueObject ( )
default

无参数构造。

注解
得到空实例。
自从
build 296
template<typename _type , typename = typename std::enable_if<!std::is_same<_type&, ValueObject&>::value, int>::type>
YSLib::ValueObject::ValueObject ( _type &&  obj)
inline

构造:使用对象引用。

前置条件
obj 可作为转移构造参数。
自从
build 376

在文件 yobject.h251 行定义.

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

构造:使用对象指针。

注解
得到包含指针指向的指定对象的实例,并获得所有权。
使用 PointerHolder 管理资源(默认使用不限定作用域的 delete 释放资源)。
自从
build 340

在文件 yobject.h262 行定义.

YSLib::ValueObject::ValueObject ( const ValueObject )
default

复制构造:默认实现。

自从
build 332
YSLib::ValueObject::ValueObject ( ValueObject &&  )
default

转移构造:默认实现。

自从
build 332
YSLib::ValueObject::~ValueObject ( )
default

析构:默认实现。

自从
build 332

成员函数说明

template<typename _type >
_type& YSLib::ValueObject::Access ( )
inline

访问指定类型对象。

异常
std::bad_cast空实例或类型检查失败 。

自从
build 334

在文件 yobject.h345 行定义.

参考 ystdex::any_cast().

参考自 YSLib::Access().

函数调用图:

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

template<typename _type >
const _type& YSLib::ValueObject::Access ( ) const
inline

在文件 yobject.h351 行定义.

参考 ystdex::any_cast().

函数调用图:

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

访问指定类型对象指针。

自从
build 398

在文件 yobject.h364 行定义.

参考 ystdex::any_cast().

参考自 YSLib::AccessPtr().

函数调用图:

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

template<typename _type >
const _type* YSLib::ValueObject::AccessPtr ( ) const
inline

在文件 yobject.h370 行定义.

参考 ystdex::any_cast().

函数调用图:

void YSLib::ValueObject::Clear ( )
inline

在文件 yobject.h381 行定义.

template<typename _type >
_type& YSLib::ValueObject::GetMutableObject ( ) const
inlineprivate

取指定类型的对象。

模板参数
_type指定类型。
前置条件
断言: bool(content) && content.type() == typeid(_type) 。
自从
build 337

在文件 yobject.h313 行定义.

参考 YAssert.

template<typename _type >
_type& YSLib::ValueObject::GetObject ( )
inline

在文件 yobject.h324 行定义.

template<typename _type >
const _type& YSLib::ValueObject::GetObject ( ) const
inline

在文件 yobject.h330 行定义.

const std::type_info& YSLib::ValueObject::GetType ( ) const
inline
自从
build 340

在文件 yobject.h335 行定义.

YSLib::ValueObject::operator bool ( ) const
inlineexplicit

判断是否非空。

自从
build 320

在文件 yobject.h302 行定义.

bool YSLib::ValueObject::operator! ( ) const
inline

判断是否为空。

自从
build 320

在文件 yobject.h292 行定义.

ValueObject& YSLib::ValueObject::operator= ( const ValueObject )
default
自从
build 332
ValueObject& YSLib::ValueObject::operator= ( ValueObject &&  )
default
YSL_BEGIN bool ValueObject::operator== ( const ValueObject vo) const

在文件 yobject.cpp33 行定义.

参考 content , 以及 ystdex::any::get_holder().

函数调用图:

void YSLib::ValueObject::Swap ( ValueObject vo)
inline

交换。

自从
build 296

在文件 yobject.h388 行定义.

类成员变量说明

ystdex::any YSLib::ValueObject::content
自从
build 332

在文件 yobject.h235 行定义.

参考自 operator==().


该类的文档由以下文件生成: