Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

dsutil.h File Reference

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <dsSmartException.h>

Go to the source code of this file.

Compounds

class  autostr
 Just another "string" class. It has been written when the world was young enough. More...

class  dsSafePtr

Defines

#define __size_strcpy(dest, src, size)   size_strcpy(dest,src,size,__FILE__,__LINE__);

Typedefs

typedef unsigned short ushort
typedef unsigned long ulong
typedef unsigned int uint

Functions

 DECLARE_EXCEPTION (AutoStr)
unsigned long dsAtoul (char *src)
unsigned long dsAtoul (std::istream &src)
unsigned long dsAtoul (std::istream &src, int n)
int equ (char *a, char *b)
int equ (char *a, char *b, int n)
char * ds_strndup (const char *s, int len)
char * dsStrndup (const char *s, int len)
char * ds_strdup (const char *s)
char * dsStrdup (const char *s)
char * strndup (const char *s, int len)
char * ds_strnchr (char *s, char c, int len)
void size_strcpy (char *dest, const char *src, int size)
void size_strcpy (char *dest, const char *src, int size, char *file, int line)
char * ds_zalloc (size_t size)
char * trim (char *src)
int split (char delem, char *str,...)
int split (char delem, char *str, int nf,...)
char * unsplit (char delem,...)


Detailed Description

This is collection of variety of smal but usable functions

Define Documentation

#define __size_strcpy dest,
src,
size       size_strcpy(dest,src,size,__FILE__,__LINE__);
 


Typedef Documentation

typedef unsigned int uint
 

typedef unsigned long ulong
 

typedef unsigned short ushort
 


Function Documentation

DECLARE_EXCEPTION AutoStr   
 

char* ds_strdup const char *    s
 

return dynamic copy of string s no strlen calls inside

char* ds_strnchr char *    s,
char    c,
int    len
 

search character c in substring of s of length len usable for mmap

char* ds_strndup const char *    s,
int    len
 

return dynamic copy of substring of string s of length len. if len is greater than length of s return s no strlen calls inside, so it is safe to use this function with mmap()

char* ds_zalloc size_t    size
 

Allocate buffer and fill it by 0

unsigned long dsAtoul std::istream &    src,
int    n
 

This function convert first n character os stream src to unsigned long if read character is not numeric throws exception

Returns:
conversion result
Exceptions:
AutoStrException if conversion couldn't be done

unsigned long dsAtoul std::istream &    src
 

unsigned long dsAtoul char *    src
 

This function convert decimal ascii src to unsigned long if first passed character is not numeric throws exception

Returns:
conversion result
Exceptions:
AutoStrException if conversion couldn't be done

char* dsStrdup const char *    s [inline]
 

char* dsStrndup const char *    s,
int    len
[inline]
 

int equ char *    a,
char *    b,
int    n
[inline]
 

Save as above, but length can be specified

int equ char *    a,
char *    b
[inline]
 

Compare two strings a and with internall zero check usable for example to check value of environment variables.

Returns:
true if both string are zero, a-b if one of them are zero, value of strcmp in other cases

void size_strcpy char *    dest,
const char *    src,
int    size,
char *    file,
int    line
 

void size_strcpy char *    dest,
const char *    src,
int    size
 

copy string form src to dest. if length of src greater than size AutoStrException thrown

int split char    delem,
char *    str,
int    nf,
...   
 

Same as above, but number of fields to extract can be specified

int split char    delem,
char *    str,
...   
 

split string into dinamicaly allocated strings by delem.
All arguments have to be char**, last is 0

char* strndup const char *    s,
int    len
[inline]
 

char* trim char *    src
 

remove leading and trailing spaces in-place

char* unsplit char    delem,
...   
 


Generated on Mon May 16 18:26:58 2005 for libdms4 by doxygen1.3-rc2