string.h Source File

| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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
32 extern "C" {
33 #endif /* __cplusplus */
34
35 /* ********************************************************************** */
36
37 enum cc_string_constants {
38 CC_STRING_MIN_SIZE = 128 - sizeof(char *) + sizeof(int)
39 };
40
41 struct cc_string {
42 char * pointer;
43 size_t bufsize;
44 char buffer[CC_STRING_MIN_SIZE];
45 };
46
47 typedef struct cc_string cc_string;
48
49 typedef char (*cc_apply_f)(char);
50
51 /* ********************************************************************** */
52
53 COIN_DLL_API void cc_string_construct(cc_string * me);
54 COIN_DLL_API cc_string * cc_string_construct_new(void);
55 COIN_DLL_API cc_string * cc_string_clone(const cc_string * str);
56 COIN_DLL_API void cc_string_clean(cc_string * str);
57 COIN_DLL_API void cc_string_destruct(cc_string * str);
58
59 COIN_DLL_API void cc_string_set_string(cc_string * str, const cc_string * str2);
60 COIN_DLL_API void cc_string_set_text(cc_string * str, const char * text);
61 COIN_DLL_API void cc_string_set_subtext(cc_string * str, const char * text, int start, int end);
62 COIN_DLL_API void cc_string_set_integer(cc_string * str, int integer);
63
64 COIN_DLL_API void cc_string_append_string(cc_string * str, const cc_string * str2);
65 COIN_DLL_API void cc_string_append_text(cc_string * str, const char * text);
66 COIN_DLL_API void cc_string_append_integer(cc_string * str, const int digits);
67 COIN_DLL_API void cc_string_append_char(cc_string * str, const char c);
68
69 COIN_DLL_API unsigned int cc_string_length(const cc_string * str);
70 COIN_DLL_API int cc_string_is(const cc_string * str);
71 COIN_DLL_API void cc_string_clear(cc_string * str);
72 COIN_DLL_API void cc_string_clear_no_free(cc_string * str);
73 COIN_DLL_API uint32_t cc_string_hash(const cc_string * str);
74 COIN_DLL_API uint32_t cc_string_hash_text(const char * text);
75
76 COIN_DLL_API const char * cc_string_get_text(const cc_string * str);
77 COIN_DLL_API void cc_string_remove_substring(cc_string * str, int start, int end);
78
79 COIN_DLL_API int cc_string_compare(const cc_string * lhs, const cc_string * rhs);
80 COIN_DLL_API int cc_string_compare_text(const char * lhs, const char * rhs);
81 COIN_DLL_API int cc_string_compare_subtext(const cc_string * str, const char * text, int offset);
82
83 COIN_DLL_API void cc_string_apply(cc_string * str, cc_apply_f function);
84
85 COIN_DLL_API void cc_string_sprintf(cc_string * str, const char * formatstr, ...);
86 COIN_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 */
cc_string
The cc_string type is a C ADT for ASCII string management.This is a Coin extension.
Definition: string.h:41

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