summaryrefslogtreecommitdiffstats
path: root/src/vf_string_arrays.h
blob: 252da03071711ac2a82361cc8b8c27b8e441df1f (plain)
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
/*******************************************************************************

    (C) Nick Marley, 2001 -

    This software is distributed under the GNU Lesser General Public Licence.
    Please read and understand the comments at the top of vf_iface.h before use!

FILE
    $Workfile: vf_internals.h $
    $Revision: 1.2 $
    $Author: tilda $

ORIGINAL AUTHOR
    Nick Marley

DESCRIPTION
    Utility functions handling string arrays - the VSTRARRAY_T type.

REFERENCES
    (none)

MODIFICATION HISTORY
 *  $Log: vf_string_arrays.h,v $
 *  Revision 1.2  2002/11/02 18:29:26  tilda
 *  IID485157 - UI does character conversion based on CHARSET property.
 *
 *  Revision 1.1  2002/10/26 15:57:11  tilda
 *  Initial Version
 * 
 *******************************************************************************/

#ifndef _VF_STRING_ARRAYS_H_
#define _VF_STRING_ARRAYS_H_

#ifndef NORCSID
static const char vf_string_arrays_h_vss_id[] = "$Header: /cvsroot/vformat/src/vformat/src/vf_string_arrays.h,v 1.2 2002/11/02 18:29:26 tilda Exp $";
#endif

/*=============================================================================*
 Public Includes
 *============================================================================*/
/* None */

/*=============================================================================*
 Public Defines
 *============================================================================*/
/* None */

/*=============================================================================*
 Public Types
 *============================================================================*/
/* None */

/*=============================================================================*
 Public Functions
 *============================================================================*/


/*----------------------------------------------------------------------------*
 * NAME
 *      string_array_contains_string()
 * 
 * DESCRIPTION
 *      Checks the strings in the indicated array to see if it contains a
 *      particulr value.  Can check a particular index or the whole array.
 *      Can perform an exact match or check wether one of the strings simply
 *      contains the value.
 *
 * RETURNS
 *      TRUE <=> includes indicated value, FALSE else.
 *----------------------------------------------------------------------------*/

extern bool_t string_array_contains_string(
    VSTRARRAY_T *p_strarray,        /* String array */
    char **pp_string_found,         /* String found */
    uint32_t index,                 /* Which entry, (-1) => any */
    const char *p_string,           /* The string we're looking for */
    bool_t exact                    /* Exact or partial match */
    );


/*----------------------------------------------------------------------------*
 * NAME
 *      add_string_to_array()
 * 
 * DESCRIPTION
 *      Append string to indicated array.
 *
 * RETURNS
 *      TRUE <=> allocation OK, FALSE else.
 *----------------------------------------------------------------------------*/

extern bool_t add_string_to_array(
    VSTRARRAY_T *p_strarray,        /* String array */
    const char *p_string            /* String to add */
    );


/*----------------------------------------------------------------------------*
 * NAME
 *      free_string_array_contents()
 * 
 * DESCRIPTION
 *      Delete contents of a string array.  The structure itself is not free()d.
 *
 * RETURNS
 *      (none)
 *----------------------------------------------------------------------------*/

extern void free_string_array_contents(
    VSTRARRAY_T *p_strarray         /* String array */
    );


/*----------------------------------------------------------------------------*
 * NAME
 *      append_to_curr_string()
 * 
 * DESCRIPTION
 *      Append characters to the current string in a string array.
 *
 * RETURNS
 *      TRUE <=> allocation OK, FALSE else.
 *----------------------------------------------------------------------------*/

extern bool_t append_to_curr_string(
    VSTRARRAY_T *p_strarray,        /* String array */
    uint32_t *p_length,             /* Pointer to length, NULL if zero terminated */
    const char *p_chars,            /* Characters to append */
    uint32_t numchars               /* Number of characters */
    );


/*----------------------------------------------------------------------------*
 * NAME
 *      append_to_pointer()
 * 
 * DESCRIPTION
 *      Append characters to indicated pointer.  Handles both NULL terminated
 *      strings (for simple 7-bit values) and buffer/length pairs.  Passing
 *      the p_length field indicates that we're building up binary data.
 *
 * RETURNS
 *      TRUE <=> allocation OK, FALSE else.
 *----------------------------------------------------------------------------*/

extern bool_t append_to_pointer(
    char **pp_string,               /* String we're appending to */
    uint32_t *p_length,             /* Pointer to length, NULL if ZT */
    const char *p_chars,            /* Chars we're appending */
    int numchars                    /* Number of chars we're appending */
    );


/*----------------------------------------------------------------------------*
 * NAME
 *      set_string_array_entry()
 * 
 * DESCRIPTION
 *      Set indicated entry in a string array.
 *
 * RETURNS
 *      TRUE <=> allocation OK, FALSE else.
 *----------------------------------------------------------------------------*/

extern bool_t set_string_array_entry(
    VSTRARRAY_T *p_strarray,        /* String array */
    const char *p_string,           /* String to insert */
    uint32_t n_string               /* Insertion point */
    );


/*=============================================================================*
 End of file
 *============================================================================*/

#endif /*_VF_STRING_ARRAYS_H_*/