Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psString.h

Go to the documentation of this file.
00001 /** @file  psString.h
00002  *
00003  * -*- mode: C; c-basic-indent: 4; tab-width: 8; indent-tabs-mode: nil -*-
00004  * vim: set cindent ts=8 sw=4 expandtab:
00005  *
00006  *  @brief Contains the declarations of string utility functions
00007  *
00008  *  @ingroup SysUtils
00009  *
00010  *  String utility functions defined shall provide basic string copying
00011  *  capabilities.
00012  *
00013  *  @author Eric Van Alst, MHPCC
00014  *
00015  *  @version $Revision: 1.1.1.1 $ $Name:  $
00016  *  @date $Date: 2005/09/14 20:42:48 $
00017  *
00018  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00019  */
00020 
00021 #ifndef PS_STRING_H
00022 #define PS_STRING_H
00023 
00024 #include <sys/types.h>
00025 #include "psType.h"
00026 
00027 /** This macro will convert the argument to a quoted string */
00028 #define PS_STRING(S)  #S
00029 
00030 // Doxygen group tags
00031 
00032 /** @addtogroup SysUtils
00033  *  @{
00034  */
00035 
00036 /** Copies the input string
00037  *
00038  *  This function shall allocate memory to the length of the input string
00039  *  plus one and copy the input string to the newly allocated memory.
00040  *
00041  *  @return psString:      Copy of input string
00042  *
00043  */
00044 psString psStringCopy(
00045     const char *string                 ///< Input string of characters to copy
00046 );
00047 
00048 /** Copies the input string up to the specified number of characters
00049  *
00050  *  This function shall allocate memory to the length specified by nChar
00051  *  plus one and copy the input string to the newly allocated memory.
00052  *  This function will only copy nChar bytes from the input to new string,
00053  *  so if the input string is larger than nChar characters the copied
00054  *  string will be a substring of the input string.  If the input string
00055  *  is smaller than nChar bytes then the remaining bytes allocated will
00056  *  be set to NULL.
00057  *
00058  *  @return  psString:   Copy of input string
00059  *
00060  */
00061 
00062 /*@null@*/
00063 
00064 psString psStringNCopy(
00065     const char *string,                ///< Input string of characters to copy
00066     unsigned int nChar                 ///< Number of bytes to allocate for string copy
00067 );
00068 
00069 /** Appends a format onto a string
00070  *
00071  * This function shall allocate a new string if dest is NULL.  dest shall be
00072  * automatically extended to the size of the new string.
00073  *
00074  * @return The length of the new string (excluding '\0')
00075  */
00076 
00077 ssize_t psStringAppend(
00078     char **dest,                        ///< existing string
00079     const char *format,                 ///< format to append
00080     ...                                 ///< format arguments
00081 );
00082 
00083 /** Prepends a format onto a string
00084  *
00085  * This function shall allocate a new string if dest is NULL.  dest shall be
00086  * automatically extended to the size of the new string.
00087  *
00088  * @return The length of the new string (excluding '\0')
00089  */
00090 
00091 ssize_t psStringPrepend(
00092     char **dest,                        ///< existing string
00093     const char *format,                 ///< format to append
00094     ...                                 ///< format arguments
00095 );
00096 
00097 /** @} */// Doxygen - End of SystemGroup Functions
00098 
00099 #endif // #ifndef PS_STRING_H

Generated on Wed Sep 14 10:42:48 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2