fastdo
0.5.12
|
混合体,能表示多种类型的值 更多...
#include <utilities.hpp>
类 | |
class | ArrayAssigner |
class | CollectionAssigner |
class | MixedLess |
Public 类型 | |
enum | MixedType : ushort { MT_NULL, MT_BOOLEAN, MT_BYTE, MT_SHORT, MT_USHORT, MT_INT, MT_UINT, MT_LONG, MT_ULONG, MT_INT64, MT_UINT64, MT_FLOAT, MT_DOUBLE, MT_ANSI, MT_UNICODE, MT_ARRAY, MT_COLLECTION, MT_BINARY } |
typedef std::map< Mixed, Mixed, MixedLess > | MixedMixedMap |
typedef MixedMixedMap::value_type | MixedMixedPair |
Public 成员函数 | |
Mixed () | |
Mixed (AnsiString const &str) | |
多字节字符串 更多... | |
Mixed (UnicodeString const &str) | |
Unicode字符串 更多... | |
Mixed (char const *str, int len=-1) | |
多字节字符串 更多... | |
Mixed (wchar const *str, int len=-1) | |
Unicode字符串 更多... | |
Mixed (bool boolVal) | |
Mixed (byte btVal) | |
Mixed (short shVal) | |
Mixed (ushort ushVal) | |
Mixed (int iVal) | |
Mixed (uint uiVal) | |
Mixed (long lVal) | |
Mixed (ulong ulVal) | |
Mixed (float fltVal) | |
Mixed (int64 i64Val) | |
Mixed (uint64 ui64Val) | |
Mixed (double dblVal) | |
Mixed (Buffer const &buf) | |
Mixed (void *binaryData, uint size, bool isPeek=false) | |
Mixed (Mixed *arr, uint count) | |
数组构造函数 更多... | |
template<typename _Ty > | |
Mixed (std::vector< _Ty > const &arr) | |
template<typename _Ty , uint n> | |
Mixed (_Ty(&arr)[n]) | |
template<typename _KTy , typename _VTy , typename _Pr , typename _Alloc > | |
Mixed (std::map< _KTy, _VTy, _Pr, _Alloc > const &m) | |
Collection构造函数 更多... | |
template<typename _KTy , typename _VTy , uint count> | |
Mixed (std::pair< _KTy, _VTy >(&pairs)[count]) | |
template<typename _KTy , typename _VTy , uint count> | |
Mixed (_KTy(&keys)[count], _VTy(&vals)[count]) | |
~Mixed () | |
析构函数 更多... | |
Mixed (Mixed const &other) | |
拷贝构造函数 更多... | |
Mixed & | operator= (Mixed const &other) |
拷贝赋值操作 更多... | |
Mixed (Mixed &&other) | |
移动构造函数 更多... | |
Mixed & | operator= (Mixed &&other) |
移动赋值操作 更多... | |
Mixed (Buffer &&buf) | |
void | assign (Buffer &&buf) |
Mixed (GrowBuffer &&buf) | |
void | assign (GrowBuffer &&buf) |
void | free () |
释放相关资源 更多... | |
MixedType | type () const |
取得类型 更多... | |
String const & | typeString () const |
取得类型串 更多... | |
operator AnsiString () const | |
operator UnicodeString () const | |
operator Buffer () const | |
operator bool () const | |
operator byte () const | |
operator short () const | |
operator ushort () const | |
operator int () const | |
operator uint () const | |
operator long () const | |
operator ulong () const | |
operator float () const | |
operator int64 () const | |
operator uint64 () const | |
operator double () const | |
AnsiString | toAnsi () const |
UnicodeString | toUnicode () const |
Buffer | toBuffer () const |
bool | toBool () const |
byte | toByte () const |
short | toShort () const |
ushort | toUShort () const |
int | toInt () const |
uint | toUInt () const |
long | toLong () const |
ulong | toULong () const |
float | toFloat () const |
int64 | toInt64 () const |
uint64 | toUInt64 () const |
double | toDouble () const |
bool | operator== (Mixed const &other) const |
bool | operator< (Mixed const &other) const |
bool | operator!= (Mixed const &other) const |
bool | operator> (Mixed const &other) const |
bool | operator>= (Mixed const &other) const |
bool | operator<= (Mixed const &other) const |
bool | isNull () const |
bool | isArray () const |
bool | isCollection () const |
bool | isContainer () const |
bool | isBinary () const |
bool | isNumeric () const |
bool | isInteger () const |
bool | isAnsi () const |
bool | isUnicode () const |
bool | isString () const |
Mixed & | createString () |
创建一个Ansi字符串,并设置type为MT_STRING 更多... | |
Mixed & | createUnicode () |
创建一个Unicode字符串,并设置type为MT_UNICODE 更多... | |
Mixed & | createArray (uint count=0) |
创建一个数组,自动把先前的数据清空,并设置type为MT_ARRAY 更多... | |
Mixed & | createCollection () |
创建一个集合,自动把先前的数据清空,并设置type为MT_COLLECTION 更多... | |
Mixed & | createBuffer (uint size=0) |
创建一个缓冲区,自动把先前的数据清空,并设置type为MT_BINARY 更多... | |
template<typename _Ty > | |
int | getArray (std::vector< _Ty > *arr) const |
取得数组全部元素,必须是MT_ARRAY/MT_COLLECTION类型 更多... | |
template<typename _KTy > | |
int | getKeys (std::vector< _KTy > *keys) const |
获取全部键名,必须是MT_COLLECTION类型 更多... | |
template<typename _KTy , typename _VTy > | |
int | getMap (std::map< _KTy, _VTy > *m) const |
获取映射表,必须是MT_COLLECTION类型 更多... | |
bool | isEmpty () const |
判断容器是否为空 更多... | |
int | getCount () const |
获取Array/Collection元素个数 更多... | |
Mixed & | operator[] (Mixed const &k) |
下标操作 更多... | |
Mixed const & | operator[] (Mixed const &k) const |
const下标操作 更多... | |
template<typename _ChTy > | |
Mixed & | operator[] (_ChTy const *k) |
下标操作 使兼容字符串指针 更多... | |
template<typename _ChTy > | |
Mixed const & | operator[] (_ChTy const *k) const |
const下标操作 使兼容字符串指针 更多... | |
template<typename _Ty > | |
_Ty | get (Mixed const &k) const |
当Mixed为Array或Collection类型时,get()能把指定'索引/Key'的元素按照指定类型取出来 更多... | |
MixedMixedMap::value_type & | getPair (int i) |
Collection获取'键值对'索引操作 更多... | |
MixedMixedMap::value_type const & | getPair (int i) const |
Collection获取'键值对'索引操作 更多... | |
CollectionAssigner | addPair () |
往Collection添加数据. 更多... | |
Mixed & | addPair (Mixed const &k, Mixed const &v) |
往Collection添加一个pair. 非Collection类型调用此函数会抛异常. 更多... | |
ArrayAssigner | add () |
往Array添加数据. 更多... | |
int | add (Mixed const &v) |
往数组里加一个元素,返回索引值,非Array类型调用此函数会抛异常 更多... | |
int | addUnique (Mixed const &v) |
往数组里加一个唯一元素,返回索引值,非Array类型调用此函数会抛异常 更多... | |
void | del (Mixed const &k) |
删除一个元素,操作类型可以是Array或Collection,k分别代表索引或键名 更多... | |
bool | has (Mixed const &ek) const |
判断元素是否存在,Array判断值是否存在,Collection判断键名是否存在 更多... | |
Mixed & | merge (Mixed const &v) |
合并另一个容器或添加一个元素 更多... | |
void | alloc (uint size) |
分配一块内存,自动释放先前数据,并设置type为MT_BINARY 更多... | |
bool | peekCopy (bool copyCapacity=false) |
把窥探模式下的MT_BINARY类型变为拷贝模式,如果copyCapacity为true时连容量也一起拷贝,否则只拷贝数据。 更多... | |
int | getSize () const |
取得缓冲区大小 更多... | |
void * | getBuf () const |
暴露缓冲区指针 更多... | |
void | assign (char const *str, int len=-1) |
void | assign (wchar const *str, int len=-1) |
void | assign (bool boolVal) |
void | assign (byte btVal) |
void | assign (short shVal) |
void | assign (ushort ushVal) |
void | assign (int iVal) |
void | assign (uint uiVal) |
void | assign (long lVal) |
void | assign (ulong ulVal) |
void | assign (float fltVal) |
void | assign (int64 i64Val) |
void | assign (uint64 ui64Val) |
void | assign (double dblVal) |
void | assign (Buffer const &buf) |
void | assign (void *binaryData, uint size, bool isPeek=false) |
二进制数据赋值 更多... | |
void | assign (Mixed *arr, uint count) |
数组赋值 更多... | |
template<typename _Ty > | |
void | assign (std::vector< _Ty > const &arr) |
template<typename _Ty , uint n> | |
void | assign (_Ty(&arr)[n]) |
template<typename _KTy , typename _VTy , typename _Pr , typename _Alloc > | |
void | assign (std::map< _KTy, _VTy, _Pr, _Alloc > const &m) |
用map给Collection赋值 更多... | |
template<typename _KTy , typename _VTy , uint count> | |
void | assign (std::pair< _KTy, _VTy >(&pairs)[count]) |
用pairs给Collection赋值 更多... | |
template<typename _KTy , typename _VTy , uint count> | |
void | assign (_KTy(&keys)[count], _VTy(&vals)[count]) |
用数组给Collection赋值 更多... | |
String | json () const |
String | myJson () const |
Mixed & | json (String const &jsonStr) |
静态 Public 成员函数 | |
static String const & | TypeString (MixedType type) |
输出指定类型的字符串表示 更多... | |
static bool | ParseBool (AnsiString const &str, bool *boolVal) |
parse bool 更多... | |
static bool | ParseBool (UnicodeString const &str, bool *boolVal) |
static bool | ParseULong (AnsiString const &str, ulong *ulVal) |
parse ulong 更多... | |
static bool | ParseULong (UnicodeString const &str, ulong *ulVal) |
static bool | ParseDouble (AnsiString const &str, double *dblVal) |
parse double 更多... | |
static bool | ParseDouble (UnicodeString const &str, double *dblVal) |
static bool | ParseUInt64 (AnsiString const &str, uint64 *ui64Val) |
parse uint64 更多... | |
static bool | ParseUInt64 (UnicodeString const &str, uint64 *ui64Val) |
static Mixed & | ParseJson (AnsiString const &str, Mixed *val) |
parse array or collection, it parse a json 更多... | |
Public 属性 | |
MixedType | _type |
union { | |
double _dblVal | |
uint64 _ui64Val | |
int64 _i64Val | |
float _fltVal | |
ulong _ulVal | |
long _lVal | |
uint _uiVal | |
int _iVal | |
ushort _ushVal | |
short _shVal | |
byte _btVal | |
bool _boolVal | |
struct { | |
union { | |
AnsiString * _pStr | |
UnicodeString * _pWStr | |
} | |
} | |
struct { | |
MixedArray * _pArr | |
MixedMixedMap * _pMap | |
} | |
struct { | |
Buffer * _pBuf | |
} | |
}; | |
混合体,能表示多种类型的值
在文件 utilities.hpp 第 586 行定义.
typedef std::map< Mixed, Mixed, MixedLess > winux::Mixed::MixedMixedMap |
在文件 utilities.hpp 第 618 行定义.
typedef MixedMixedMap::value_type winux::Mixed::MixedMixedPair |
在文件 utilities.hpp 第 619 行定义.
enum winux::Mixed::MixedType : ushort |
枚举值 | |
---|---|
MT_NULL | |
MT_BOOLEAN | |
MT_BYTE | |
MT_SHORT | |
MT_USHORT | |
MT_INT | |
MT_UINT | |
MT_LONG | |
MT_ULONG | |
MT_INT64 | |
MT_UINT64 | |
MT_FLOAT | |
MT_DOUBLE | |
MT_ANSI | |
MT_UNICODE | |
MT_ARRAY |
数组类型,利用STL vector<Mixed>存储的Mixed数组 |
MT_COLLECTION |
Collection类型,利用数组存储key体现次序,然后用Map存储k/v对 |
MT_BINARY |
二进制数据类型,利用Buffer类对象存储的二进制数据 |
在文件 utilities.hpp 第 589 行定义.
winux::Mixed::Mixed | ( | ) |
winux::Mixed::Mixed | ( | AnsiString const & | str | ) |
多字节字符串
winux::Mixed::Mixed | ( | UnicodeString const & | str | ) |
Unicode字符串
winux::Mixed::Mixed | ( | char const * | str, |
int | len = -1 |
||
) |
多字节字符串
winux::Mixed::Mixed | ( | wchar const * | str, |
int | len = -1 |
||
) |
Unicode字符串
winux::Mixed::Mixed | ( | bool | boolVal | ) |
winux::Mixed::Mixed | ( | byte | btVal | ) |
winux::Mixed::Mixed | ( | short | shVal | ) |
winux::Mixed::Mixed | ( | ushort | ushVal | ) |
winux::Mixed::Mixed | ( | int | iVal | ) |
winux::Mixed::Mixed | ( | uint | uiVal | ) |
winux::Mixed::Mixed | ( | long | lVal | ) |
winux::Mixed::Mixed | ( | ulong | ulVal | ) |
winux::Mixed::Mixed | ( | float | fltVal | ) |
winux::Mixed::Mixed | ( | int64 | i64Val | ) |
winux::Mixed::Mixed | ( | uint64 | ui64Val | ) |
winux::Mixed::Mixed | ( | double | dblVal | ) |
winux::Mixed::Mixed | ( | Buffer const & | buf | ) |
winux::Mixed::Mixed | ( | void * | binaryData, |
uint | size, | ||
bool | isPeek = false |
||
) |
|
inline |
在文件 utilities.hpp 第 684 行定义.
|
inline |
在文件 utilities.hpp 第 698 行定义.
|
inline |
Collection构造函数
在文件 utilities.hpp 第 713 行定义.
|
inline |
在文件 utilities.hpp 第 721 行定义.
|
inline |
在文件 utilities.hpp 第 728 行定义.
winux::Mixed::~Mixed | ( | ) |
析构函数
winux::Mixed::Mixed | ( | Mixed const & | other | ) |
拷贝构造函数
winux::Mixed::Mixed | ( | Mixed && | other | ) |
移动构造函数
winux::Mixed::Mixed | ( | Buffer && | buf | ) |
winux::Mixed::Mixed | ( | GrowBuffer && | buf | ) |
ArrayAssigner winux::Mixed::add | ( | ) |
往Array添加数据.
如果不是Array,则自动释放之前数据,创建Array.
int winux::Mixed::add | ( | Mixed const & | v | ) |
往数组里加一个元素,返回索引值,非Array类型调用此函数会抛异常
CollectionAssigner winux::Mixed::addPair | ( | ) |
往Collection添加数据.
如果不是Collection,则自动释放之前数据,创建Collection.
往Collection添加一个pair. 非Collection类型调用此函数会抛异常.
int winux::Mixed::addUnique | ( | Mixed const & | v | ) |
往数组里加一个唯一元素,返回索引值,非Array类型调用此函数会抛异常
void winux::Mixed::alloc | ( | uint | size | ) |
分配一块内存,自动释放先前数据,并设置type为MT_BINARY
void winux::Mixed::assign | ( | Buffer && | buf | ) |
void winux::Mixed::assign | ( | GrowBuffer && | buf | ) |
void winux::Mixed::assign | ( | char const * | str, |
int | len = -1 |
||
) |
void winux::Mixed::assign | ( | wchar const * | str, |
int | len = -1 |
||
) |
void winux::Mixed::assign | ( | bool | boolVal | ) |
void winux::Mixed::assign | ( | byte | btVal | ) |
void winux::Mixed::assign | ( | short | shVal | ) |
void winux::Mixed::assign | ( | ushort | ushVal | ) |
void winux::Mixed::assign | ( | int | iVal | ) |
void winux::Mixed::assign | ( | uint | uiVal | ) |
void winux::Mixed::assign | ( | long | lVal | ) |
void winux::Mixed::assign | ( | ulong | ulVal | ) |
void winux::Mixed::assign | ( | float | fltVal | ) |
void winux::Mixed::assign | ( | int64 | i64Val | ) |
void winux::Mixed::assign | ( | uint64 | ui64Val | ) |
void winux::Mixed::assign | ( | double | dblVal | ) |
void winux::Mixed::assign | ( | Buffer const & | buf | ) |
void winux::Mixed::assign | ( | void * | binaryData, |
uint | size, | ||
bool | isPeek = false |
||
) |
二进制数据赋值
|
inline |
在文件 utilities.hpp 第 982 行定义.
|
inline |
在文件 utilities.hpp 第 996 行定义.
|
inline |
用map给Collection赋值
在文件 utilities.hpp 第 1011 行定义.
|
inline |
用pairs给Collection赋值
在文件 utilities.hpp 第 1029 行定义.
|
inline |
Mixed& winux::Mixed::createCollection | ( | ) |
创建一个集合,自动把先前的数据清空,并设置type为MT_COLLECTION
Mixed& winux::Mixed::createString | ( | ) |
创建一个Ansi字符串,并设置type为MT_STRING
Mixed& winux::Mixed::createUnicode | ( | ) |
创建一个Unicode字符串,并设置type为MT_UNICODE
void winux::Mixed::del | ( | Mixed const & | k | ) |
删除一个元素,操作类型可以是Array或Collection,k分别代表索引或键名
void winux::Mixed::free | ( | ) |
释放相关资源
|
inline |
当Mixed为Array或Collection类型时,get()能把指定'索引/Key'的元素按照指定类型取出来
在文件 utilities.hpp 第 889 行定义.
|
inline |
取得数组全部元素,必须是MT_ARRAY/MT_COLLECTION类型
在文件 utilities.hpp 第 837 行定义.
void* winux::Mixed::getBuf | ( | ) | const |
暴露缓冲区指针
int winux::Mixed::getCount | ( | ) | const |
获取Array/Collection元素个数
即使Mixed不是Array/Collection类型也不会报错,此时会返回0。
|
inline |
获取全部键名,必须是MT_COLLECTION类型
在文件 utilities.hpp 第 848 行定义.
|
inline |
获取映射表,必须是MT_COLLECTION类型
在文件 utilities.hpp 第 859 行定义.
MixedMixedMap::value_type& winux::Mixed::getPair | ( | int | i | ) |
Collection获取'键值对'索引操作
MixedMixedMap::value_type const& winux::Mixed::getPair | ( | int | i | ) | const |
Collection获取'键值对'索引操作
int winux::Mixed::getSize | ( | ) | const |
取得缓冲区大小
bool winux::Mixed::has | ( | Mixed const & | ek | ) | const |
判断元素是否存在,Array判断值是否存在,Collection判断键名是否存在
即使Mixed不是Array/Collection类型也不会报错,此时会返回false。
|
inline |
在文件 utilities.hpp 第 817 行定义.
|
inline |
在文件 utilities.hpp 第 811 行定义.
|
inline |
在文件 utilities.hpp 第 814 行定义.
|
inline |
在文件 utilities.hpp 第 812 行定义.
|
inline |
在文件 utilities.hpp 第 813 行定义.
|
inline |
判断容器是否为空
在文件 utilities.hpp 第 869 行定义.
|
inline |
在文件 utilities.hpp 第 816 行定义.
|
inline |
在文件 utilities.hpp 第 810 行定义.
|
inline |
在文件 utilities.hpp 第 815 行定义.
|
inline |
在文件 utilities.hpp 第 819 行定义.
|
inline |
在文件 utilities.hpp 第 818 行定义.
String winux::Mixed::json | ( | ) | const |
String winux::Mixed::myJson | ( | ) | const |
winux::Mixed::operator AnsiString | ( | ) | const |
winux::Mixed::operator bool | ( | ) | const |
winux::Mixed::operator Buffer | ( | ) | const |
winux::Mixed::operator byte | ( | ) | const |
winux::Mixed::operator double | ( | ) | const |
winux::Mixed::operator float | ( | ) | const |
winux::Mixed::operator int | ( | ) | const |
winux::Mixed::operator int64 | ( | ) | const |
winux::Mixed::operator long | ( | ) | const |
winux::Mixed::operator short | ( | ) | const |
winux::Mixed::operator uint | ( | ) | const |
winux::Mixed::operator uint64 | ( | ) | const |
winux::Mixed::operator ulong | ( | ) | const |
winux::Mixed::operator UnicodeString | ( | ) | const |
winux::Mixed::operator ushort | ( | ) | const |
|
inline |
在文件 utilities.hpp 第 804 行定义.
bool winux::Mixed::operator< | ( | Mixed const & | other | ) | const |
|
inline |
在文件 utilities.hpp 第 807 行定义.
bool winux::Mixed::operator== | ( | Mixed const & | other | ) | const |
|
inline |
在文件 utilities.hpp 第 805 行定义.
|
inline |
在文件 utilities.hpp 第 806 行定义.
|
inline |
下标操作 使兼容字符串指针
在文件 utilities.hpp 第 882 行定义.
|
inline |
const下标操作 使兼容字符串指针
在文件 utilities.hpp 第 885 行定义.
|
static |
parse bool
|
static |
|
static |
parse double
|
static |
|
static |
parse array or collection, it parse a json
|
static |
parse uint64
|
static |
|
static |
parse ulong
|
static |
bool winux::Mixed::peekCopy | ( | bool | copyCapacity = false | ) |
把窥探模式下的MT_BINARY类型变为拷贝模式,如果copyCapacity为true时连容量也一起拷贝,否则只拷贝数据。
|
inline |
在文件 utilities.hpp 第 785 行定义.
|
inline |
在文件 utilities.hpp 第 788 行定义.
|
inline |
在文件 utilities.hpp 第 787 行定义.
|
inline |
在文件 utilities.hpp 第 789 行定义.
|
inline |
在文件 utilities.hpp 第 799 行定义.
|
inline |
在文件 utilities.hpp 第 796 行定义.
|
inline |
在文件 utilities.hpp 第 792 行定义.
|
inline |
在文件 utilities.hpp 第 797 行定义.
|
inline |
在文件 utilities.hpp 第 794 行定义.
|
inline |
在文件 utilities.hpp 第 790 行定义.
|
inline |
在文件 utilities.hpp 第 793 行定义.
|
inline |
在文件 utilities.hpp 第 798 行定义.
|
inline |
在文件 utilities.hpp 第 795 行定义.
|
inline |
在文件 utilities.hpp 第 786 行定义.
|
inline |
在文件 utilities.hpp 第 791 行定义.
|
inline |
取得类型
在文件 utilities.hpp 第 761 行定义.
|
inline |
取得类型串
在文件 utilities.hpp 第 763 行定义.
union { ... } |
bool winux::Mixed::_boolVal |
在文件 utilities.hpp 第 636 行定义.
byte winux::Mixed::_btVal |
在文件 utilities.hpp 第 635 行定义.
double winux::Mixed::_dblVal |
在文件 utilities.hpp 第 625 行定义.
float winux::Mixed::_fltVal |
在文件 utilities.hpp 第 628 行定义.
int64 winux::Mixed::_i64Val |
在文件 utilities.hpp 第 627 行定义.
int winux::Mixed::_iVal |
在文件 utilities.hpp 第 632 行定义.
long winux::Mixed::_lVal |
在文件 utilities.hpp 第 630 行定义.
MixedArray* winux::Mixed::_pArr |
在文件 utilities.hpp 第 647 行定义.
Buffer* winux::Mixed::_pBuf |
在文件 utilities.hpp 第 652 行定义.
MixedMixedMap* winux::Mixed::_pMap |
在文件 utilities.hpp 第 648 行定义.
AnsiString* winux::Mixed::_pStr |
在文件 utilities.hpp 第 641 行定义.
UnicodeString* winux::Mixed::_pWStr |
在文件 utilities.hpp 第 642 行定义.
short winux::Mixed::_shVal |
在文件 utilities.hpp 第 634 行定义.
MixedType winux::Mixed::_type |
在文件 utilities.hpp 第 621 行定义.
uint64 winux::Mixed::_ui64Val |
在文件 utilities.hpp 第 626 行定义.
uint winux::Mixed::_uiVal |
在文件 utilities.hpp 第 631 行定义.
ulong winux::Mixed::_ulVal |
在文件 utilities.hpp 第 629 行定义.
ushort winux::Mixed::_ushVal |
在文件 utilities.hpp 第 633 行定义.