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

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

#include <yobject.h>

YSLib::ValueObject 的协作图:

Public 成员函数

 DefDeCtor (ValueObject) template< typename _type
 无参数构造。 更多...
 
 yimpl (typename=ystdex::exclude_self_ctor_t< ValueObject, _type >)> ValueObject(_type &&obj)
 
template<typename _type >
 ValueObject (_type *p, PointerTag)
 构造:使用对象指针。 更多...
 
template<typename _type >
 ValueObject (unique_ptr< _type > &&p, PointerTag)
 构造:使用对象 unique_ptr 指针。 更多...
 
 DefDeCopyCtor (ValueObject) DefDeMoveCtor(ValueObject) DefDeDtor(ValueObject) DefDeCopyAssignment(ValueObject) DefDeMoveAssignment(ValueObject) PDefHOp(bool
 复制构造:默认实现。 更多...
 
const ynothrow ImplRet (!content) bool operator
 
return * static_cast (content.get())
 
template<typename _type >
_type & GetObject ()
 
template<typename _type >
const _type & GetObject () const
 
 DefGetter (const ynothrow, const std::type_info &, Type, content.type()) template< typename _type > inline _type &Access()
 访问指定类型对象。

异常
std::bad_cast空实例或类型检查失败 。
更多...
 
template<typename _type >
const _type & Access () const
 
 PDefH (void, Clear,) ynothrow ImplBodyMem(content
 
 PDefH (void, swap, ValueObject &vo) ynothrow ImplBodyMem(content
 交换。 更多...
 
template<typename _type >
_type * AccessPtr () ynothrow
 访问指定类型对象指针。 更多...
 
template<typename _type >
const _type * AccessPtr () const ynothrow
 

Public 属性

ystdex::any content
 
 clear
 
 swap
 

相关函数

(请注意: 这些不是成员函数.)

#define DefSwap(_q, _t)
 依赖项类模板。 更多...
 

详细描述

值类型对象类。

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

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

在文件 yobject.h281 行定义.

构造及析构函数说明

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

构造:使用对象指针。

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

在文件 yobject.h312 行定义.

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

构造:使用对象 unique_ptr 指针。

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

在文件 yobject.h323 行定义.

成员函数说明

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

在文件 yobject.h413 行定义.

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

访问指定类型对象指针。

自从
build 398

在文件 yobject.h426 行定义.

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

在文件 yobject.h432 行定义.

YSLib::ValueObject::DefDeCopyCtor ( ValueObject  )

复制构造:默认实现。

自从
build 332

转移构造:默认实现。

自从
build 332

析构:默认实现。

自从
build 332
build 332

判断是否为空。

自从
build 320
YSLib::ValueObject::DefDeCtor ( ValueObject  )

无参数构造。

注解
得到空实例。
自从
build 296

构造:使用对象引用。

前置条件
obj 可作为转移构造参数。
自从
build 448
YSLib::ValueObject::DefGetter ( const ynothrow  ,
const std::type_info &  ,
Type  ,
content.  type() 
)
inline

访问指定类型对象。

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

自从
build 340
build 334

在文件 yobject.h397 行定义.

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

在文件 yobject.h386 行定义.

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

在文件 yobject.h392 行定义.

const ynothrow YSLib::ValueObject::ImplRet ( content)
YSLib::ValueObject::PDefH ( void  ,
Clear   
)
YSLib::ValueObject::PDefH ( void  ,
swap  ,
ValueObject vo 
)

交换。

自从
build 409
return* YSLib::ValueObject::static_cast ( content.  get())
YSLib::ValueObject::yimpl ( typename  = ystdex::exclude_self_ctor_t<ValueObject, _type>)
inline

在文件 yobject.h300 行定义.

友元及相关函数文档

#define DefSwap (   ynothrow,
  ValueObject 
)
related
值:
PDefH(void, swap, _t& _x, _t& _y) _q \
ImplExpr(_x.swap(_y))

依赖项类模板。

自从
build 409

基于被依赖的默认对象,可通过写时复制策略创建新对象;可能为空。

模板参数
_type被依赖的对象类型,需能被无参数构造。
_tOwnerPointer依赖所有者指针类型。
警告
依赖所有者指针需要实现所有权语义, 否则出现无法释放资源导致内存泄漏或其它非预期行为。
自从
build 195
待办事项:
线程模型及安全性。

类成员变量说明

YSLib::ValueObject::clear

在文件 yobject.h444 行定义.

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

在文件 yobject.h285 行定义.

YSLib::ValueObject::swap

在文件 yobject.h451 行定义.


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