/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/utils/eh_str.c File Reference

#include <eh_utils.h>
#include <strings.h>
#include <errno.h>
#include <string.h>

Go to the source code of this file.

Defines

#define WHITE_SPACE   " \t\n"

Functions

GQuark eh_str_error_quark (void)
double ** eh_str_to_time_range_piecewise (const gchar *s, GError **error)
double ** eh_str_to_dbl_range_piecewise (const gchar *s, GError **error)
double * eh_str_to_dbl_range (const gchar *s, GError **error)
double * eh_str_to_time_range (const gchar *s, GError **error)
double eh_str_to_dbl (const gchar *s, GError **error)
gint64 eh_str_to_int (const gchar *s, GError **error)
double eh_str_to_time_in_years (const gchar *s, GError **error)
gboolean eh_str_is_boolean (const gchar *s)
gboolean eh_str_to_boolean (const gchar *s, GError **error)
gchar ** eh_strv_append (gchar ***str_l, gchar *new_str)
gchar ** eh_strv_concat (gchar ***str_l, gchar **new_l)
gint eh_strv_find (const gchar **str_l, const gchar *needle)
gchar * eh_str_replace (gchar *str, gchar old_c, gchar new_c)
gchar * eh_str_remove (gchar *str, gchar *start, gint n)
gchar * eh_str_remove_blocks (gchar *str, gchar **block_start, gchar **block_end)
Eh_symbol_table eh_str_parse_key_value (gchar *str, gchar *delim_1, gchar *delim_2)
gint eh_str_count_chr (gchar *str, gchar *end, gint delim)
gchar * eh_str_remove_to_eol_comments (gchar *str, gchar *com_start)
gchar * eh_str_remove_c_style_comments (gchar *str)
gchar * eh_str_remove_comments (gchar *str, const gchar *start_str, const gchar *end_str, gchar ***comments)
gchar * eh_str_trim_left (gchar *str)
gchar * eh_str_trim_right (gchar *str)
gchar * eh_str_remove_white_space (gchar *str)


Define Documentation

#define WHITE_SPACE   " \t\n"

Definition at line 714 of file eh_str.c.

Referenced by eh_str_remove_white_space(), eh_str_trim_left(), and eh_str_trim_right().


Function Documentation

gint eh_str_count_chr ( gchar *  str,
gchar *  end,
gint  delim 
)

Count the number of occurances of a character in a string

Count the number of times delim occurs from str up to and including end.

Parameters:
str The start of the string
end The end of the string
delim The character to look for
Returns:
The number of occurances of the character in the string

Definition at line 581 of file eh_str.c.

GQuark eh_str_error_quark ( void   ) 

Definition at line 6 of file eh_str.c.

gboolean eh_str_is_boolean ( const gchar *  s  ) 

Definition at line 336 of file eh_str.c.

References eh_require, and eh_str_to_boolean().

Referenced by sed_process_scan().

Eh_symbol_table eh_str_parse_key_value ( gchar *  str,
gchar *  delim_1,
gchar *  delim_2 
)

Parse a string into key-value pairs

Key-value pairs are separated by the delimiter, delim_2. The keys and values are separated by delim_1. A Eh_symbol_table is created that holds all of the key-value pairs.

Parameters:
str A string to parse.
delim_1 The delimiter that separates keys from values.
delim_2 The delimiter that separates key-value pairs from one another.
Returns:
A Eh_symbol_table of key-value pairs. Use eh_symbol_table_destroy to free.

Definition at line 531 of file eh_str.c.

References eh_require, eh_str_remove_comments(), eh_symbol_table_destroy(), eh_symbol_table_insert(), eh_symbol_table_new(), and eh_symbol_table_size().

gchar* eh_str_remove ( gchar *  str,
gchar *  start,
gint  n 
)

Definition at line 484 of file eh_str.c.

gchar* eh_str_remove_blocks ( gchar *  str,
gchar **  block_start,
gchar **  block_end 
)

Definition at line 495 of file eh_str.c.

gchar* eh_str_remove_c_style_comments ( gchar *  str  ) 

Remove c-style comments from a string

Remove comments that begin with '\/\*' and end with '\*\/' This function does not allocate or reallocate any memory. It modifies str in place. The pointer to str is returned to allow the nesting of functions.

Parameters:
str A string to remove comments from.
Returns:
str

Definition at line 626 of file eh_str.c.

References eh_str_remove_comments().

gchar* eh_str_remove_comments ( gchar *  str,
const gchar *  start_str,
const gchar *  end_str,
gchar ***  comments 
)

Remove comments from a string

Remove comments that begin with start_str and end with end_str. If end_str is NULL, then each comment is assumed to end at the end of the line. This function does not allocate or reallocate any memory. It modifies str in place. The pointer to str is returned to allow the nesting of functions.

If non-NULL, the parameter comments will contain a (newly-allocated) string array of the comments that were removed. Use g_strfreev to free when no longer in use.

Parameters:
str A string to remove comments from.
start_str A string that indicates the start of a comment.
end_str A string that indicates the end of a comment (or NULL if the comment terminates at the end of its line).
comments Location to put a string array that contains the comments that were removed (or NULL).
Returns:
str

Definition at line 653 of file eh_str.c.

References eh_renew, and eh_require.

gchar* eh_str_remove_to_eol_comments ( gchar *  str,
gchar *  com_start 
)

Remove comments that run to the end of a line

