Coin Logo http://www.sim.no/
http://www.coin3d.org/

string.h
1#ifndef CC_STRING_H
2#define CC_STRING_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/C/basic.h>
28
29#include <stdarg.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif /* __cplusplus */
34
35/* ********************************************************************** */
36
37enum cc_string_constants {
38 CC_STRING_MIN_SIZE = 128 - sizeof(char *) + sizeof(int)
39};
40
41struct cc_string {
42 char * pointer;
43 size_t bufsize;
44 char buffer[CC_STRING_MIN_SIZE];
45};
46
47typedef struct cc_string cc_string;
48
49typedef char (*cc_apply_f)(char);
50
51/* ********************************************************************** */
52
53COIN_DLL_API void cc_string_construct(cc_string * me);
54COIN_DLL_API cc_string * cc_string_construct_new(void);
55COIN_DLL_API cc_string * cc_string_clone(const cc_string * str);
56COIN_DLL_API void cc_string_clean(cc_string * str);
57COIN_DLL_API void cc_string_destruct(cc_string * str);
58
59COIN_DLL_API void cc_string_set_string(cc_string * str, const cc_string * str2);
60COIN_DLL_API void cc_string_set_text(cc_string * str, const char * text);
61COIN_DLL_API void cc_string_set_subtext(cc_string * str, const char * text, int start, int end);
62COIN_DLL_API void cc_string_set_integer(cc_string * str, int integer);
63
64COIN_DLL_API void cc_string_append_string(cc_string * str, const cc_string * str2);
65COIN_DLL_API void cc_string_append_text(cc_string * str, const char * text);
66COIN_DLL_API void cc_string_append_integer(cc_string * str, const int digits);
67COIN_DLL_API void cc_string_append_char(cc_string * str, const char c);
68
69COIN_DLL_API unsigned int cc_string_length(const cc_string * str);
70COIN_DLL_API int cc_string_is(const cc_string * str);
71COIN_DLL_API void cc_string_clear(cc_string * str);
72COIN_DLL_API void cc_string_clear_no_free(cc_string * str);
73COIN_DLL_API uint32_t cc_string_hash(const cc_string * str);
74COIN_DLL_API uint32_t cc_string_hash_text(const char * text);
75
76COIN_DLL_API const char * cc_string_get_text(const cc_string * str);
77COIN_DLL_API void cc_string_remove_substring(cc_string * str, int start, int end);
78
79COIN_DLL_API int cc_string_compare(const cc_string * lhs, const cc_string * rhs);
80COIN_DLL_API int cc_string_compare_text(const char * lhs, const char * rhs);
81COIN_DLL_API int cc_string_compare_subtext(const cc_string * str, const char * text, int offset);
82
83COIN_DLL_API void cc_string_apply(cc_string * str, cc_apply_f function);
84
85COIN_DLL_API void cc_string_sprintf(cc_string * str, const char * formatstr, ...);
86COIN_DLL_API void cc_string_vsprintf(cc_string * str, const char * formatstr, va_list args);
87
88/* ********************************************************************** */
89
90#ifdef __cplusplus
91} /* extern "C" */
92#endif /* __cplusplus */
93
94#endif /* ! CC_STRING_H */
The cc_string type is a C ADT for ASCII string management.
Definition string.h:41

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.