summaryrefslogtreecommitdiffstats
path: root/libvideoeditor/osal/inc/M4OSA_String.h
blob: 3fcf4ed75d0f0fd301f39670625caf56db909db5 (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
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
/*
 * Copyright (C) 2004-2011 NXP Software
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 ************************************************************************
 * @file         M4OSA_String.h
 * @ingroup      OSAL
 * @brief        public definition for string library
 ************************************************************************
*/

#ifndef _M4OSA_STRING_H_
#define _M4OSA_STRING_H_

#include "M4OSA_Types.h"
#include "M4OSA_FileCommon.h"
#include "M4OSA_Time.h"
#include "M4OSA_CharStar.h"



typedef void* M4OSA_String;

typedef enum
{
   M4OSA_kstrAll = 0,
   M4OSA_kstrBegin,
   M4OSA_kstrEnd
} M4OSA_strMode;

/* types definition */
typedef enum
{
   M4OSA_kstrDec   = M4OSA_kchrDec,
   M4OSA_kstrHexa  = M4OSA_kchrHexa,
   M4OSA_kstrOct   = M4OSA_kchrOct
} M4OSA_strNumBase;

/* Error and Warnings codes */
#define M4ERR_STR_BAD_STRING           M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000001)
#define M4ERR_STR_CONV_FAILED          M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000002)
#define M4ERR_STR_OVERFLOW             M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000003)
#define M4ERR_STR_BAD_ARGS             M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000004)

#define M4WAR_STR_OVERFLOW             M4OSA_ERR_CREATE(M4_WAR,M4OSA_STRING,0x000001)
#define M4WAR_STR_NOT_FOUND            M4OSA_ERR_CREATE(M4_WAR,M4OSA_STRING,0x000002)


#ifdef __cplusplus
extern "C"
{
#endif


M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCreate(                M4OSA_String* pstr);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strReset(                 M4OSA_String str);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strDestroy(               M4OSA_String str);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetCharContent(        M4OSA_String str,
                                          M4OSA_Char* pchar);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetCharContent(        M4OSA_String str,
                                          M4OSA_Char** ppchar);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetChar(               M4OSA_String str,
                                          M4OSA_Char c);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetChar(               M4OSA_String str,
                                          M4OSA_Char* pc);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt8(               M4OSA_String str,
                                          M4OSA_Int8 i8,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt8(               M4OSA_String str,
                                          M4OSA_Int8* pi8,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUInt8(              M4OSA_String str,
                                          M4OSA_UInt8 ui8,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetUInt8(              M4OSA_String str,
                                          M4OSA_UInt8* pui8,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt16(              M4OSA_String str,
                                          M4OSA_Int16 i16,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt16(              M4OSA_String str,
                                          M4OSA_Int16* pi16,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUInt16(             M4OSA_String str,
                                          M4OSA_UInt16 ui16,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetUInt16(             M4OSA_String str,
                                          M4OSA_UInt16* pui16,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt32(              M4OSA_String str,
                                          M4OSA_Int32 i32,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt32(              M4OSA_String str,
                                          M4OSA_Int32* pi32,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUInt32(             M4OSA_String str,
                                          M4OSA_UInt32 ui32,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetUInt32(             M4OSA_String str,
                                          M4OSA_UInt32* pui32,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetDouble(             M4OSA_String str,
                                          M4OSA_Double d);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetDouble(             M4OSA_String str,
                                          M4OSA_Double* pd);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt64(              M4OSA_String str,
                                          M4OSA_Int64 i64,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt64(              M4OSA_String str,
                                          M4OSA_Int64* pi64,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetFilePosition(       M4OSA_String str,
                                          M4OSA_FilePosition fpos,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetFilePosition(       M4OSA_String str,
                                          M4OSA_FilePosition* pfpos,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetTime(               M4OSA_String str,
                                          M4OSA_Time t,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetTime(               M4OSA_String str,
                                          M4OSA_Time* pt,
                                          M4OSA_strNumBase base);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetLength(             M4OSA_String str,
                                          M4OSA_UInt32 *pui32);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strTruncate(              M4OSA_String str,
                                          M4OSA_UInt32 ui32_length);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCopy(                  M4OSA_String str_in,
                                          M4OSA_String str_out);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCopySubStr(            M4OSA_String str_out,
                                          M4OSA_UInt32 ui32_pos,
                                          M4OSA_String str_in,
                                          M4OSA_UInt32 ui32_offset,
                                          M4OSA_UInt32* ui32_num);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strConcat(                M4OSA_String str_first,
                                          M4OSA_String str_second);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strInsertSubStr(          M4OSA_String str_out,
                                          M4OSA_UInt32 ui32_pos,
                                          M4OSA_String str_in,
                                          M4OSA_UInt32 ui32_offset,
                                          M4OSA_UInt32* pui32_num);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCompare(               M4OSA_String str_in1,
                                          M4OSA_String str_in2,
                                          M4OSA_Int32* pi32_result);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCompareSubStr(         M4OSA_String str_in1,
                                          M4OSA_UInt32 ui32_offset1,
                                          M4OSA_String str_in2,
                                          M4OSA_UInt32 ui32_offset2,
                                          M4OSA_UInt32* pui32_num,
                                          M4OSA_Int32* pi32_result);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCaseCompare(           M4OSA_String str_in1,
                                          M4OSA_String str_in2,
                                          M4OSA_Int32* pi32_result);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCaseCompareSubStr(     M4OSA_String str_in1,
                                          M4OSA_UInt32 ui32_offset1,
                                          M4OSA_String str_in2,
                                          M4OSA_UInt32 ui32_offset2,
                                          M4OSA_UInt32* pui32_num,
                                          M4OSA_Int32* pi32_result);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSpan(                  M4OSA_String str_in,
                                          M4OSA_Char* charset,
                                          M4OSA_UInt32* pui32_result);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSpanComplement(        M4OSA_String str_in,
                                          M4OSA_Char* charset,
                                          M4OSA_UInt32* pui32_pos);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindFirstChar(         M4OSA_String str_in,
                                          M4OSA_Char c,
                                          M4OSA_UInt32* pui32_pos);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindLastChar(          M4OSA_String str_in,
                                          M4OSA_Char c,
                                          M4OSA_UInt32* pui32_pos);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindFirstSubStr(       M4OSA_String str_in1,
                                          M4OSA_String str_in2,
                                          M4OSA_UInt32* pui32_pos);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindLastSubStr(        M4OSA_String str_in1,
                                          M4OSA_String str_in2,
                                          M4OSA_UInt32* pui32_pos);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetFirstToken(         M4OSA_String str_in,
                                          M4OSA_String str_delim,
                                          M4OSA_String pstr_token);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetLastToken(          M4OSA_String str_in,
                                          M4OSA_String str_delim,
                                          M4OSA_String pstr_token);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUpperCase(          M4OSA_String str);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetLowerCase(          M4OSA_String str);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strDelSubStr(             M4OSA_String str_in,
                                          M4OSA_UInt32 ui32_offset,
                                          M4OSA_UInt32* ui32_num);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strReplaceSubStr(         M4OSA_String str_in,
                                          M4OSA_String str_old,
                                          M4OSA_String str_new,
                                          M4OSA_strMode mode);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSprintf(               M4OSA_String str,
                                          M4OSA_Char* format,
                                          ...);

M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetMinAllocationSize(  M4OSA_String str,
                                          M4OSA_UInt32 ui32_size);

#ifdef __cplusplus
}
#endif

#endif