Remove comments that begin with com_start and continue until the end of the line. This function does not allocate or reallocate any memory. It modifies str in place. The pointer to str is returned to allow the nesting of functions.

Parameters:
str A string to remove comments from.
com_start A string that marks the start of a comment.
Returns:
str

Definition at line 609 of file eh_str.c.

References eh_str_remove_comments().

gchar* eh_str_remove_white_space ( gchar *  str  ) 

Definition at line 750 of file eh_str.c.

References eh_free, eh_new, and WHITE_SPACE.

gchar* eh_str_replace ( gchar *  str,
gchar  old_c,
gchar  new_c 
)

Definition at line 470 of file eh_str.c.

gboolean eh_str_to_boolean ( const gchar *  s,
GError **  error 
)

Definition at line 361 of file eh_str.c.

References eh_free, eh_require, eh_return_val_if_fail, EH_STR_ERROR, and EH_STR_ERROR_BAD_LOGICAL_VAL.

Referenced by eh_get_opt_bool(), eh_key_file_get_bool_value(), eh_key_file_get_bool_values(), eh_opt_bool_value(), eh_scan_boolean_array(), eh_str_is_boolean(), eh_symbol_table_bool_value(), and sed_process_scan().

double eh_str_to_dbl ( const gchar *  s,
GError **  error 
)

Definition at line 213 of file eh_str.c.

References eh_nan(), eh_require, eh_return_val_if_fail, EH_STR_ERROR, and EH_STR_ERROR_BAD_STRING.

Referenced by eh_scan_dbl_array(), eh_str_to_dbl_range(), init_met_station(), init_tide(), and sed_epoch_sscan_number().

double* eh_str_to_dbl_range ( const gchar *  s,
GError **  error 
)

Definition at line 110 of file eh_str.c.

References eh_free, eh_new, eh_require, eh_return_val_if_fail, EH_STR_ERROR, EH_STR_ERROR_BAD_RANGE, EH_STR_ERROR_NO_RANGE, and eh_str_to_dbl().

Referenced by eh_str_to_dbl_range_piecewise(), and eh_symbol_table_dbl_range().

double** eh_str_to_dbl_range_piecewise ( const gchar *  s,
GError **  error 
)

Definition at line 61 of file eh_str.c.

References eh_require, eh_return_val_if_fail, EH_STR_ERROR, EH_STR_ERROR_RANGE_OVERLAP, eh_str_to_dbl_range(), and eh_strv_append().

gint64 eh_str_to_int ( const gchar *  s,
GError **  error 
)

Definition at line 242 of file eh_str.c.

References eh_nan(), eh_require, eh_return_val_if_fail, EH_STR_ERROR, and EH_STR_ERROR_BAD_STRING.

Referenced by eh_scan_int_array().

double eh_str_to_time_in_years ( const gchar *  s,
GError **  error 
)

Definition at line 273 of file eh_str.c.

References Eh_date_t::day, eh_date_to_years(), eh_nan(), eh_require, eh_return_val_if_fail, EH_STR_ERROR, EH_STR_ERROR_BAD_UNIT, EH_STR_ERROR_NO_UNIT, eh_string_c_str(), eh_string_find_first_of(), eh_string_remove_white_space(), Eh_date_t::month, and Eh_date_t::year.

Referenced by eh_str_to_time_range(), eh_symbol_table_time_array_value(), eh_symbol_table_time_value(), sed_epoch_sscan_duration(), sed_epoch_sscan_time_step(), and sed_process_scan().

double* eh_str_to_time_range ( const gchar *  s,
GError **  error 
)

Definition at line 162 of file eh_str.c.

References eh_free, eh_new, eh_require, eh_return_val_if_fail, EH_STR_ERROR, EH_STR_ERROR_BAD_RANGE, EH_STR_ERROR_NO_RANGE, and eh_str_to_time_in_years().

Referenced by eh_str_to_time_range_piecewise(), eh_symbol_table_time_range(), sed_epoch_sscan_time(), and sed_process_scan().

double** eh_str_to_time_range_piecewise ( const gchar *  s,
GError **  error 
)

Definition at line 12 of file eh_str.c.

References eh_require, eh_return_val_if_fail, EH_STR_ERROR, EH_STR_ERROR_RANGE_OVERLAP, eh_str_to_time_range(), and eh_strv_append().

gchar* eh_str_trim_left ( gchar *  str  ) 

Definition at line 717 of file eh_str.c.

References eh_new, and WHITE_SPACE.

gchar* eh_str_trim_right ( gchar *  str  ) 

Definition at line 731 of file eh_str.c.

References eh_new, and WHITE_SPACE.

gchar** eh_strv_append ( gchar ***  str_l,
gchar *  new_str 
)

Append a string to the end of an array of strings.

If str_l points to NULL, a new string array will be allocated. The location of new_str is appended to str_l rather than a copy. Thus, new_str should not be freed before str_l.

Parameters:
str_l The location of a string array, or NULL.
new_str The string to append.
Returns:
The input string_array.

Definition at line 411 of file eh_str.c.

References eh_new, and eh_renew.

gchar** eh_strv_concat ( gchar ***  str_l,
gchar **  new_l 
)

Definition at line 437 of file eh_str.c.

References eh_strv_append().

Referenced by sed_cube_all_branches(), and sed_cube_all_leaves().

gint eh_strv_find ( const gchar **  str_l,
const gchar *  needle 
)

Definition at line 451 of file eh_str.c.

References eh_require.

Referenced by parse_data_list().


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