Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Misc Utilities
[Query Object Framework]


Files

file  gnc-engine-util.h
 GnuCash engine utility functions.


Defines

#define SAFE_STRCMP_REAL(fcn, da, db)
#define SAFE_STRCMP(da, db)   SAFE_STRCMP_REAL(strcmp,(da),(db))
#define SAFE_STRCASECMP(da, db)   SAFE_STRCMP_REAL(strcasecmp,(da),(db))
#define GNC_SCANF_LLD   "%qd"
#define stpcpy   gnc_stpcpy

Functions

int safe_strcmp (const char *da, const char *db)
int safe_strcasecmp (const char *da, const char *db)
int null_strcmp (const char *da, const char *db)
char * strncasestr (const char *str1, const char *str2, size_t len)
char * strcasestr (const char *str1, const char *str2)
char * ultostr (unsigned long val, int base)
gboolean gnc_strisnum (const char *s)
char * gnc_stpcpy (char *dest, const char *src)
const char * qof_util_whitespace_filter (const char *val)
int qof_util_bool_to_int (const char *val)
GCache * gnc_engine_get_string_cache (void)
void gnc_engine_string_cache_destroy (void)


Define Documentation

#define SAFE_STRCMP_REAL fcn,
da,
db   ) 
 

Value:

{    \
  if ((da) && (db)) {                    \
    if ((da) != (db)) {                  \
      int retval = fcn ((da), (db));     \
      /* if strings differ, return */    \
      if (retval) return retval;         \
    }                                    \
  } else                                 \
  if ((!(da)) && (db)) {                 \
    return -1;                           \
  } else                                 \
  if ((da) && (!(db))) {                 \
    return +1;                           \
  }                                      \
}
Macros ****************************************************


Function Documentation

GCache* gnc_engine_get_string_cache void   ) 
 

Get the gnc_string_cache. Create it if it doesn't exist already

char* gnc_stpcpy char *  dest,
const char *  src
 

Local copy of stpcpy, used wtih libc's that don't have one.

gboolean gnc_strisnum const char *  s  ) 
 

Returns true if string s is a number, possibly surrounded by whitespace.

int null_strcmp const char *  da,
const char *  db
 

The null_strcmp compares strings a and b the same way that strcmp() does, except that either may be null. This routine assumes that a null string is equal to the empty string.

int qof_util_bool_to_int const char *  val  ) 
 

Return integer 1 if the string starts with 't' or 'T' or contains the word 'true' or 'TRUE'; if string is a number, return that number. (Leading whitespace is ignored).

const char* qof_util_whitespace_filter const char *  val  ) 
 

Return NULL if the field is whitespace (blank, tab, formfeed etc.) Else return pointer to first non-whitespace character.

int safe_strcmp const char *  da,
const char *  db
 

The safe_strcmp compares strings a and b the same way that strcmp() does, except that either may be null. This routine assumes that a non-null string is always greater than a null string.

char* strncasestr const char *  str1,
const char *  str2,
size_t  len
 

Search for str2 in first nchar chars of str1, ignore case. Return pointer to first match, or null. These are just like that strnstr and the strstr functions, except that they ignore the case.

char* ultostr unsigned long  val,
int  base
 

The ultostr() subroutine is the inverse of strtoul(). It accepts a number and prints it in the indicated base. The returned string should be g_freed when done.


Generated on Sun May 23 15:41:47 2004 for QOF by doxygen 1.3.6-20040222