xrtFormEncode
按 application/x-www-form-urlencoded 规则编码字节并写出零结尾文本。
bool xrtFormEncode( const void* pData, size_t iSize, char* sOutput, size_t iCapacity, size_t* pOutputSize );
| 参数 | 说明 |
|---|---|
| const void* pData | 用户数据 |
| size_t iSize | 字节数 |
| char* sOutput | 输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pOutputSize | 出:输出长度 |
返回:按 application/x-www-form-urlencoded 规则编码字节并写出零结尾文本。
示例已编译验证
/* 按 application/x-www-form-urlencoded 规则编码字节并写出零结尾文本。 */ result = xrtFormEncode(pData, iSize, sOutput, iCapacity, pOutputSize);
xrtFormDecode
严格解码 form-urlencoded 字节;加号转换为空格,支持同址收缩。
bool xrtFormDecode( xstrview Text, void* pOutput, size_t iCapacity, size_t* pOutputSize );
| 参数 | 说明 |
|---|---|
| xstrview Text | 文本视图 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pOutputSize | 出:输出长度 |
返回:严格解码 form-urlencoded 字节;加号转换为空格,支持同址收缩。
示例已编译验证
/* 严格解码 form-urlencoded 字节;加号转换为空格,支持同址收缩。 */ result = xrtFormDecode(Text, pOutput, iCapacity, pOutputSize);
xrtFormEncodeNew
分配并返回由 xrtFree 释放的零结尾 form-urlencoded 文本。
str xrtFormEncodeNew( const void* pData, size_t iSize, size_t* pOutputSize );
| 参数 | 说明 |
|---|---|
| const void* pData | 用户数据 |
| size_t iSize | 字节数 |
| size_t* pOutputSize | 出:输出长度 |
返回:分配并返回由 xrtFree 释放的零结尾 form-urlencoded 文本。
示例已编译验证
/* 分配并返回由 xrtFree 释放的零结尾 form-urlencoded 文本。 */ result = xrtFormEncodeNew(pData, iSize, pOutputSize);
xrtFormDecodeNew
分配解码字节;末尾哨兵零不计入必须返回的长度。
bytes xrtFormDecodeNew( xstrview Text, size_t* pOutputSize );
| 参数 | 说明 |
|---|---|
| xstrview Text | 文本视图 |
| size_t* pOutputSize | 出:输出长度 |
返回:分配解码字节;末尾哨兵零不计入必须返回的长度。
示例已编译验证
/* 分配解码字节;末尾哨兵零不计入必须返回的长度。 */ result = xrtFormDecodeNew(Text, pOutputSize);
xrtFormParse
XRT_API bool xrtFormParse( void* pData, size_t iSize, xformfield* pFields, size_t iCapacity, size_t* pCount, const xformlimits* pLimits );
;
返回:XRT_API bool xrtFormParse( void* pData, size_t iSize, xformfield* pFields, size_t iCapacity, size_t* pCount, const xformlimits* pLimits );
示例已编译验证
/* XRT_API bool xrtFormParse( void* pData, size_t iSize, xformfield* pFields, size_t iCapacity, size_t* pCount, const xformlimits* pLimits ); */ result = xrtFormParse();
xrtFormFind
XRT_API xformfind xrtFormFind( xstrview Text, xbytesview Name, size_t* pOffset, void* pValue, size_t iCapacity, size_t* pSize );
;
返回:XRT_API xformfind xrtFormFind( xstrview Text, xbytesview Name, size_t* pOffset, void* pValue, size_t iCapacity, size_t* pSize );
示例已编译验证
/* XRT_API xformfind xrtFormFind( xstrview Text, xbytesview Name, size_t* pOffset, void* pValue, size_t iCapacity, size_t* pSize ); */ result = xrtFormFind();
xrtFormWrite
写出不带零结尾的 form-urlencoded 字段列表;每个字段始终包含等号。
bool xrtFormWrite( const xformfield* pFields, size_t iCount, void* pOutput, size_t iCapacity, size_t* pSize );
| 参数 | 说明 |
|---|---|
| const xformfield* pFields | 字段数组 |
| size_t iCount | 数量 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pSize | 出:大小 |
返回:写出不带零结尾的 form-urlencoded 字段列表;每个字段始终包含等号。
示例已编译验证
/* 写出不带零结尾的 form-urlencoded 字段列表;每个字段始终包含等号。 */ result = xrtFormWrite(pFields, iCount, pOutput, iCapacity, pSize);
xrtFormBuild
分配并构建零结尾 form-urlencoded 字段列表;结果由 xrtFree 释放。
str xrtFormBuild( const xformfield* pFields, size_t iCount, size_t* pSize );
| 参数 | 说明 |
|---|---|
| const xformfield* pFields | 字段数组 |
| size_t iCount | 数量 |
| size_t* pSize | 出:大小 |
返回:分配并构建零结尾 form-urlencoded 字段列表;结果由 xrtFree 释放。
示例已编译验证
/* 分配并构建零结尾 form-urlencoded 字段列表;结果由 xrtFree 释放。 */ result = xrtFormBuild(pFields, iCount, pSize);