/usr/include/sbml/util/StringBuffer.h is in libsbml5-dev 5.12.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | /**
* @cond doxygenLibsbmlInternal
*
* @file StringBuffer.h
* @brief A growable buffer for creating character strings.
* @author Ben Bornstein <ben.bornstein@jpl.nasa.gov>
*
* <!--------------------------------------------------------------------------
* This file is part of libSBML. Please visit http://sbml.org for more
* information about SBML, and the latest version of libSBML.
*
* Copyright (C) 2013-2015 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
* 3. University of Heidelberg, Heidelberg, Germany
*
* Copyright (C) 2009-2013 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
*
* Copyright (C) 2006-2008 by the California Institute of Technology,
* Pasadena, CA, USA
*
* Copyright (C) 2002-2005 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. Japan Science and Technology Agency, Japan
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation. A copy of the license agreement is provided
* in the file named "LICENSE.txt" included with this software distribution and
* also available online as http://sbml.org/software/libsbml/license.html
* ---------------------------------------------------------------------- -->*/
#ifndef StringBuffer_h
#define StringBuffer_h
#include <sbml/common/extern.h>
LIBSBML_CPP_NAMESPACE_BEGIN
BEGIN_C_DECLS
typedef struct
{
unsigned long length;
unsigned long capacity;
char *buffer;
} StringBuffer_t;
/**
* Creates a new StringBuffer_t with the given @p capacity and returns a pointer to it.
*
* @param capacity the length of the created string buffer.
*
* @return a new StringBuffer_t of the given size.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
StringBuffer_t *
StringBuffer_create (unsigned long capacity);
/**
* Frees the given StringBuffer_t.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_free (StringBuffer_t *sb);
/**
* Resets (empties) this StringBuffer_t. The current capacity remains
* unchanged.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_reset (StringBuffer_t *sb);
/**
* Appends the given string to this StringBuffer_t.
*
* @param sb the StringBuffer_t structure.
* @param s the string to be appended
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_append (StringBuffer_t *sb, const char *s);
/**
* Appends the given string to this StringBuffer_t.
*
* @param sb the StringBuffer_t structure.
* @param s the string to be appended
* @param len number of characters of s to append
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_appendWithLength (StringBuffer_t *sb, const char *s, unsigned long len);
/**
* Appends the given character to this StringBuffer_t.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_appendChar (StringBuffer_t *sb, char c);
/**
* Appends a string representation of the given number to this StringBuffer_t
* The function snprintf is used to do the conversion and currently n = 16;
* i.e. the number will be truncated after 16 characters, regardless of the
* buffer size.
*
* The format argument should be a printf conversion specifier, e.g. "%d",
* "%f", "%g", etc.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_appendNumber (StringBuffer_t *sb, const char *format, ...);
/**
* Appends a string representation of the given integer to this
* StringBuffer_t.
*
* This function is equivalent to:
*
* StringBuffer_appendNumber(sb, "%d", i);
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_appendInt (StringBuffer_t *sb, long i);
/**
* Appends a string representation of the given integer to this
* StringBuffer_t.
*
* This function is equivalent to:
*
* StringBuffer_appendNumber(sb, LIBSBML_FLOAT_FORMAT, r);
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_appendReal (StringBuffer_t *sb, double r);
/**
* Appends a string representation of the given exp to this
* StringBuffer_t.
*
* This function is equivalent to:
*
* StringBuffer_appendNumber(sb, LIBSBML_FLOAT_FORMAT, r);
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_appendExp (StringBuffer_t *sb, double r);
/**
* Doubles the capacity of this StringBuffer_t (if nescessary) until it can
* hold at least n additional characters.
*
* Use this function only if you want fine-grained control of the
* StringBuffer_t. By default, the StringBuffer_t will automatically double
* its capacity (as many times as needed) to accomodate an append
* operation.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_ensureCapacity (StringBuffer_t *sb, unsigned long n);
/**
* Grow the capacity of this StringBuffer_t by n characters.
*
* Use this function only if you want fine-grained control of the
* StringBuffer_t. By default, the StringBuffer_t will automatically double
* its capacity (as many times as needed) to accomodate an append
* operation.
*
* @param sb the StringBuffer_t structure.
* @param n the number of characters to increase the capacity of this StringBuffer_t.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
void
StringBuffer_grow (StringBuffer_t *sb, unsigned long n);
/**
* @return the underlying buffer contained in this StringBuffer_t.
*
* The buffer is not owned by the caller and should not be modified or
* deleted. The caller may take ownership of the buffer by freeing the
* StringBuffer_t directly, e.g.:
*
* char *buffer = StringBuffer_getBuffer(sb);
* safe_free(sb);
*
* This is more direct and efficient than:
*
* char *buffer = StringBuffer_toString(sb);
* StringBuffer_free(sb);
*
* which creates a copy of the buffer and then destroys the original.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
char *
StringBuffer_getBuffer (const StringBuffer_t *sb);
/**
* @return the number of characters currently in this StringBuffer_t.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
unsigned long
StringBuffer_length (const StringBuffer_t *sb);
/**
* @return the number of characters this StringBuffer_t is capable of holding
* before it will automatically double its storage capacity.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
unsigned long
StringBuffer_capacity (const StringBuffer_t *sb);
/**
* @return a copy of the string contained in this StringBuffer_t.
*
* The caller owns the copy and is responsible for freeing it.
*
* @param sb the StringBuffer_t structure.
*
* @memberof StringBuffer_t
*/
LIBSBML_EXTERN
char *
StringBuffer_toString (const StringBuffer_t *sb);
END_C_DECLS
LIBSBML_CPP_NAMESPACE_END
#endif /** StringBuffer_h **/
/** @endcond */
|