HTP  0.3
bstr_builder.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  * Copyright 2009-2010 Open Information Security Foundation
00003  * Copyright 2010-2011 Qualys, Inc.
00004  *
00005  * Licensed to You under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  ***************************************************************************/
00017 
00023 #ifndef _BSTR_BUILDER_H
00024 #define _BSTR_BUILDER_H
00025 
00026 typedef struct bstr_builder_t bstr_builder_t;
00027 
00028 #include "dslib.h"
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 struct bstr_builder_t {
00035     list_t *pieces;
00036 };
00037 
00038 #define BSTR_BUILDER_DEFAULT_SIZE 16
00039 
00040 bstr_builder_t * bstr_builder_create(void);
00041 void bstr_builder_destroy(bstr_builder_t *bb);
00042 
00043 size_t bstr_builder_size(bstr_builder_t *bb);
00044 void bstr_builder_clear(bstr_builder_t *bb);
00045 
00046 int bstr_builder_append(bstr_builder_t *bb, bstr *b);
00047 int bstr_builder_append_mem(bstr_builder_t *bb, char *data, size_t len);
00048 int bstr_builder_append_c(bstr_builder_t *bb, char *str);
00049 bstr * bstr_builder_to_str(bstr_builder_t *bb);
00050 
00051 #ifdef __cplusplus
00052 }
00053 #endif
00054 
00055 #endif  /* _BSTR_BUILDER_H */
00056