source: icGREP/icgrep-devel/cudd-2.5.1/util/cstringstream.h @ 5820

Last change on this file since 5820 was 4597, checked in by nmedfort, 4 years ago

Upload of the CUDD library.

File size: 4.8 KB
Line 
1/**CHeaderFile*****************************************************************
2
3  FileName    [cstringstream.h]
4
5  PackageName [cstringstream]
6
7  Synopsis    [Package for simple stringstreams in C.]
8
9  Description [Package for simple stringstreams in C.]
10
11  SeeAlso     []
12
13  Author      [Fabio Somenzi]
14
15  Copyright   [Copyright (c) 2014, Regents of the University of Colorado
16
17  All rights reserved.
18
19  Redistribution and use in source and binary forms, with or without
20  modification, are permitted provided that the following conditions
21  are met:
22
23  Redistributions of source code must retain the above copyright
24  notice, this list of conditions and the following disclaimer.
25
26  Redistributions in binary form must reproduce the above copyright
27  notice, this list of conditions and the following disclaimer in the
28  documentation and/or other materials provided with the distribution.
29
30  Neither the name of the University of Colorado nor the names of its
31  contributors may be used to endorse or promote products derived from
32  this software without specific prior written permission.
33
34  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
37  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
38  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
39  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
40  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
41  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
42  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
44  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45  POSSIBILITY OF SUCH DAMAGE.]
46
47  Revision    [$Id$]
48
49******************************************************************************/
50#ifndef CSTRINGSTREAM_H_
51#define CSTRINGSTREAM_H_
52
53/*---------------------------------------------------------------------------*/
54/* Type declarations                                                         */
55/*---------------------------------------------------------------------------*/
56
57typedef struct _cstringstream * cstringstream;
58typedef struct _cstringstream const * const_cstringstream;
59
60/*---------------------------------------------------------------------------*/
61/* Function prototypes                                                       */
62/*---------------------------------------------------------------------------*/
63
64/* Return a new cstringstream with an empty string.
65 * Return NULL if creation fails. */
66cstringstream newStringStream(void);
67/* Free cstringstream ss. */
68void deleteStringStream(cstringstream ss);
69/* Clear the contents of cstringstream ss.
70 * Return 0 if succesful and -1 if ss is an invalid pointer. */
71int clearStringStream(cstringstream ss);
72/* Copies cstringstream src to a new cstringstream.  Return 0 if succesful
73 * and -1 if src is an invalid pointer or memory allocation fails. */
74cstringstream copyStringStream(const_cstringstream src);
75/* Change the size of cstringstream ss.
76 * Return 0 if successful and -1 if resizing fails. */
77int resizeStringStream(cstringstream ss, size_t newSize);
78/* Write the size of cstringstream ss to the location pointed by num.
79 * Return 0 if succesful and -1 if ss is an invalid pointer. */
80int sizeStringStream(const_cstringstream ss, size_t * num);
81/* Write the i-th element of cstringstream ss to the location
82 * pointed by c.  Return 0 if successful and -1 otherwise. */
83int getStringStream(const_cstringstream ss, size_t i, char * c);
84/* Add char c at the end of cstringstream ss.  Return 0 if
85 * successful and -1 otherwise. */
86int appendCharStringStream(cstringstream ss, char c);
87/* Add string s at the end of cstringstream ss.  Return 0 if
88 * successful and -1 otherwise. */
89int appendStringStringStream(cstringstream ss, char const * s);
90/* Add int/unsigned/long/unsigned long/double at the end of cstringstream ss.
91 * Return 0 if successful and -1 otherwise. */
92int appendIntStringStream(cstringstream ss, int d);
93int appendUnsignedStringStream(cstringstream ss, unsigned u);
94int appendLongStringStream(cstringstream ss, long ld);
95int appendUnsignedLongStringStream(cstringstream ss, unsigned long lu);
96int appendDoubleStringStream(cstringstream ss, double g);
97/* Set the i-th element of cstringstream ss to c.  Return 0 if
98 * successful and -1 otherwise.  The i-th element of ss
99 * must already exist.  */
100int putStringStream(cstringstream ss, size_t index, char c);
101/* Return a NULL terminated string from the contents of
102 * cstringstream ss.  In case of failure, return NULL.
103 * The returned string must be freed by the caller. */
104char * stringFromStringStream(const_cstringstream ss);
105#endif
Note: See TracBrowser for help on using the repository browser.