Sync with 5.4.0
[deliverable/titan.core.git] / core / Universal_charstring.hh
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
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 UNIVERSAL_CHARSTRING_HH
9 #define UNIVERSAL_CHARSTRING_HH
10
11 #include "Basetype.hh"
12 #include "Template.hh"
13 #include "Optional.hh"
14 #include "Error.hh"
15 #include "CharCoding.hh"
16
17 #include <regex.h>
18 #include "Charstring.hh"
19
20 class CHARSTRING;
21 class CHARSTRING_ELEMENT;
22 class CHARSTRING_template;
23 class UNIVERSAL_CHARSTRING_ELEMENT;
24 class UNIVERSAL_CHARSTRING_template;
25 class INTEGER;
26 class Module_Param;
27
28 extern boolean operator==(const universal_char& left_value,
29 const universal_char& right_value);
30 extern boolean operator<(const universal_char& left_value,
31 const universal_char& right_value);
32
33 /** Runtime class for Unicode character strings.
34 *
35 * This class implements the following string types:
36 * - TTCN-3 \c universal \c charstring
37 * - ASN.1
38 * - \c UTF8String
39 * - \c TeletexString
40 * - \c VideotexString
41 * - \c GraphicsString
42 * - \c GeneralString
43 * - \c UniversalString
44 * - \c BMPString
45 * - \c ObjectDescriptor
46 *
47 * Note: an object of this class is effectively immutable after creation.
48 *
49 * There is no terminating {0,0,0,0} at the end.
50 */
51 class UNIVERSAL_CHARSTRING : public Base_Type {
52
53 friend class CHARSTRING;
54 friend class CHARSTRING_ELEMENT;
55 friend class UNIVERSAL_CHARSTRING_ELEMENT;
56 friend class TTCN_Buffer;
57 friend class UNIVERSAL_CHARSTRING_template;
58
59 friend UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue,
60 const CHARSTRING& string_encoding);
61 friend UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue);
62 friend UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
63 int index, int len, const UNIVERSAL_CHARSTRING& repl);
64 friend UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
65 const UNIVERSAL_CHARSTRING* expression_val,
66 const UNIVERSAL_CHARSTRING_template* expression_tmpl,
67 int groupno);
68
69 friend boolean operator==(const universal_char& uchar_value,
70 const UNIVERSAL_CHARSTRING& other_value);
71 friend UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
72 const UNIVERSAL_CHARSTRING& other_value);
73 friend boolean operator==(const char *string_value,
74 const UNIVERSAL_CHARSTRING& other_value);
75 friend UNIVERSAL_CHARSTRING operator+(const char *string_value,
76 const UNIVERSAL_CHARSTRING& other_value);
77 friend UNIVERSAL_CHARSTRING operator+(const char *string_value,
78 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
79 friend UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
80 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
81 friend boolean operator==(const char *string_value,
82 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
83
84 /** Internal data type, no user serviceable parts inside */
85 struct universal_charstring_struct;
86 /** Internal data */
87 universal_charstring_struct *val_ptr;
88 /** Character string values are stored in an optimal way */
89 CHARSTRING cstr;
90 bool charstring;
91
92 void init_struct(int n_uchars);
93 void copy_value();
94 UNIVERSAL_CHARSTRING(int n_uchars, bool cstring = false);
95
96 /** An extended version of set_param(), which also accepts string patterns if
97 * the second parameter is set (needed by UNIVERSAL_CHARSTRING_template to
98 * concatenate string patterns).
99 * @return TRUE, if the module parameter was a string pattern, otherwise FALSE */
100 boolean set_param_internal(Module_Param& param, boolean allow_pattern);
101
102 public:
103
104 /** Construct an empty string */
105 UNIVERSAL_CHARSTRING();
106 /** Construct a string containing a single character.
107 *
108 * @param uc_group Unicode group (most significant part)
109 * @param uc_plane Unicode plane
110 * @param uc_row Unicode row
111 * @param uc_cell Unicode cell (least significant)
112 *
113 */
114 UNIVERSAL_CHARSTRING(unsigned char uc_group, unsigned char uc_plane,
115 unsigned char uc_row, unsigned char uc_cell);
116 /** Construct a string containing a single character
117 *
118 * @param other_value
119 */
120 UNIVERSAL_CHARSTRING(const universal_char& other_value);
121 /** Construct a string from a given number of characters
122 *
123 * @param n_uchars
124 * @param uchars_ptr
125 */
126 UNIVERSAL_CHARSTRING(int n_uchars, const universal_char *uchars_ptr);
127 /** Construct a string from a C string
128 *
129 * @param chars_ptr pointer to the source string. A NULL pointer
130 * will result in an empty UNIVERSAL_CHARSTRING.
131 *
132 * All characters in the string will have group==plane==row==0
133 */
134 UNIVERSAL_CHARSTRING(const char *chars_ptr);
135 /** Construct a string from a known number of single-byte characters
136 *
137 * @param n_chars number of characters
138 * @param chars_ptr pointer to the source string.
139 *
140 * @pre if n_chars > 0, chars_ptr must point to a valid string,
141 * else an access violation will occur.
142 *
143 * All characters in the string will have group==plane==row==0
144 */
145 UNIVERSAL_CHARSTRING(int n_chars, const char *chars_ptr);
146 /** Construct a copy of another CHARSTRING
147 *
148 * @param other_value
149 */
150 UNIVERSAL_CHARSTRING(const CHARSTRING& other_value);
151 /** Construct a string containing a single CHARSTRING_ELEMENT
152 *
153 * @param other_value
154 */
155 UNIVERSAL_CHARSTRING(const CHARSTRING_ELEMENT& other_value);
156 /** Copy constructor
157 *
158 * @param other_value
159 */
160 UNIVERSAL_CHARSTRING(const UNIVERSAL_CHARSTRING& other_value);
161 /** Construct a string containing a single UNIVERSAL_CHARSTRING_ELEMENT
162 *
163 * @param other_value
164 */
165 UNIVERSAL_CHARSTRING(const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
166
167 ~UNIVERSAL_CHARSTRING();
168 void clean_up();
169
170 UNIVERSAL_CHARSTRING& operator=(const universal_char& other_value);
171 UNIVERSAL_CHARSTRING& operator=(const char* other_value);
172 UNIVERSAL_CHARSTRING& operator=(const CHARSTRING& other_value);
173 UNIVERSAL_CHARSTRING& operator=(const CHARSTRING_ELEMENT& other_value);
174 UNIVERSAL_CHARSTRING& operator=(const UNIVERSAL_CHARSTRING& other_value);
175 UNIVERSAL_CHARSTRING& operator=(const UNIVERSAL_CHARSTRING_ELEMENT&
176 other_value);
177
178 /** @name Comparison operators
179 * @{
180 */
181 boolean operator==(const universal_char& other_value) const;
182 boolean operator==(const char* other_value) const;
183 boolean operator==(const CHARSTRING& other_value) const;
184 boolean operator==(const CHARSTRING_ELEMENT& other_value) const;
185 boolean operator==(const UNIVERSAL_CHARSTRING& other_value) const;
186 boolean operator==(const UNIVERSAL_CHARSTRING_ELEMENT&
187 other_value) const;
188
189 boolean operator!=(const universal_char& other_value) const
190 { return !(*this == other_value); }
191 boolean operator!=(const char* other_value) const
192 { return !(*this == other_value); }
193 boolean operator!=(const CHARSTRING& other_value) const
194 { return !(*this == other_value); }
195 boolean operator!=(const CHARSTRING_ELEMENT& other_value) const
196 { return !(*this == other_value); }
197 boolean operator!=(const UNIVERSAL_CHARSTRING& other_value) const
198 { return !(*this == other_value); }
199 boolean operator!=(const UNIVERSAL_CHARSTRING_ELEMENT&
200 other_value) const { return !(*this == other_value); }
201 /** @} */
202
203 /** @name Concatenation
204 *
205 *
206 * @{
207 */
208 UNIVERSAL_CHARSTRING operator+(const universal_char& other_value) const;
209 UNIVERSAL_CHARSTRING operator+(const char* other_value) const;
210 UNIVERSAL_CHARSTRING operator+(const CHARSTRING& other_value) const;
211 UNIVERSAL_CHARSTRING operator+(const CHARSTRING_ELEMENT& other_value) const;
212 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING& other_value) const;
213 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING_ELEMENT&
214 other_value) const;
215 /** @} */
216
217 /** @name Rotation
218 * @{ */
219 UNIVERSAL_CHARSTRING operator<<=(int rotate_count) const;
220 UNIVERSAL_CHARSTRING operator<<=(const INTEGER& rotate_count) const;
221 UNIVERSAL_CHARSTRING operator>>=(int rotate_count) const;
222 UNIVERSAL_CHARSTRING operator>>=(const INTEGER& rotate_count) const;
223 /** @} */
224
225 /** @name Indexing
226 * @{ */
227 UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value);
228 UNIVERSAL_CHARSTRING_ELEMENT operator[](const INTEGER& index_value);
229 const UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value) const;
230 const UNIVERSAL_CHARSTRING_ELEMENT operator[]
231 (const INTEGER& index_value) const;
232 /** @} */
233
234 operator const universal_char*() const;
235
236 inline boolean is_bound() const {
237 if (charstring) return cstr.is_bound();
238 else return val_ptr != NULL; }
239 inline boolean is_value() const {
240 if (charstring) return cstr.is_value();
241 else return val_ptr != NULL; }
242 inline void must_bound(const char *err_msg) const
243 { if (charstring) cstr.must_bound(err_msg);
244 else if (val_ptr == NULL) TTCN_error("%s", err_msg); }
245
246 int lengthof() const;
247
248 void dump() const;
249
250 private:
251 // convert this string to character string for pattern matching: ([A-P]{8})*
252 char* convert_to_regexp_form() const;
253
254 /* returns the CHARSTRING representation of this. Quadruples are converted
255 into the form: \q{group,plane,row,cell} */
256 CHARSTRING get_stringRepr_for_pattern() const;
257
258 void convert_cstr_to_uni();
259 //checks if an valid BOM is at the head of the string. Returns the length of BOM
260 int check_BOM(CharCoding::CharCodingType expected_coding, unsigned int length,
261 const unsigned char* ostr);
262
263 /** Returns the universal charstring in the format a string would appear in C or TTCN-3 code.
264 * Inserts double quotation marks to the begining and end of the string and
265 * doubles the backlsashes in escaped characters.
266 * Used for JSON encoding.
267 *
268 * @param p_buf The buffer containing the universal charstring in UTF-8 encoding
269 *
270 * Example: "He said\nhis name was \"Al\"." -> "\"He said\\nhis name was \\\"Al\\\".\""
271 * Example2: char(0, 0, 1, 113) in TTCN-3 -> "\u0171"
272 * @note The returned character buffer needs to be freed after use. */
273 char* to_JSON_string(const TTCN_Buffer& p_buf) const;
274
275 /** Converts the universal charstring from JSON string format to normal format.
276 * The double quotation marks from the beginning and end of the JSON string are
277 * removed and double-escaped characters are changed to simple-escaped ones.
278 * JSON characters stored as \u + 4 hex digits are converted to the characters
279 * they represent.
280 * Returns false if any invalid characters were found, otherwise true.
281 * Used for JSON decoding.
282 *
283 * Example: "\"He said\\nhis name was \\\"Al\\\".\"" -> "He said\nhis name was \"Al\"."
284 * Example2: "\u0061" -> "a"
285 *
286 * @param check_quotes turn the checking of double quotes (mentioned above) on or off */
287 boolean from_JSON_string(boolean check_quotes);
288
289 /** Checks the coding of the characters in the received buffer, if they are
290 * encoded in UTF-8 this function will decode them.
291 * @return The universal charstring containing the decoded characters */
292 static UNIVERSAL_CHARSTRING from_UTF8_buffer(TTCN_Buffer& p_buff);
293
294 public:
295
296 #ifdef TITAN_RUNTIME_2
297 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); }
298 void set_value(const Base_Type* other_value) { *this = *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); }
299 Base_Type* clone() const { return new UNIVERSAL_CHARSTRING(*this); }
300 const TTCN_Typedescriptor_t* get_descriptor() const { return &UNIVERSAL_CHARSTRING_descr_; }
301 #else
302 inline boolean is_present() const { return is_bound(); }
303 #endif
304
305 void log() const;
306
307 /** Initializes this object with a module parameter value or concatenates a module
308 * parameter value to the end of this string.
309 * @note UFT-8 strings (whose characters were not in quadruple notation) will
310 * be decoded */
311 void set_param(Module_Param& param);
312 Module_Param* get_param(Module_Param_Name& param_name) const;
313
314 void encode_text(Text_Buf& text_buf) const;
315 void decode_text(Text_Buf& text_buf);
316
317 void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
318 TTCN_EncDec::coding_t p_coding, ...) const;
319 void decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
320 TTCN_EncDec::coding_t p_coding, ...);
321
322 ASN_BER_TLV_t* BER_encode_TLV(const TTCN_Typedescriptor_t& p_td,
323 unsigned p_coding) const;
324
325 boolean BER_decode_TLV(const TTCN_Typedescriptor_t& p_td,
326 const ASN_BER_TLV_t& p_tlv, unsigned L_form);
327
328 int TEXT_encode(const TTCN_Typedescriptor_t&,
329 TTCN_Buffer&) const;
330 int TEXT_decode(const TTCN_Typedescriptor_t&, TTCN_Buffer&, Limit_Token_List&,
331 boolean no_err=FALSE, boolean first_call=TRUE);
332 int XER_encode(const XERdescriptor_t&, TTCN_Buffer&, unsigned int, int, embed_values_enc_struct_t*) const;
333 int XER_decode(const XERdescriptor_t&, XmlReaderWrap& reader, unsigned int, embed_values_dec_struct_t*);
334 /** Decodes UTF-8 into the internal representation (UCS4-BE)
335 *
336 * @param n_octets number of UTF-8 bytes (not characters)
337 * @param octets_ptr pointer to the bytes
338 *
339 * @pre the UNIVERSAL_CHARSTRING is unbound or clean_up() has been called
340 * (otherwise memory leak will occur)
341 */
342 void decode_utf8(int n_octets, const unsigned char *octets_ptr,
343 CharCoding::CharCodingType expected_coding = CharCoding::UTF_8, bool checkBOM = false);
344 void decode_utf16(int n_octets, const unsigned char *octets_ptr,
345 CharCoding::CharCodingType expected_coding);
346 void decode_utf32(int n_octets, const unsigned char *octets_ptr,
347 CharCoding::CharCodingType expected_coding);
348 /** Appends the content of this string to the supplied buffer, in UTF-8
349 *
350 * @param[out] buf buffer to receive the encoded result
351 */
352 void encode_utf8(TTCN_Buffer& buf, bool addBOM = false) const;
353 void encode_utf16(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const;
354 void encode_utf32(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const;
355
356 /** Encodes accordingly to the JSON encoding rules.
357 * The universal charstring will be encoded with UTF-8 before being added to
358 * the JSON code.
359 * Returns the length of the encoded data.
360 * @note Since JSON has its own set of escaped characters, the ones in the
361 * universal charstring need to be double-escaped. */
362 int JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer&) const;
363
364 /** Decodes accordingly to the JSON encoding rules.
365 * Returns the length of the decoded data. */
366 int JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer&, boolean);
367
368 private:
369 #ifdef TITAN_RUNTIME_2
370 virtual int encode_raw(TTCN_Buffer& p_buf) const;
371 #endif
372 };
373
374 class UNIVERSAL_CHARSTRING_ELEMENT {
375 friend class UNIVERSAL_CHARSTRING;
376 friend UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
377 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
378 friend boolean operator==(const char *string_value,
379 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
380 friend UNIVERSAL_CHARSTRING operator+(const char *string_value,
381 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
382 friend UNIVERSAL_CHARSTRING CHARSTRING::operator+
383 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value) const;
384
385 boolean bound_flag;
386 UNIVERSAL_CHARSTRING& str_val;
387 int uchar_pos;
388
389 public:
390 UNIVERSAL_CHARSTRING_ELEMENT(boolean par_bound_flag,
391 UNIVERSAL_CHARSTRING& par_str_val, int par_uchar_pos);
392
393 UNIVERSAL_CHARSTRING_ELEMENT& operator=(const universal_char& other_value);
394 UNIVERSAL_CHARSTRING_ELEMENT& operator=(const char* other_value);
395 UNIVERSAL_CHARSTRING_ELEMENT& operator=(const CHARSTRING& other_value);
396 UNIVERSAL_CHARSTRING_ELEMENT& operator=
397 (const CHARSTRING_ELEMENT& other_value);
398 UNIVERSAL_CHARSTRING_ELEMENT& operator=
399 (const UNIVERSAL_CHARSTRING& other_value);
400 UNIVERSAL_CHARSTRING_ELEMENT& operator=
401 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
402
403 boolean operator==(const universal_char& other_value) const;
404 boolean operator==(const char* other_value) const;
405 boolean operator==(const CHARSTRING& other_value) const;
406 boolean operator==(const CHARSTRING_ELEMENT& other_value) const;
407 boolean operator==(const UNIVERSAL_CHARSTRING& other_value) const;
408 boolean operator==(const UNIVERSAL_CHARSTRING_ELEMENT&
409 other_value) const;
410
411 boolean operator!=(const universal_char& other_value) const
412 { return !(*this == other_value); }
413 boolean operator!=(const char* other_value) const
414 { return !(*this == other_value); }
415 boolean operator!=(const CHARSTRING& other_value) const
416 { return !(*this == other_value); }
417 boolean operator!=(const CHARSTRING_ELEMENT& other_value) const
418 { return !(*this == other_value); }
419 boolean operator!=(const UNIVERSAL_CHARSTRING& other_value) const
420 { return !(*this == other_value); }
421 boolean operator!=(const UNIVERSAL_CHARSTRING_ELEMENT&
422 other_value) const { return !(*this == other_value); }
423
424 UNIVERSAL_CHARSTRING operator+(const universal_char& other_value) const;
425 UNIVERSAL_CHARSTRING operator+(const char* other_value) const;
426 UNIVERSAL_CHARSTRING operator+(const CHARSTRING& other_value) const;
427 UNIVERSAL_CHARSTRING operator+(const CHARSTRING_ELEMENT& other_value) const;
428 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING& other_value) const;
429 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING_ELEMENT&
430 other_value) const;
431
432 inline boolean is_bound() const { return bound_flag; }
433 inline boolean is_present() const { return bound_flag; }
434 inline boolean is_value() const { return bound_flag; }
435 inline void must_bound(const char *err_msg) const
436 { if (!bound_flag) TTCN_error("%s", err_msg); }
437
438 const universal_char& get_uchar() const;
439 void log() const;
440 };
441
442 extern boolean operator==(const universal_char& uchar_value,
443 const UNIVERSAL_CHARSTRING& other_value);
444 extern boolean operator==(const universal_char& uchar_value,
445 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
446
447 inline boolean operator!=(const universal_char& uchar_value,
448 const UNIVERSAL_CHARSTRING& other_value)
449 {
450 return !(uchar_value == other_value);
451 }
452
453 inline boolean operator!=(const universal_char& uchar_value,
454 const UNIVERSAL_CHARSTRING_ELEMENT& other_value)
455 {
456 return !(uchar_value == other_value);
457 }
458
459 inline boolean operator!=(const universal_char& uchar_value,
460 const universal_char& other_value)
461 {
462 return !(uchar_value == other_value);
463 }
464
465 extern UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
466 const UNIVERSAL_CHARSTRING& other_value);
467 extern UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
468 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
469
470 extern boolean operator==(const char *string_value,
471 const UNIVERSAL_CHARSTRING& other_value);
472 extern boolean operator==(const char *string_value,
473 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
474
475 inline boolean operator!=(const char *string_value,
476 const UNIVERSAL_CHARSTRING& other_value)
477 {
478 return !(string_value == other_value);
479 }
480
481 inline boolean operator!=(const char *string_value,
482 const UNIVERSAL_CHARSTRING_ELEMENT& other_value)
483 {
484 return !(string_value == other_value);
485 }
486
487 extern UNIVERSAL_CHARSTRING operator+(const char *string_value,
488 const UNIVERSAL_CHARSTRING& other_value);
489 extern UNIVERSAL_CHARSTRING operator+(const char *string_value,
490 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
491
492
493 class UNIVERSAL_CHARSTRING_template : public Restricted_Length_Template {
494 private:
495 UNIVERSAL_CHARSTRING single_value;
496 CHARSTRING* pattern_string;
497 union {
498 struct {
499 unsigned int n_values;
500 UNIVERSAL_CHARSTRING_template *list_value;
501 } value_list;
502 struct {
503 boolean min_is_set, max_is_set;
504 universal_char min_value, max_value;
505 } value_range;
506 mutable struct {
507 boolean regexp_init;
508 regex_t posix_regexp;
509 } pattern_value;
510 };
511
512 void copy_template(const CHARSTRING_template& other_value);
513 void copy_template(const UNIVERSAL_CHARSTRING_template& other_value);
514
515 public:
516 UNIVERSAL_CHARSTRING_template();
517 UNIVERSAL_CHARSTRING_template(template_sel other_value);
518 UNIVERSAL_CHARSTRING_template(const CHARSTRING& other_value);
519 UNIVERSAL_CHARSTRING_template(const UNIVERSAL_CHARSTRING& other_value);
520 UNIVERSAL_CHARSTRING_template(const CHARSTRING_ELEMENT& other_value);
521 UNIVERSAL_CHARSTRING_template
522 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
523 UNIVERSAL_CHARSTRING_template(const OPTIONAL<CHARSTRING>& other_value);
524 UNIVERSAL_CHARSTRING_template
525 (const OPTIONAL<UNIVERSAL_CHARSTRING>& other_value);
526 UNIVERSAL_CHARSTRING_template
527 (const CHARSTRING_template& other_value);
528 UNIVERSAL_CHARSTRING_template
529 (const UNIVERSAL_CHARSTRING_template& other_value);
530 UNIVERSAL_CHARSTRING_template(template_sel p_sel, const CHARSTRING& p_str);
531
532 ~UNIVERSAL_CHARSTRING_template();
533 void clean_up();
534
535 UNIVERSAL_CHARSTRING_template& operator=(template_sel other_value);
536 UNIVERSAL_CHARSTRING_template& operator=(const CHARSTRING& other_value);
537 UNIVERSAL_CHARSTRING_template& operator=
538 (const UNIVERSAL_CHARSTRING& other_value);
539 UNIVERSAL_CHARSTRING_template& operator=
540 (const CHARSTRING_ELEMENT& other_value);
541 UNIVERSAL_CHARSTRING_template& operator=
542 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
543 UNIVERSAL_CHARSTRING_template& operator=
544 (const OPTIONAL<CHARSTRING>& other_value);
545 UNIVERSAL_CHARSTRING_template& operator=
546 (const OPTIONAL<UNIVERSAL_CHARSTRING>& other_value);
547 UNIVERSAL_CHARSTRING_template& operator=
548 (const CHARSTRING_template& other_value);
549 UNIVERSAL_CHARSTRING_template& operator=
550 (const UNIVERSAL_CHARSTRING_template& other_value);
551
552 UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value);
553 UNIVERSAL_CHARSTRING_ELEMENT operator[](const INTEGER& index_value);
554 const UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value) const;
555 const UNIVERSAL_CHARSTRING_ELEMENT operator[]
556 (const INTEGER& index_value) const;
557
558 boolean match(const UNIVERSAL_CHARSTRING& other_value, boolean legacy = FALSE) const;
559 const UNIVERSAL_CHARSTRING& valueof() const;
560
561 int lengthof() const;
562
563 void set_type(template_sel template_type, unsigned int list_length = 0);
564 UNIVERSAL_CHARSTRING_template& list_item(unsigned int list_index);
565
566 void set_min(const UNIVERSAL_CHARSTRING& min_value);
567 void set_max(const UNIVERSAL_CHARSTRING& max_value);
568
569 void log() const;
570 void log_match(const UNIVERSAL_CHARSTRING& match_value, boolean legacy = FALSE) const;
571
572 void set_param(Module_Param& param);
573 Module_Param* get_param(Module_Param_Name& param_name) const;
574
575 void encode_text(Text_Buf& text_buf) const;
576 void decode_text(Text_Buf& text_buf);
577
578 boolean is_present(boolean legacy = FALSE) const;
579 boolean match_omit(boolean legacy = FALSE) const;
580
581 #ifdef TITAN_RUNTIME_2
582 void valueofv(Base_Type* value) const { *(static_cast<UNIVERSAL_CHARSTRING*>(value)) = valueof(); }
583 void set_value(template_sel other_value) { *this = other_value; }
584 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); }
585 Base_Template* clone() const { return new UNIVERSAL_CHARSTRING_template(*this); }
586 const TTCN_Typedescriptor_t* get_descriptor() const { return &UNIVERSAL_CHARSTRING_descr_; }
587 boolean matchv(const Base_Type* other_value, boolean legacy) const { return match(*(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)), legacy); }
588 void log_matchv(const Base_Type* match_value, boolean legacy) const { log_match(*(static_cast<const UNIVERSAL_CHARSTRING*>(match_value)), legacy); }
589 #else
590 void check_restriction(template_res t_res, const char* t_name=NULL, boolean legacy = FALSE) const;
591 #endif
592
593 const CHARSTRING& get_single_value() const;
594 };
595
596 typedef UNIVERSAL_CHARSTRING BMPString;
597 typedef UNIVERSAL_CHARSTRING UniversalString;
598 typedef UNIVERSAL_CHARSTRING UTF8String;
599 typedef UNIVERSAL_CHARSTRING TeletexString;
600 typedef TeletexString T61String;
601 typedef UNIVERSAL_CHARSTRING VideotexString;
602 typedef UNIVERSAL_CHARSTRING GraphicString;
603 typedef UNIVERSAL_CHARSTRING GeneralString;
604
605 typedef UNIVERSAL_CHARSTRING_template BMPString_template;
606 typedef UNIVERSAL_CHARSTRING_template UniversalString_template;
607 typedef UNIVERSAL_CHARSTRING_template UTF8String_template;
608 typedef UNIVERSAL_CHARSTRING_template TeletexString_template;
609 typedef TeletexString_template T61String_template;
610 typedef UNIVERSAL_CHARSTRING_template VideotexString_template;
611 typedef UNIVERSAL_CHARSTRING_template GraphicString_template;
612 typedef UNIVERSAL_CHARSTRING_template GeneralString_template;
613
614 typedef GraphicString ObjectDescriptor;
615 typedef GraphicString_template ObjectDescriptor_template;
616
617 OCTETSTRING TTCN_TeletexString_2_ISO2022(const TeletexString& p_s);
618 TeletexString TTCN_ISO2022_2_TeletexString(const OCTETSTRING& p_os);
619 OCTETSTRING TTCN_VideotexString_2_ISO2022(const VideotexString& p_s);
620 VideotexString TTCN_ISO2022_2_VideotexString(const OCTETSTRING& p_os);
621 OCTETSTRING TTCN_GraphicString_2_ISO2022(const GraphicString& p_s);
622 GraphicString TTCN_ISO2022_2_GraphicString(const OCTETSTRING& p_os);
623 OCTETSTRING TTCN_GeneralString_2_ISO2022(const GeneralString& p_s);
624 GeneralString TTCN_ISO2022_2_GeneralString(const OCTETSTRING& p_os);
625
626 #endif
This page took 0.068428 seconds and 5 git commands to generate.