Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

tdsstring.h

00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
00002  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Brian Bruns
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #ifndef _tdsstring_h_
00021 #define _tdsstring_h_
00022 
00023 /* $Id: tdsstring.h,v 1.19 2007/07/01 10:10:52 freddy77 Exp $ */
00024 
00025 #if defined(__GNUC__) && __GNUC__ >= 4
00026 #pragma GCC visibility push(hidden)
00027 #endif
00028 
00029 extern const char tds_str_empty[1];
00030 
00031 /* TODO do some function and use inline if available */
00032 
00037 #if ENABLE_EXTRA_CHECKS
00038 void tds_dstr_init(DSTR * s);
00039 int tds_dstr_isempty(DSTR * s);
00040 char *tds_dstr_buf(DSTR * s);
00041 size_t tds_dstr_len(DSTR * s);
00042 #else
00043 
00044 #define tds_dstr_init(s) \
00045         do { DSTR *_tds_s = (s); _tds_s->dstr_size = 0; _tds_s->dstr_s = (char*) tds_str_empty; } while(0)
00046 
00048 #define tds_dstr_isempty(s) \
00049         ((s)->dstr_size == 0)
00050 #define tds_dstr_buf(s) \
00051         ((s)->dstr_s)
00052 #define tds_dstr_len(s) \
00053         ((s)->dstr_size)
00054 #endif
00055 
00056 #define tds_dstr_cstr(s) \
00057         ((const char* ) tds_dstr_buf(s))
00058 
00059 void tds_dstr_zero(DSTR * s);
00060 void tds_dstr_free(DSTR * s);
00061 
00062 DSTR* tds_dstr_dup(DSTR * s, const DSTR * src);
00063 DSTR* tds_dstr_copy(DSTR * s, const char *src);
00064 DSTR* tds_dstr_copyn(DSTR * s, const char *src, unsigned int length);
00065 DSTR* tds_dstr_set(DSTR * s, char *src);
00066 
00068 DSTR* tds_dstr_setlen(DSTR *s, unsigned int length);
00070 DSTR* tds_dstr_alloc(DSTR *s, unsigned int length);
00071 
00074 #if defined(__GNUC__) && __GNUC__ >= 4
00075 #pragma GCC visibility pop
00076 #endif
00077 
00078 #endif /* _tdsstring_h_ */

Generated on Sun Sep 21 04:23:18 2008 for FreeTDS API by  doxygen 1.4.1