2014-11-19 00:25:21 +08:00
|
|
|
|
#ifndef ACL_VSTRING_INCLUDE_H
|
|
|
|
|
#define ACL_VSTRING_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "acl_define.h"
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include "acl_vbuf.h"
|
2015-06-19 16:08:17 +08:00
|
|
|
|
#include "acl_dbuf_pool.h"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include "acl_slice.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD> ACL_VBUF<EFBFBD><EFBFBD>ACL_VSTRING <EFBFBD>ṹ<EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
typedef struct ACL_VSTRING {
|
2016-02-05 10:10:24 +08:00
|
|
|
|
ACL_VBUF vbuf;
|
|
|
|
|
ssize_t maxlen;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
ACL_SLICE_POOL *slice;
|
2016-02-05 10:10:24 +08:00
|
|
|
|
ACL_DBUF_POOL *dbuf;
|
|
|
|
|
ACL_FILE_HANDLE fd;
|
2016-02-25 19:57:02 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
|
ACL_FILE_HANDLE hmap;
|
|
|
|
|
#endif
|
2014-11-19 00:25:21 +08:00
|
|
|
|
} ACL_VSTRING;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD>ṹ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>ȱʡ<EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING str <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>䷽ʽ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ҫ<EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>ʼ<EFBFBD><EFBFBD>,
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_vstring_free_buf <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>ɸú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD>ʼʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_vstring_init(ACL_VSTRING *vp, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_vstring_init <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷŻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_vstring_free_buf(ACL_VSTRING *vp);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD>ʼʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_alloc(size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>
|
|
|
|
|
* ͬʱָ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ż<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param slice {ACL_SLICE_POOL*} <EFBFBD><EFBFBD>Ƭ<EFBFBD>ڴ<EFBFBD><EFBFBD>ع<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD>ʼʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-06-19 16:08:17 +08:00
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_slice_alloc(ACL_SLICE_POOL *slice, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>
|
|
|
|
|
* ͬʱָ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ż<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param slice {ACL_SLICE_POOL*} <EFBFBD><EFBFBD>Ƭ<EFBFBD>ڴ<EFBFBD><EFBFBD>ع<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD>ʼʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_dbuf_alloc(ACL_DBUF_POOL *dbuf, size_t len);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2016-02-05 10:10:24 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_FILE_HANDLE} <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param max_len {ssize_t} <EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param init_len {ssize_t} <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD>´<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_mmap_alloc(ACL_FILE_HANDLE fd,
|
|
|
|
|
ssize_t max_len, ssize_t init_len);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, Ŀǰ<EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD>ܻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param ... <EFBFBD><EFBFBD> ACL_VSTRING_CTL_XXX <EFBFBD><EFBFBD>ʾ<EFBFBD>Ŀ<EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־Ϊ
|
|
|
|
|
* ACL_VSTRING_CTL_END
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_vstring_ctl(ACL_VSTRING *vp,...);
|
|
|
|
|
|
|
|
|
|
#define ACL_VSTRING_CTL_MAXLEN 1
|
|
|
|
|
#define ACL_VSTRING_CTL_END 0
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽض<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>ͬʱ<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '\0' <EFBFBD><EFBFBD>β
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param len {size_t} <EFBFBD>ض̺<EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_truncate(ACL_VSTRING *vp, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD> acl_vstring_alloc <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
*/
|
2015-06-19 16:08:17 +08:00
|
|
|
|
ACL_API void acl_vstring_free(ACL_VSTRING *vp);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param src {const char*} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_strcpy(ACL_VSTRING *vp, const char *src);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD>涨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param src {const char*} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} <EFBFBD>涨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_strncpy(ACL_VSTRING *vp,
|
|
|
|
|
const char *src, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param src {const char*} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_strcat(ACL_VSTRING *vp, const char *src);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD>涨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param src {const char*} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} <EFBFBD>涨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_strncat(ACL_VSTRING *vp,
|
|
|
|
|
const char *src, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ͬʱ<EFBFBD><EFBFBD>֤Ŀ<EFBFBD>껺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD><EFBFBD> '\0'
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param src {const char*} Դ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ
|
|
|
|
|
* @param len {size_t} Դ<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_memcpy(ACL_VSTRING *vp,
|
|
|
|
|
const char *src, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ƶ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ͬһ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַβ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> '\0' <EFBFBD><EFBFBD>β
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param src {const char*} Դ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ
|
|
|
|
|
* @param len {size_t} Դ<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_memmove(ACL_VSTRING *vp,
|
|
|
|
|
const char *src, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤Ŀ<EFBFBD>껺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '\0' <EFBFBD><EFBFBD>β
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param src {const char*} Դ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ
|
|
|
|
|
* @param len {size_t} Դ<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_memcat(ACL_VSTRING *vp,
|
|
|
|
|
const char *src, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param ch {int} Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
* @return {char*} Ŀ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õĵ<EFBFBD>ַ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>鵽<EFBFBD><EFBFBD> NULL,
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD>ص<EFBFBD>ַ<EFBFBD>Dz<EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷŵģ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳһ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API char *acl_vstring_memchr(ACL_VSTRING *vp, int ch);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сд<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param needle {const char*} Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
* @return {char*} Ŀ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õĵ<EFBFBD>ַ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>鵽<EFBFBD><EFBFBD> NULL,
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD>ص<EFBFBD>ַ<EFBFBD>Dz<EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷŵģ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳһ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API char *acl_vstring_strstr(ACL_VSTRING *vp, const char *needle);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сд
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param needle {const char*} Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
* @return {char*} Ŀ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õĵ<EFBFBD>ַ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>鵽<EFBFBD><EFBFBD> NULL,
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD>ص<EFBFBD>ַ<EFBFBD>Dz<EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷŵģ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳһ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API char *acl_vstring_strcasestr(ACL_VSTRING *vp, const char *needle);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>Ӻ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сд<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param needle {const char*} Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
* @return {char*} Ŀ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õĵ<EFBFBD>ַ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>鵽<EFBFBD><EFBFBD> NULL,
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD>ص<EFBFBD>ַ<EFBFBD>Dz<EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷŵģ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳһ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API char *acl_vstring_rstrstr(ACL_VSTRING *vp, const char *needle);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>Ӻ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сд<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param needle {const char*} Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
* @return {char*} Ŀ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õĵ<EFBFBD>ַ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>鵽<EFBFBD><EFBFBD> NULL,
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD>ص<EFBFBD>ַ<EFBFBD>Dz<EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷŵģ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳһ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API char *acl_vstring_rstrcasestr(ACL_VSTRING *vp, const char *needle);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>λ<EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ͬʱ<EFBFBD><EFBFBD>֤Ŀ<EFBFBD>껺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '\0' <EFBFBD><EFBFBD>β
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param start {size_t} ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {const char*} <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ
|
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_insert(ACL_VSTRING *vp, size_t start,
|
|
|
|
|
const char *buf, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ͬʱ<EFBFBD><EFBFBD>֤Ŀ<EFBFBD>껺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '\0' <EFBFBD><EFBFBD>β
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param buf {const char*} <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ
|
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_prepend(ACL_VSTRING *vp,
|
|
|
|
|
const char *buf, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param format {const char*} <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param ... <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *ACL_PRINTF(2, 3) acl_vstring_sprintf(ACL_VSTRING *vp,
|
|
|
|
|
const char *format,...);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>Ը<EFBFBD><EFBFBD>ӷ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param format {const char*} <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param ... <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *ACL_PRINTF(2, 3) acl_vstring_sprintf_append(
|
|
|
|
|
ACL_VSTRING *vp, const char *format,...);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷţ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* acl_myfree <EFBFBD><EFBFBD><EFBFBD>ͷŷ<EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @return {char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ϊ NULL ʱ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* acl_myfree <EFBFBD><EFBFBD><EFBFBD>ͷŸõ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©
|
|
|
|
|
*/
|
|
|
|
|
ACL_API char *acl_vstring_export(ACL_VSTRING *vp);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>Ĵ洢<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param str {char*} <EFBFBD>ⲿ<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ洢<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_import(char *str);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING ճ<EFBFBD><EFBFBD>
|
|
|
|
|
* ע<EFBFBD><EFBFBD>vp <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><EFBFBD><EFBFBD> acl_vstring_alloc <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD> acl_vstring_init
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>, vp <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_mymalloc <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ջ<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ACL_VSTRING v<EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_mymalloc <EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* acl_mymalloc <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>ʱӦ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD> acl_myfree <EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} buf <EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_vstring_glue(ACL_VSTRING *vp, void *buf, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ȡ<EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param len {size_t} λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵԽ<EFBFBD>磬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD> fatal
|
|
|
|
|
* @return {char} <EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API char acl_vstring_charat(ACL_VSTRING *vp, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>涨<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param format {const char*}
|
|
|
|
|
* @param ap {va_list}
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
* @see acl_vstring_sprintf
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_vsprintf(ACL_VSTRING *vp,
|
|
|
|
|
const char *format, va_list ap);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>涨<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param format {const char*}
|
|
|
|
|
* @param ap {va_list}
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *acl_vstring_vsprintf_append(ACL_VSTRING *vp,
|
|
|
|
|
const char *format, va_list ap);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>涨<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param format {const char*}
|
|
|
|
|
* @param ... <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_VSTRING*} <EFBFBD><EFBFBD> vp <EFBFBD><EFBFBD>ͬ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_VSTRING *ACL_PRINTF(2, 3) acl_vstring_sprintf_prepend(
|
|
|
|
|
ACL_VSTRING *vp, const char *format, ...);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> "\r\n" <EFBFBD><EFBFBD> "\n")<EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*} <EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param src {const char**} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ, <EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һλ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param dlen {size_t} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const ACL_VSTRING*} NULL, <EFBFBD><EFBFBD>ʾδ<EFBFBD>ҵ<EFBFBD> "\r\n" <EFBFBD><EFBFBD> "\n"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ὣʣ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫͨ<EFBFBD><EFBFBD> ACL_VSTRING_LEN <EFBFBD>жϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>!NULL<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>Ӧ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING_RESET(vp) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API const ACL_VSTRING *acl_buffer_gets_nonl(ACL_VSTRING *vp,
|
|
|
|
|
const char **src, size_t dlen);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> "\r\n" <EFBFBD><EFBFBD> "\n")<EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*} <EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param src {const char**} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ, <EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һλ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param dlen {size_t} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const ACL_VSTRING*} NULL, <EFBFBD><EFBFBD>ʾδ<EFBFBD>ҵ<EFBFBD> "\r\n" <EFBFBD><EFBFBD> "\n"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ὣʣ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫͨ<EFBFBD><EFBFBD> ACL_VSTRING_LEN <EFBFBD>жϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>!NULL<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>Ӧ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING_RESET(vp) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API const ACL_VSTRING *acl_buffer_gets(ACL_VSTRING *vp,
|
|
|
|
|
const char **src, size_t dlen);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Macros. Unsafe macros have UPPERCASE names.
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_SPACE(vp, len) ((vp)->vbuf.space(&(vp)->vbuf, len))
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ȡ<EFBFBD>õ<EFBFBD>ǰ ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD>ݴ洢<EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @return {char*}
|
|
|
|
|
*/
|
|
|
|
|
#define acl_vstring_str(vp) ((char *) (vp)->vbuf.data)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ȡ<EFBFBD>õ<EFBFBD>ǰ ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @return {int}
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_LEN(vp) (size_t) ((vp)->vbuf.ptr - (vp)->vbuf.data)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ȡ<EFBFBD>õ<EFBFBD>ǰ ACL_VSTRING <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>С
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @return {int}
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_SIZE(vp) ((vp)->vbuf.len)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ȡ<EFBFBD>õ<EFBFBD>ǰ ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @return {char*}
|
|
|
|
|
*/
|
|
|
|
|
#define acl_vstring_end(vp) ((char *) (vp)->vbuf.ptr)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_TERMINATE(vp) { \
|
|
|
|
|
if ((vp)->vbuf.cnt <= 0) \
|
2016-02-05 10:10:24 +08:00
|
|
|
|
ACL_VSTRING_SPACE((vp), 1); \
|
|
|
|
|
if ((vp)->vbuf.cnt > 0) \
|
|
|
|
|
*(vp)->vbuf.ptr = 0; \
|
|
|
|
|
else if ((vp)->vbuf.ptr > (vp)->vbuf.data) { \
|
|
|
|
|
(vp)->vbuf.ptr--; \
|
|
|
|
|
*(vp)->vbuf.ptr = 0; \
|
|
|
|
|
(vp)->vbuf.cnt++; \
|
|
|
|
|
} \
|
2014-11-19 00:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ʼλ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ὣβ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<EFBFBD><EFBFBD>Ӧ<EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING_TERMINATE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_RESET(vp) { \
|
|
|
|
|
(vp)->vbuf.ptr = (vp)->vbuf.data; \
|
|
|
|
|
(vp)->vbuf.cnt = (vp)->vbuf.len; \
|
2016-02-05 10:10:24 +08:00
|
|
|
|
acl_vbuf_clearerr(&(vp)->vbuf); \
|
2014-11-19 00:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD> ACL_VSTRING <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
* @param ch {int} <EFBFBD>ַ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_ADDCH(vp, ch) ACL_VBUF_PUT(&(vp)->vbuf, ch)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_SKIP(vp) { \
|
|
|
|
|
while ((vp)->vbuf.cnt > 0 && *(vp)->vbuf.ptr) \
|
|
|
|
|
(vp)->vbuf.ptr++, (vp)->vbuf.cnt--; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ǰ ACL_VSTRING <EFBFBD>л<EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vp {ACL_VSTRING*}
|
|
|
|
|
*/
|
|
|
|
|
#define acl_vstring_avail(vp) ((vp)->vbuf.cnt)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The following macro is not part of the public interface, because it can
|
|
|
|
|
* really screw up a buffer by positioning past allocated memory.
|
|
|
|
|
*/
|
|
|
|
|
#define ACL_VSTRING_AT_OFFSET(vp, offset) { \
|
|
|
|
|
(vp)->vbuf.ptr = (vp)->vbuf.data + (offset); \
|
|
|
|
|
(vp)->vbuf.cnt = (vp)->vbuf.len - (offset); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|