2013-10-04 19:08:14 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2004. David Abrahams
|
|
|
|
* Distributed under the Boost Software License, Version 1.0.
|
|
|
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
|
* http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
2011-11-18 22:14:09 +04:00
|
|
|
|
2013-10-04 19:08:14 +04:00
|
|
|
#ifndef STRINGS_DWA20011024_H
|
|
|
|
#define STRINGS_DWA20011024_H
|
2011-11-18 22:14:09 +04:00
|
|
|
|
2013-10-04 19:08:14 +04:00
|
|
|
#include <stddef.h>
|
2011-11-18 22:14:09 +04:00
|
|
|
|
|
|
|
typedef struct string
|
|
|
|
{
|
2013-10-04 19:08:14 +04:00
|
|
|
char * value;
|
2011-11-18 22:14:09 +04:00
|
|
|
unsigned long size;
|
|
|
|
unsigned long capacity;
|
2013-10-04 19:08:14 +04:00
|
|
|
char opt[ 32 ];
|
2011-11-18 22:14:09 +04:00
|
|
|
#ifndef NDEBUG
|
2013-10-04 19:08:14 +04:00
|
|
|
char magic[ 4 ];
|
2011-11-18 22:14:09 +04:00
|
|
|
#endif
|
|
|
|
} string;
|
|
|
|
|
2013-10-04 19:08:14 +04:00
|
|
|
void string_new( string * );
|
|
|
|
void string_copy( string *, char const * );
|
|
|
|
void string_free( string * );
|
|
|
|
void string_append( string *, char const * );
|
|
|
|
void string_append_range( string *, char const *, char const * );
|
|
|
|
void string_push_back( string * s, char x );
|
|
|
|
void string_reserve( string *, size_t );
|
|
|
|
void string_truncate( string *, size_t );
|
|
|
|
void string_pop_back( string * );
|
|
|
|
char string_back( string * );
|
2011-11-18 22:14:09 +04:00
|
|
|
void string_unit_test();
|
|
|
|
|
|
|
|
#endif
|