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/06/15 21:08:12 $
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 char*      Copy of input string
00042  *
00043  */
00044 char *psStringCopy(
00045     const char *str
00046     /**< Input string of characters to copy */
00047 );
00048 
00049 /** Copies the input string up to the specified number of characters
00050  *
00051  *  This function shall allocate memory to the length specified by nChar
00052  *  plus one and copy the input string to the newly allocated memory.
00053  *  This function will only copy nChar bytes from the input to new string,
00054  *  so if the input string is larger than nChar characters the copied
00055  *  string will be a substring of the input string.  If the input string
00056  *  is smaller than nChar bytes then the remaining bytes allocated will
00057  *  be set to NULL.
00058  *
00059  *  @return  char* Copy of input string
00060  *
00061  */
00062 
00063 /*@null@*/
00064 
00065 char *psStringNCopy(
00066     const char *str,
00067     /**< Input string of characters to copy */
00068 
00069     psS32 nChar
00070     /**< Number of bytes to allocate for string copy */
00071 );
00072 
00073 /** Appends a format onto a string
00074  *
00075  * This function shall allocate a new string if dest is NULL.  dest shall be
00076  * automatically extended to the size of the new string.
00077  *
00078  * @return The length of the new string (excluding '\0')
00079  */
00080 
00081 ssize_t psStringAppend(
00082     char **dest,                        ///< existing string
00083     const char *format,                 ///< format to append
00084     ...                                 ///< format arguments
00085 );
00086 
00087 /** Prepends a format onto a string
00088  *
00089  * This function shall allocate a new string if dest is NULL.  dest shall be
00090  * automatically extended to the size of the new string.
00091  *
00092  * @return The length of the new string (excluding '\0')
00093  */
00094 
00095 ssize_t psStringPrepend(
00096     char **dest,                        ///< existing string
00097     const char *format,                 ///< format to append
00098     ...                                 ///< format arguments
00099 );
00100 
00101 /** @} */// Doxygen - End of SystemGroup Functions
00102 
00103 #endif // #ifndef PS_STRING_H

Generated on Wed Jun 15 11:00:57 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1