util/cstringstream.h File Reference

Package for simple stringstreams in C. More...

Go to the source code of this file.

Typedefs

typedef struct _cstringstreamcstringstream
 Type of a string stream.
typedef struct _cstringstream
const * 
const_cstringstream
 Const-qualified version of cstringstream.

Functions

cstringstream newStringStream (void)
 Returns a new cstringstream with an empty string.
void deleteStringStream (cstringstream ss)
 Frees cstringstream ss.
int clearStringStream (cstringstream ss)
 Clears the contents of cstringstream ss.
cstringstream copyStringStream (const_cstringstream src)
 Copies cstringstream src to a new cstringstream.
int resizeStringStream (cstringstream ss, size_t newSize)
 Changes the size of cstringstream ss.
int sizeStringStream (const_cstringstream ss, size_t *num)
 Writes the size of cstringstream ss to the location pointed by num.
int getStringStream (const_cstringstream ss, size_t i, char *c)
 Writes the i-th element of cstringstream ss to the location pointed by c.
int appendCharStringStream (cstringstream ss, char c)
 Adds char c at the end of cstringstream ss.
int appendStringStringStream (cstringstream ss, char const *s)
 Adds string s at the end of cstringstream ss.
int appendIntStringStream (cstringstream ss, int d)
 Adds int d at the end of cstringstream ss.
int appendUnsignedStringStream (cstringstream ss, unsigned u)
 Adds unsigned u at the end of cstringstream ss.
int appendLongStringStream (cstringstream ss, long ld)
 Adds long ld at the end of cstringstream ss.
int appendUnsignedLongStringStream (cstringstream ss, unsigned long lu)
 Adds unsigned long lu at the end of cstringstream ss.
int appendDoubleStringStream (cstringstream ss, double g)
 Adds double g at the end of cstringstream ss.
int putStringStream (cstringstream ss, size_t index, char c)
 Sets the i-th element of cstringstream ss to c.
char * stringFromStringStream (const_cstringstream ss)
 Returns a NULL-terminated string from the contents of cstringstream ss.

Detailed Description

Package for simple stringstreams in C.

Author:
Fabio Somenzi

Copyright (c) 2014-2015, Regents of the University of Colorado

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Id
cstringstream.h,v 1.1 2015/07/01 20:36:47 fabio Exp fabio

Function Documentation

int appendCharStringStream ( cstringstream  ss,
char  c 
)

Adds char c at the end of cstringstream ss.

Returns:
0 if successful or -1 otherwise.
int appendDoubleStringStream ( cstringstream  ss,
double  g 
)

Adds double g at the end of cstringstream ss.

Returns:
0 if successful or -1 otherwise.
int appendIntStringStream ( cstringstream  ss,
int  d 
)

Adds int d at the end of cstringstream ss.

Returns:
0 if successful or -1 otherwise.
int appendLongStringStream ( cstringstream  ss,
long  ld 
)

Adds long ld at the end of cstringstream ss.

Returns:
0 if successful or -1 otherwise.
int appendStringStringStream ( cstringstream  ss,
char const *  s 
)

Adds string s at the end of cstringstream ss.

Returns:
0 if successful or -1 otherwise.
int appendUnsignedLongStringStream ( cstringstream  ss,
unsigned long  lu 
)

Adds unsigned long lu at the end of cstringstream ss.

Returns:
0 if successful or -1 otherwise.
int appendUnsignedStringStream ( cstringstream  ss,
unsigned  u 
)

Adds unsigned u at the end of cstringstream ss.

Returns:
0 if successful or -1 otherwise.
int clearStringStream ( cstringstream  ss  ) 

Clears the contents of cstringstream ss.

Returns:
0 if succesful and -1 if ss is an invalid pointer.
cstringstream copyStringStream ( const_cstringstream  src  ) 

Copies cstringstream src to a new cstringstream.

Returns:
0 if succesful or -1 if src is an invalid pointer or memory allocation fails.
int getStringStream ( const_cstringstream  ss,
size_t  i,
char *  c 
)

Writes the i-th element of cstringstream ss to the location pointed by c.

Returns:
0 if successful or -1 otherwise.
cstringstream newStringStream ( void   ) 

Returns a new cstringstream with an empty string.

Returns:
NULL if creation fails.
int putStringStream ( cstringstream  ss,
size_t  index,
char  c 
)

Sets the i-th element of cstringstream ss to c.

Returns:
0 if successful or -1 otherwise.

The i-th element of ss must already exist.

int resizeStringStream ( cstringstream  ss,
size_t  newSize 
)

Changes the size of cstringstream ss.

Returns:
0 if successful or -1 if resizing fails.
int sizeStringStream ( const_cstringstream  ss,
size_t *  num 
)

Writes the size of cstringstream ss to the location pointed by num.

Returns:
0 if succesful or -1 if ss is an invalid pointer.
char* stringFromStringStream ( const_cstringstream  ss  ) 

Returns a NULL-terminated string from the contents of cstringstream ss.

In case of failure, it returns NULL. The returned string must be freed by the caller.

 All Data Structures Files Functions Variables Typedefs Enumerations Defines

Generated on 31 Dec 2015 for cudd by  doxygen 1.6.1