/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/utils/eh_glib.h

Go to the documentation of this file.
00001 //---
00002 //
00003 // This file is part of sedflux.
00004 //
00005 // sedflux is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // sedflux is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with sedflux; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //
00019 //---
00020 
00021 #ifndef __EH_GLIB_H__
00022 #define __EH_GLIB_H__
00023 
00024 // #define           EH_NPOS                          G_MAXLONG
00025 // #define           EH_WHITESPACE                    " \t\n"
00026 //
00027 // int               eh_string_find_first_of          ( GString*,
00028 //                                                      char );
00029 // int               eh_string_last_first_of          ( GString*,
00030 //                                                      char );
00031 // void              eh_string_remove_chr             ( GString*,
00032 //                                                      char );
00033 // void              eh_string_remove_white_space     ( GString* );
00034 // char*             eh_string_c_str                  ( GString* );
00035 // GSList*           eh_slist_remove_and_free         ( GSList*,
00036 //                                                      gpointer );
00037 
00038 #define G_NPOS G_MAXLONG
00039 #define G_WHITESPACE " \t\n"
00040 
00041 #define g_array_set_val(a,i,v) g_array_set_vals( a , i , &v , 1 )
00042 
00043 // find the first occurance of a character in a string.
00044 // s            : the search string.
00045 // c            : the character to search for.
00046 // return value : the position of the first occurance of the character.
00047 //              : EH_NPOS if the character is not found.
00048 gsize eh_string_find_first_of( GString *s , char c );
00049 
00050 // find the last occurance of a character in a string.
00051 // s            : the search string.
00052 // c            : the character to search for.
00053 // return value : the position of the last occurance of the character.
00054 //              : EH_NPOS if the character is not found.
00055 gsize eh_string_last_first_of( GString *s , char c );
00056 
00057 // remove all occurances of a character from a string.
00058 // s            : the string to alter
00059 // c            : the character to remove.
00060 // return value : nothing.
00061 void eh_string_remove_chr( GString *s , char c );
00062 
00063 // remove all white spaces (as given in EH_WHITESPACE) from a string.
00064 // s            : the string to alter.
00065 // return value : nothing.
00066 void eh_string_remove_white_space( GString *s );
00067 
00068 // the c-style (NULL terminated) string representation of a GString.
00069 // s            : a pointer to a GString.
00070 // return value : the c-style string.
00071 char *eh_string_c_str(GString*);
00072 
00073 // remove a list element from a singly-liked list and free the data of that element.
00074 // l            : a pointer to a singly-liked list.
00075 // p            : a pointer to the data part of the list element to remove.
00076 // return value : the list with the element removed.
00077 GSList *eh_slist_remove_and_free( GSList *l , gpointer p );
00078 
00079 void eh_free_slist_data( gpointer data , gpointer user_data );
00080 #endif

Generated on Fri Jan 4 18:04:16 2008 for sedflux by  doxygen 1.5.2