Sync with 5.4.0
[deliverable/titan.core.git] / core / Addfunc.hh
CommitLineData
970ed795 1///////////////////////////////////////////////////////////////////////////////
3abe9331 2// Copyright (c) 2000-2015 Ericsson Telecom AB
970ed795
EL
3// All rights reserved. This program and the accompanying materials
4// are made available under the terms of the Eclipse Public License v1.0
5// which accompanies this distribution, and is available at
6// http://www.eclipse.org/legal/epl-v10.html
7///////////////////////////////////////////////////////////////////////////////
8#ifndef ADDFUNC_HH
9#define ADDFUNC_HH
10
11#include "Types.h"
12
13class INTEGER;
14class FLOAT;
15class BITSTRING;
16class BITSTRING_ELEMENT;
17class HEXSTRING;
18class HEXSTRING_ELEMENT;
19class OCTETSTRING;
20class OCTETSTRING_ELEMENT;
21class CHARSTRING;
22class CHARSTRING_ELEMENT;
23class UNIVERSAL_CHARSTRING;
24class UNIVERSAL_CHARSTRING_ELEMENT;
25class BITSTRING_template;
26class HEXSTRING_template;
27class OCTETSTRING_template;
28class CHARSTRING_template;
29class UNIVERSAL_CHARSTRING_template;
30
31extern char hexdigit_to_char(unsigned char hexdigit);
32
33// Additional predefined functions defined in Annex C of ES 101 873-1
34
35// C.1 - int2char
36extern CHARSTRING int2char(int value);
37extern CHARSTRING int2char(const INTEGER& value);
38
39// C.2 - int2unichar
40extern UNIVERSAL_CHARSTRING int2unichar(int value);
41extern UNIVERSAL_CHARSTRING int2unichar(const INTEGER& value);
42
43// C.3 - int2bit
44extern BITSTRING int2bit(int value, int length);
45extern BITSTRING int2bit(int value, const INTEGER& length);
46extern BITSTRING int2bit(const INTEGER& value, int length);
47extern BITSTRING int2bit(const INTEGER& value, const INTEGER& length);
48
49// C.4 - int2hex
50extern HEXSTRING int2hex(int value, int length);
51extern HEXSTRING int2hex(int value, const INTEGER& length);
52extern HEXSTRING int2hex(const INTEGER& value, int length);
53extern HEXSTRING int2hex(const INTEGER& value, const INTEGER& length);
54
55// C.5 - int2oct
56extern OCTETSTRING int2oct(int value, int length);
57extern OCTETSTRING int2oct(int value, const INTEGER& length);
58extern OCTETSTRING int2oct(const INTEGER& value, int length);
59extern OCTETSTRING int2oct(const INTEGER& value, const INTEGER& length);
60
61// C.6 - int2str
62extern CHARSTRING int2str(int value);
63extern CHARSTRING int2str(const INTEGER& value);
64
65// C.7 - int2float
66extern double int2float(int value);
67extern double int2float(const INTEGER& value);
68
69// C.8 - float2int
70extern INTEGER float2int(double value);
71extern INTEGER float2int(const FLOAT& value);
72
73// C.9 - char2int
74extern int char2int(char value);
75extern int char2int(const char *value);
76extern int char2int(const CHARSTRING& value);
77extern int char2int(const CHARSTRING_ELEMENT& value);
78
79// C.10 - char2oct
80extern OCTETSTRING char2oct(const char *value);
81extern OCTETSTRING char2oct(const CHARSTRING& value);
82extern OCTETSTRING char2oct(const CHARSTRING_ELEMENT& value);
83
84// C.11 - unichar2int
85extern int unichar2int(const universal_char& value);
86extern int unichar2int(const UNIVERSAL_CHARSTRING& value);
87extern int unichar2int(const UNIVERSAL_CHARSTRING_ELEMENT& value);
88
89// C.12 - bit2int
90extern INTEGER bit2int(const BITSTRING& value);
91extern INTEGER bit2int(const BITSTRING_ELEMENT& value);
92
93// C.13 - bit2hex
94extern HEXSTRING bit2hex(const BITSTRING& value);
95extern HEXSTRING bit2hex(const BITSTRING_ELEMENT& value);
96
97// C.14 - bit2oct
98extern OCTETSTRING bit2oct(const BITSTRING& value);
99extern OCTETSTRING bit2oct(const BITSTRING_ELEMENT& value);
100
101// C.15 - bit2str
102extern CHARSTRING bit2str(const BITSTRING& value);
103extern CHARSTRING bit2str(const BITSTRING_ELEMENT& value);
104
105// C.16 - hex2int
106extern INTEGER hex2int(const HEXSTRING& value);
107extern INTEGER hex2int(const HEXSTRING_ELEMENT& value);
108
109// C.17 - hex2bit
110extern BITSTRING hex2bit(const HEXSTRING& value);
111extern BITSTRING hex2bit(const HEXSTRING_ELEMENT& value);
112
113// C.18 - hex2oct
114extern OCTETSTRING hex2oct(const HEXSTRING& value);
115extern OCTETSTRING hex2oct(const HEXSTRING_ELEMENT& value);
116
117// C.19 - hex2str
118extern CHARSTRING hex2str(const HEXSTRING& value);
119extern CHARSTRING hex2str(const HEXSTRING_ELEMENT& value);
120
121// C.20 - oct2int
122extern INTEGER oct2int(const OCTETSTRING& value);
123extern INTEGER oct2int(const OCTETSTRING_ELEMENT& value);
124
125// C.21 - oct2bit
126extern BITSTRING oct2bit(const OCTETSTRING& value);
127extern BITSTRING oct2bit(const OCTETSTRING_ELEMENT& value);
128
129// C.22 - oct2hex
130extern HEXSTRING oct2hex(const OCTETSTRING& value);
131extern HEXSTRING oct2hex(const OCTETSTRING_ELEMENT& value);
132
133// C.23 - oct2str
134extern CHARSTRING oct2str(const OCTETSTRING& value);
135extern CHARSTRING oct2str(const OCTETSTRING_ELEMENT& value);
136
137// C.24 - oct2char
138extern CHARSTRING oct2char(const OCTETSTRING& value);
139extern CHARSTRING oct2char(const OCTETSTRING_ELEMENT& value);
140
141// C.25 - str2int
142extern INTEGER str2int(const char *value);
143extern INTEGER str2int(const CHARSTRING& value);
144extern INTEGER str2int(const CHARSTRING_ELEMENT& value);
145
146// C.26 - str2oct
147extern OCTETSTRING str2oct(const char *value);
148extern OCTETSTRING str2oct(const CHARSTRING& value);
149
150// C.27 - str2float
151extern double str2float(const char *value);
152extern double str2float(const CHARSTRING& value);
153
154// C.28 - lengthof: built-in
155
156// C.29 - sizeof: built-in
157
158// C.31 - ispresent: built-in
159
160// C.32 - ischosen: built-in
161
162// C.33 - regexp
163extern CHARSTRING regexp(const CHARSTRING& instr, const CHARSTRING& expression,
164 int groupno);
165extern CHARSTRING regexp(const CHARSTRING& instr, const CHARSTRING& expression,
166 const INTEGER& groupno);
167extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
168 const UNIVERSAL_CHARSTRING* expression_val,
169 const UNIVERSAL_CHARSTRING_template* expression_tmpl,
170 int groupno);
171extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
172 const UNIVERSAL_CHARSTRING& expression, int groupno);
173extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
174 const UNIVERSAL_CHARSTRING& expression, const INTEGER& groupno);
175// regexp on templates
176extern CHARSTRING regexp(const CHARSTRING_template& instr,
177 const CHARSTRING_template& expression, int groupno);
178extern CHARSTRING regexp(const CHARSTRING_template& instr,
179 const CHARSTRING_template& expression, const INTEGER& groupno);
180extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING_template& instr,
181 const UNIVERSAL_CHARSTRING_template& expression, int groupno);
182extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING_template& instr,
183 const UNIVERSAL_CHARSTRING_template& expression, const INTEGER& groupno);
184
185// C.34 - substr
186extern void check_substr_arguments(int value_length, int index,
187 int returncount, const char *string_type, const char *element_name);
188extern BITSTRING substr(const BITSTRING& value, int index, int returncount);
189extern BITSTRING substr(const BITSTRING& value, int index,
190 const INTEGER& returncount);
191extern BITSTRING substr(const BITSTRING& value, const INTEGER& index,
192 int returncount);
193extern BITSTRING substr(const BITSTRING& value, const INTEGER& index,
194 const INTEGER& returncount);
195extern BITSTRING substr(const BITSTRING_ELEMENT& value, int index,
196 int returncount);
197extern BITSTRING substr(const BITSTRING_ELEMENT& value, int index,
198 const INTEGER& returncount);
199extern BITSTRING substr(const BITSTRING_ELEMENT& value, const INTEGER& index,
200 int returncount);
201extern BITSTRING substr(const BITSTRING_ELEMENT& value, const INTEGER& index,
202 const INTEGER& returncount);
203
204extern HEXSTRING substr(const HEXSTRING& value, int index, int returncount);
205extern HEXSTRING substr(const HEXSTRING& value, int index,
206 const INTEGER& returncount);
207extern HEXSTRING substr(const HEXSTRING& value, const INTEGER& index,
208 int returncount);
209extern HEXSTRING substr(const HEXSTRING& value, const INTEGER& index,
210 const INTEGER& returncount);
211extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, int index,
212 int returncount);
213extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, int index,
214 const INTEGER& returncount);
215extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, const INTEGER& index,
216 int returncount);
217extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, const INTEGER& index,
218 const INTEGER& returncount);
219
220extern OCTETSTRING substr(const OCTETSTRING& value, int index,
221 int returncount);
222extern OCTETSTRING substr(const OCTETSTRING& value, int index,
223 const INTEGER& returncount);
224extern OCTETSTRING substr(const OCTETSTRING& value, const INTEGER& index,
225 int returncount);
226extern OCTETSTRING substr(const OCTETSTRING& value, const INTEGER& index,
227 const INTEGER& returncount);
228extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value, int index,
229 int returncount);
230extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value, int index,
231 const INTEGER& returncount);
232extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value,
233 const INTEGER& index, int returncount);
234extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value,
235 const INTEGER& index, const INTEGER& returncount);
236
237extern CHARSTRING substr(const CHARSTRING& value, int index,
238 int returncount);
239extern CHARSTRING substr(const CHARSTRING& value, int index,
240 const INTEGER& returncount);
241extern CHARSTRING substr(const CHARSTRING& value, const INTEGER& index,
242 int returncount);
243extern CHARSTRING substr(const CHARSTRING& value, const INTEGER& index,
244 const INTEGER& returncount);
245extern CHARSTRING substr(const CHARSTRING_ELEMENT& value, int index,
246 int returncount);
247extern CHARSTRING substr(const CHARSTRING_ELEMENT& value, int index,
248 const INTEGER& returncount);
249extern CHARSTRING substr(const CHARSTRING_ELEMENT& value,
250 const INTEGER& index, int returncount);
251extern CHARSTRING substr(const CHARSTRING_ELEMENT& value,
252 const INTEGER& index, const INTEGER& returncount);
253
254extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
255 int index, int returncount);
256extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
257 int index, const INTEGER& returncount);
258extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
259 const INTEGER& index, int returncount);
260extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
261 const INTEGER& index, const INTEGER& returncount);
262extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
263 int index, int returncount);
264extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
265 int index, const INTEGER& returncount);
266extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
267 const INTEGER& index, int returncount);
268extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
269 const INTEGER& index, const INTEGER& returncount);
270
271// substr for templates
272extern BITSTRING substr(const BITSTRING_template& value, int index,
273 int returncount);
274extern BITSTRING substr(const BITSTRING_template& value, int index,
275 const INTEGER& returncount);
276extern BITSTRING substr(const BITSTRING_template& value, const INTEGER& index,
277 int returncount);
278extern BITSTRING substr(const BITSTRING_template& value, const INTEGER& index,
279 const INTEGER& returncount);
280
281extern HEXSTRING substr(const HEXSTRING_template& value, int index,
282 int returncount);
283extern HEXSTRING substr(const HEXSTRING_template& value, int index,
284 const INTEGER& returncount);
285extern HEXSTRING substr(const HEXSTRING_template& value, const INTEGER& index,
286 int returncount);
287extern HEXSTRING substr(const HEXSTRING_template& value, const INTEGER& index,
288 const INTEGER& returncount);
289
290extern OCTETSTRING substr(const OCTETSTRING_template& value, int index,
291 int returncount);
292extern OCTETSTRING substr(const OCTETSTRING_template& value, int index,
293 const INTEGER& returncount);
294extern OCTETSTRING substr(const OCTETSTRING_template& value, const INTEGER& index,
295 int returncount);
296extern OCTETSTRING substr(const OCTETSTRING_template& value, const INTEGER& index,
297 const INTEGER& returncount);
298
299extern CHARSTRING substr(const CHARSTRING_template& value, int index,
300 int returncount);
301extern CHARSTRING substr(const CHARSTRING_template& value, int index,
302 const INTEGER& returncount);
303extern CHARSTRING substr(const CHARSTRING_template& value, const INTEGER& index,
304 int returncount);
305extern CHARSTRING substr(const CHARSTRING_template& value, const INTEGER& index,
306 const INTEGER& returncount);
307
308extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
309 int index, int returncount);
310extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
311 int index, const INTEGER& returncount);
312extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
313 const INTEGER& index, int returncount);
314extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
315 const INTEGER& index, const INTEGER& returncount);
316
317// C.35 - replace
318extern void check_replace_arguments(int value_length, int index, int len,
319 const char *string_type, const char *element_name);
320extern BITSTRING replace(const BITSTRING& value, int index, int len,
321 const BITSTRING& repl);
322extern BITSTRING replace(const BITSTRING& value, int index,
323 const INTEGER& len, const BITSTRING& repl);
324extern BITSTRING replace(const BITSTRING& value, const INTEGER& index,
325 int len, const BITSTRING& repl);
326extern BITSTRING replace(const BITSTRING& value, const INTEGER& index,
327 const INTEGER& len, const BITSTRING& repl);
328
329extern HEXSTRING replace(const HEXSTRING& value, int index, int len,
330 const HEXSTRING& repl);
331extern HEXSTRING replace(const HEXSTRING& value, int index,
332 const INTEGER& len, const HEXSTRING& repl);
333extern HEXSTRING replace(const HEXSTRING& value, const INTEGER& index,
334 int len, const HEXSTRING& repl);
335extern HEXSTRING replace(const HEXSTRING& value, const INTEGER& index,
336 const INTEGER& len, const HEXSTRING& repl);
337
338extern OCTETSTRING replace(const OCTETSTRING& value, int index, int len,
339 const OCTETSTRING& repl);
340extern OCTETSTRING replace(const OCTETSTRING& value, int index,
341 const INTEGER& len, const OCTETSTRING& repl);
342extern OCTETSTRING replace(const OCTETSTRING& value, const INTEGER& index,
343 int len, const OCTETSTRING& repl);
344extern OCTETSTRING replace(const OCTETSTRING& value, const INTEGER& index,
345 const INTEGER& len, const OCTETSTRING& repl);
346
347extern CHARSTRING replace(const CHARSTRING& value, int index, int len,
348 const CHARSTRING& repl);
349extern CHARSTRING replace(const CHARSTRING& value, int index,
350 const INTEGER& len, const CHARSTRING& repl);
351extern CHARSTRING replace(const CHARSTRING& value, const INTEGER& index,
352 int len, const CHARSTRING& repl);
353extern CHARSTRING replace(const CHARSTRING& value, const INTEGER& index,
354 const INTEGER& len, const CHARSTRING& repl);
355
356extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
357 int index, int len, const UNIVERSAL_CHARSTRING& repl);
358extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
359 int index, const INTEGER& len, const UNIVERSAL_CHARSTRING& repl);
360extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
361 const INTEGER& index, int len, const UNIVERSAL_CHARSTRING& repl);
362extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
363 const INTEGER& index, const INTEGER& len,
364 const UNIVERSAL_CHARSTRING& repl);
365// replace - template parameters
366extern BITSTRING replace(const BITSTRING_template& value, int index, int len,
367 const BITSTRING_template& repl);
368extern BITSTRING replace(const BITSTRING_template& value, int index,
369 const INTEGER& len, const BITSTRING_template& repl);
370extern BITSTRING replace(const BITSTRING_template& value, const INTEGER& index,
371 int len, const BITSTRING_template& repl);
372extern BITSTRING replace(const BITSTRING_template& value, const INTEGER& index,
373 const INTEGER& len, const BITSTRING_template& repl);
374
375extern HEXSTRING replace(const HEXSTRING_template& value, int index, int len,
376 const HEXSTRING_template& repl);
377extern HEXSTRING replace(const HEXSTRING_template& value, int index,
378 const INTEGER& len, const HEXSTRING_template& repl);
379extern HEXSTRING replace(const HEXSTRING_template& value, const INTEGER& index,
380 int len, const HEXSTRING_template& repl);
381extern HEXSTRING replace(const HEXSTRING_template& value, const INTEGER& index,
382 const INTEGER& len, const HEXSTRING_template& repl);
383
384extern OCTETSTRING replace(const OCTETSTRING_template& value, int index, int len,
385 const OCTETSTRING& repl);
386extern OCTETSTRING replace(const OCTETSTRING_template& value, int index,
387 const INTEGER& len, const OCTETSTRING& repl);
388extern OCTETSTRING replace(const OCTETSTRING_template& value, const INTEGER& index,
389 int len, const OCTETSTRING_template& repl);
390extern OCTETSTRING replace(const OCTETSTRING_template& value, const INTEGER& index,
391 const INTEGER& len, const OCTETSTRING_template& repl);
392
393extern CHARSTRING replace(const CHARSTRING_template& value, int index, int len,
394 const CHARSTRING_template& repl);
395extern CHARSTRING replace(const CHARSTRING_template& value, int index,
396 const INTEGER& len, const CHARSTRING_template& repl);
397extern CHARSTRING replace(const CHARSTRING_template& value, const INTEGER& index,
398 int len, const CHARSTRING_template& repl);
399extern CHARSTRING replace(const CHARSTRING_template& value, const INTEGER& index,
400 const INTEGER& len, const CHARSTRING_template& repl);
401
402extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
403 int index, int len, const UNIVERSAL_CHARSTRING_template& repl);
404extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
405 int index, const INTEGER& len, const UNIVERSAL_CHARSTRING_template& repl);
406extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
407 const INTEGER& index, int len, const UNIVERSAL_CHARSTRING_template& repl);
408extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
409 const INTEGER& index, const INTEGER& len,
410 const UNIVERSAL_CHARSTRING_template& repl);
411
412
413// C.36 - rnd
414extern double rnd();
415extern double rnd(double seed);
416extern double rnd(const FLOAT& seed);
417
418
419// Additional predefined functions defined in Annex B of ES 101 873-7
420
421// B.1 decomp - not implemented yet
422
423
424// Non-standard functions
425
426// str2bit
427extern BITSTRING str2bit(const char *value);
428extern BITSTRING str2bit(const CHARSTRING& value);
429extern BITSTRING str2bit(const CHARSTRING_ELEMENT& value);
430
431// str2hex
432extern HEXSTRING str2hex(const char *value);
433extern HEXSTRING str2hex(const CHARSTRING& value);
434extern HEXSTRING str2hex(const CHARSTRING_ELEMENT& value);
435
436// float2str
437extern CHARSTRING float2str(double value);
438extern CHARSTRING float2str(const FLOAT& value);
439
440// unichar2char
441extern CHARSTRING unichar2char(const UNIVERSAL_CHARSTRING& value);
442extern CHARSTRING unichar2char(const UNIVERSAL_CHARSTRING_ELEMENT& value);
443
444// only for internal purposes
445extern CHARSTRING get_port_name(const char *port_name, int array_index);
446extern CHARSTRING get_port_name(const char *port_name,
447 const INTEGER& array_index);
448extern CHARSTRING get_port_name(const CHARSTRING& port_name, int array_index);
449extern CHARSTRING get_port_name(const CHARSTRING& port_name,
450 const INTEGER& array_index);
451
452unsigned char char_to_hexdigit(char c);
453
454// unichar2oct
455extern OCTETSTRING unichar2oct(const UNIVERSAL_CHARSTRING& invalue); // default string_encoding UTF-8
456extern OCTETSTRING unichar2oct(const UNIVERSAL_CHARSTRING& invalue,
457 const CHARSTRING& string_encoding);
458//oct2unichar
459extern UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue ); // default string_encoding UTF-8
460extern UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue,
461 const CHARSTRING& string_encoding);
462
463extern CHARSTRING get_stringencoding(const OCTETSTRING& encoded__value);
464extern OCTETSTRING remove_bom(const OCTETSTRING& encoded__value);
465extern CHARSTRING encode_base64(const OCTETSTRING& msg, bool use_linebreaks);
466extern CHARSTRING encode_base64(const OCTETSTRING& msg);
467extern OCTETSTRING decode_base64(const CHARSTRING& b64);
468
469#endif
This page took 0.042091 seconds and 5 git commands to generate.