libcollection
0.1.3
|
00001 /* 00002 COLLECTION LIBRARY 00003 00004 Header file for supplementary functions that provide 00005 printing and debugging of collections. 00006 00007 Copyright (C) Dmitri Pal <dpal@redhat.com> 2009 00008 00009 Collection Library is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU Lesser General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 Collection Library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 along with Collection Library. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 00023 #ifndef COLLECTION_TOOLS_H 00024 #define COLLECTION_TOOLS_H 00025 00026 #include "collection.h" 00027 00041 #ifdef HAVE_TRACE 00042 #define COL_DEBUG_COLLECTION(collection) col_debug_collection(collection,COL_TRAVERSE_DEFAULT); 00043 #else 00044 #define COL_DEBUG_COLLECTION(collection) ; 00045 #endif 00046 00048 #define COL_TYPE_NAME_STRING "string" 00049 00050 #define COL_TYPE_NAME_BINARY "bin" 00051 00052 #define COL_TYPE_NAME_INTEGER "int" 00053 00054 #define COL_TYPE_NAME_UNSIGNED "uint" 00055 00056 #define COL_TYPE_NAME_LONG "long" 00057 00058 #define COL_TYPE_NAME_ULONG "ulong" 00059 00060 #define COL_TYPE_NAME_DOUBLE "double" 00061 00062 #define COL_TYPE_NAME_BOOL "bool" 00063 00064 #define COL_TYPE_NAME_UNKNOWN "unknown" 00065 00067 #define TEXT_COLLECTION "SET" 00068 00069 #define TEXT_COLLEN 3 00070 00075 #define BLOCK_SIZE 1024 00076 00081 struct col_serial_data { 00082 char *buffer; 00083 int size; 00084 int length; 00085 int nest_level; 00086 }; 00087 00088 00097 int col_get_data_len(int type, int length); 00098 00109 int col_grow_buffer(struct col_serial_data *buf_data, int len); 00110 00121 int col_put_marker(struct col_serial_data *buf_data, 00122 const void *data, int len); 00123 00141 int col_serialize(const char *property_in, 00142 int property_len_in, 00143 int type, 00144 void *data_in, 00145 int length_in, 00146 void *custom_data, 00147 int *dummy); 00148 00165 int col_debug_handle(const char *property, 00166 int property_len, 00167 int type, 00168 void *data, 00169 int length, 00170 void *custom_data, 00171 int *dummy); 00172 00183 int col_debug_item(struct collection_item *item); 00184 00196 int col_debug_collection(struct collection_item *handle, 00197 int flag); 00198 00211 int col_print_collection(struct collection_item *handle); 00212 00224 int col_print_collection2(struct collection_item *handle); 00225 00237 int col_print_item(struct collection_item *handle, const char *name); 00238 00257 char **col_collection_to_list(struct collection_item *handle, 00258 int *size, 00259 int *error); 00260 00266 void col_free_property_list(char **str_list); 00267 00268 #endif