1 /******************************************************************************
2 * Copyright (c) 2000-2016 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
19 * Szabo, Janos Zoltan – initial implementation
21 * Zalanyi, Balazs Andor
23 ******************************************************************************/
24 #ifndef UNIVERSAL_CHARSTRING_HH
25 #define UNIVERSAL_CHARSTRING_HH
27 #include "Basetype.hh"
28 #include "Template.hh"
29 #include "Optional.hh"
31 #include "CharCoding.hh"
34 #include "Charstring.hh"
37 class CHARSTRING_ELEMENT;
38 class CHARSTRING_template;
39 class UNIVERSAL_CHARSTRING_ELEMENT;
40 class UNIVERSAL_CHARSTRING_template;
44 extern boolean operator==(const universal_char& left_value,
45 const universal_char& right_value);
46 extern boolean operator<(const universal_char& left_value,
47 const universal_char& right_value);
49 /** Runtime class for Unicode character strings.
51 * This class implements the following string types:
52 * - TTCN-3 \c universal \c charstring
59 * - \c UniversalString
61 * - \c ObjectDescriptor
63 * Note: an object of this class is effectively immutable after creation.
65 * There is no terminating {0,0,0,0} at the end.
67 class UNIVERSAL_CHARSTRING : public Base_Type {
69 friend class CHARSTRING;
70 friend class CHARSTRING_ELEMENT;
71 friend class UNIVERSAL_CHARSTRING_ELEMENT;
72 friend class TTCN_Buffer;
73 friend class UNIVERSAL_CHARSTRING_template;
75 friend UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue,
76 const CHARSTRING& string_encoding);
77 friend UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue);
78 friend UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
79 int index, int len, const UNIVERSAL_CHARSTRING& repl);
80 friend UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
81 const UNIVERSAL_CHARSTRING* expression_val,
82 const UNIVERSAL_CHARSTRING_template* expression_tmpl,
85 friend boolean operator==(const universal_char& uchar_value,
86 const UNIVERSAL_CHARSTRING& other_value);
87 friend UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
88 const UNIVERSAL_CHARSTRING& other_value);
89 friend boolean operator==(const char *string_value,
90 const UNIVERSAL_CHARSTRING& other_value);
91 friend UNIVERSAL_CHARSTRING operator+(const char *string_value,
92 const UNIVERSAL_CHARSTRING& other_value);
93 friend UNIVERSAL_CHARSTRING operator+(const char *string_value,
94 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
95 friend UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
96 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
97 friend boolean operator==(const char *string_value,
98 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
100 /** Internal data type, no user serviceable parts inside */
101 struct universal_charstring_struct;
103 universal_charstring_struct *val_ptr;
104 /** Character string values are stored in an optimal way */
108 void init_struct(int n_uchars);
110 UNIVERSAL_CHARSTRING(int n_uchars, bool cstring = false);
112 /** An extended version of set_param(), which also accepts string patterns if
113 * the second parameter is set (needed by UNIVERSAL_CHARSTRING_template to
114 * concatenate string patterns).
115 * @return TRUE, if the module parameter was a string pattern, otherwise FALSE */
116 boolean set_param_internal(Module_Param& param, boolean allow_pattern);
120 /** Construct an empty string */
121 UNIVERSAL_CHARSTRING();
122 /** Construct a string containing a single character.
124 * @param uc_group Unicode group (most significant part)
125 * @param uc_plane Unicode plane
126 * @param uc_row Unicode row
127 * @param uc_cell Unicode cell (least significant)
130 UNIVERSAL_CHARSTRING(unsigned char uc_group, unsigned char uc_plane,
131 unsigned char uc_row, unsigned char uc_cell);
132 /** Construct a string containing a single character
136 UNIVERSAL_CHARSTRING(const universal_char& other_value);
137 /** Construct a string from a given number of characters
142 UNIVERSAL_CHARSTRING(int n_uchars, const universal_char *uchars_ptr);
143 /** Construct a string from a C string
145 * @param chars_ptr pointer to the source string. A NULL pointer
146 * will result in an empty UNIVERSAL_CHARSTRING.
148 * All characters in the string will have group==plane==row==0
150 UNIVERSAL_CHARSTRING(const char *chars_ptr);
151 /** Construct a string from a known number of single-byte characters
153 * @param n_chars number of characters
154 * @param chars_ptr pointer to the source string.
156 * @pre if n_chars > 0, chars_ptr must point to a valid string,
157 * else an access violation will occur.
159 * All characters in the string will have group==plane==row==0
161 UNIVERSAL_CHARSTRING(int n_chars, const char *chars_ptr);
162 /** Construct a copy of another CHARSTRING
166 UNIVERSAL_CHARSTRING(const CHARSTRING& other_value);
167 /** Construct a string containing a single CHARSTRING_ELEMENT
171 UNIVERSAL_CHARSTRING(const CHARSTRING_ELEMENT& other_value);
176 UNIVERSAL_CHARSTRING(const UNIVERSAL_CHARSTRING& other_value);
177 /** Construct a string containing a single UNIVERSAL_CHARSTRING_ELEMENT
181 UNIVERSAL_CHARSTRING(const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
183 ~UNIVERSAL_CHARSTRING();
186 UNIVERSAL_CHARSTRING& operator=(const universal_char& other_value);
187 UNIVERSAL_CHARSTRING& operator=(const char* other_value);
188 UNIVERSAL_CHARSTRING& operator=(const CHARSTRING& other_value);
189 UNIVERSAL_CHARSTRING& operator=(const CHARSTRING_ELEMENT& other_value);
190 UNIVERSAL_CHARSTRING& operator=(const UNIVERSAL_CHARSTRING& other_value);
191 UNIVERSAL_CHARSTRING& operator=(const UNIVERSAL_CHARSTRING_ELEMENT&
194 /** @name Comparison operators
197 boolean operator==(const universal_char& other_value) const;
198 boolean operator==(const char* other_value) const;
199 boolean operator==(const CHARSTRING& other_value) const;
200 boolean operator==(const CHARSTRING_ELEMENT& other_value) const;
201 boolean operator==(const UNIVERSAL_CHARSTRING& other_value) const;
202 boolean operator==(const UNIVERSAL_CHARSTRING_ELEMENT&
205 boolean operator!=(const universal_char& other_value) const
206 { return !(*this == other_value); }
207 boolean operator!=(const char* other_value) const
208 { return !(*this == other_value); }
209 boolean operator!=(const CHARSTRING& other_value) const
210 { return !(*this == other_value); }
211 boolean operator!=(const CHARSTRING_ELEMENT& other_value) const
212 { return !(*this == other_value); }
213 boolean operator!=(const UNIVERSAL_CHARSTRING& other_value) const
214 { return !(*this == other_value); }
215 boolean operator!=(const UNIVERSAL_CHARSTRING_ELEMENT&
216 other_value) const { return !(*this == other_value); }
219 /** @name Concatenation
224 UNIVERSAL_CHARSTRING operator+(const universal_char& other_value) const;
225 UNIVERSAL_CHARSTRING operator+(const char* other_value) const;
226 UNIVERSAL_CHARSTRING operator+(const CHARSTRING& other_value) const;
227 UNIVERSAL_CHARSTRING operator+(const CHARSTRING_ELEMENT& other_value) const;
228 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING& other_value) const;
229 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING_ELEMENT&
235 UNIVERSAL_CHARSTRING operator<<=(int rotate_count) const;
236 UNIVERSAL_CHARSTRING operator<<=(const INTEGER& rotate_count) const;
237 UNIVERSAL_CHARSTRING operator>>=(int rotate_count) const;
238 UNIVERSAL_CHARSTRING operator>>=(const INTEGER& rotate_count) const;
243 UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value);
244 UNIVERSAL_CHARSTRING_ELEMENT operator[](const INTEGER& index_value);
245 const UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value) const;
246 const UNIVERSAL_CHARSTRING_ELEMENT operator[]
247 (const INTEGER& index_value) const;
250 operator const universal_char*() const;
252 inline boolean is_bound() const {
253 if (charstring) return cstr.is_bound();
254 else return val_ptr != NULL; }
255 inline boolean is_value() const {
256 if (charstring) return cstr.is_value();
257 else return val_ptr != NULL; }
258 inline void must_bound(const char *err_msg) const
259 { if (charstring) cstr.must_bound(err_msg);
260 else if (val_ptr == NULL) TTCN_error("%s", err_msg); }
262 int lengthof() const;
267 // convert this string to character string for pattern matching: ([A-P]{8})*
268 char* convert_to_regexp_form() const;
270 /* returns the CHARSTRING representation of this. Quadruples are converted
271 into the form: \q{group,plane,row,cell} */
272 CHARSTRING get_stringRepr_for_pattern() const;
274 void convert_cstr_to_uni();
275 //checks if an valid BOM is at the head of the string. Returns the length of BOM
276 int check_BOM(CharCoding::CharCodingType expected_coding, unsigned int length,
277 const unsigned char* ostr);
279 /** Returns the universal charstring in the format a string would appear in C or TTCN-3 code.
280 * Inserts double quotation marks to the begining and end of the string and
281 * doubles the backlsashes in escaped characters.
282 * Used for JSON encoding.
284 * @param p_buf The buffer containing the universal charstring in UTF-8 encoding
286 * Example: "He said\nhis name was \"Al\"." -> "\"He said\\nhis name was \\\"Al\\\".\""
287 * Example2: char(0, 0, 1, 113) in TTCN-3 -> "\u0171"
288 * @note The returned character buffer needs to be freed after use. */
289 char* to_JSON_string(const TTCN_Buffer& p_buf) const;
291 /** Converts the universal charstring from JSON string format to normal format.
292 * The double quotation marks from the beginning and end of the JSON string are
293 * removed and double-escaped characters are changed to simple-escaped ones.
294 * JSON characters stored as \u + 4 hex digits are converted to the characters
296 * Returns false if any invalid characters were found, otherwise true.
297 * Used for JSON decoding.
299 * Example: "\"He said\\nhis name was \\\"Al\\\".\"" -> "He said\nhis name was \"Al\"."
300 * Example2: "\u0061" -> "a"
302 * @param check_quotes turn the checking of double quotes (mentioned above) on or off */
303 boolean from_JSON_string(boolean check_quotes);
305 /** Checks the coding of the characters in the received buffer, if they are
306 * encoded in UTF-8 this function will decode them.
307 * @return The universal charstring containing the decoded characters */
308 static UNIVERSAL_CHARSTRING from_UTF8_buffer(TTCN_Buffer& p_buff);
312 #ifdef TITAN_RUNTIME_2
313 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); }
314 void set_value(const Base_Type* other_value) { *this = *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); }
315 Base_Type* clone() const { return new UNIVERSAL_CHARSTRING(*this); }
316 const TTCN_Typedescriptor_t* get_descriptor() const { return &UNIVERSAL_CHARSTRING_descr_; }
318 inline boolean is_present() const { return is_bound(); }
323 /** Initializes this object with a module parameter value or concatenates a module
324 * parameter value to the end of this string.
325 * @note UFT-8 strings (whose characters were not in quadruple notation) will
327 void set_param(Module_Param& param);
328 Module_Param* get_param(Module_Param_Name& param_name) const;
330 void encode_text(Text_Buf& text_buf) const;
331 void decode_text(Text_Buf& text_buf);
333 void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
334 TTCN_EncDec::coding_t p_coding, ...) const;
335 void decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
336 TTCN_EncDec::coding_t p_coding, ...);
338 ASN_BER_TLV_t* BER_encode_TLV(const TTCN_Typedescriptor_t& p_td,
339 unsigned p_coding) const;
341 boolean BER_decode_TLV(const TTCN_Typedescriptor_t& p_td,
342 const ASN_BER_TLV_t& p_tlv, unsigned L_form);
344 /** Encodes the value according to the TTCN_Typedescriptor_t.
345 * It must be public because it can be called by other types during encoding.
346 * Returns the length of encoded data */
347 int RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree&) const;
349 /** Decodes the value according to the TTCN_Typedescriptor_t.
350 * It must be public because it can be called by other types during encoding.
351 * Returns the number of decoded bits */
352 int RAW_decode(const TTCN_Typedescriptor_t&, TTCN_Buffer&, int, raw_order_t,
353 boolean no_err=FALSE, int sel_field=-1, boolean first_call=TRUE);
355 int TEXT_encode(const TTCN_Typedescriptor_t&,
357 int TEXT_decode(const TTCN_Typedescriptor_t&, TTCN_Buffer&, Limit_Token_List&,
358 boolean no_err=FALSE, boolean first_call=TRUE);
359 int XER_encode(const XERdescriptor_t&, TTCN_Buffer&, unsigned int, int, embed_values_enc_struct_t*) const;
360 int XER_decode(const XERdescriptor_t&, XmlReaderWrap& reader, unsigned int, unsigned int, embed_values_dec_struct_t*);
361 /** Decodes UTF-8 into the internal representation (UCS4-BE)
363 * @param n_octets number of UTF-8 bytes (not characters)
364 * @param octets_ptr pointer to the bytes
366 * @pre the UNIVERSAL_CHARSTRING is unbound or clean_up() has been called
367 * (otherwise memory leak will occur)
369 void decode_utf8(int n_octets, const unsigned char *octets_ptr,
370 CharCoding::CharCodingType expected_coding = CharCoding::UTF_8, bool checkBOM = false);
371 void decode_utf16(int n_octets, const unsigned char *octets_ptr,
372 CharCoding::CharCodingType expected_coding);
373 void decode_utf32(int n_octets, const unsigned char *octets_ptr,
374 CharCoding::CharCodingType expected_coding);
375 /** Appends the content of this string to the supplied buffer, in UTF-8
377 * @param[out] buf buffer to receive the encoded result
379 void encode_utf8(TTCN_Buffer& buf, bool addBOM = false) const;
380 void encode_utf16(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const;
381 void encode_utf32(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const;
383 /** Encodes accordingly to the JSON encoding rules.
384 * The universal charstring will be encoded with UTF-8 before being added to
386 * Returns the length of the encoded data.
387 * @note Since JSON has its own set of escaped characters, the ones in the
388 * universal charstring need to be double-escaped. */
389 int JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer&) const;
391 /** Decodes accordingly to the JSON encoding rules.
392 * Returns the length of the decoded data. */
393 int JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer&, boolean);
396 #ifdef TITAN_RUNTIME_2
397 virtual int encode_raw(TTCN_Buffer& p_buf) const;
398 /** Encodes this universal charstring with UTF-8 and adds the result to the end
399 * of a JSON buffer as raw data.
400 * Used during the negative testing of the JSON encoder.
401 * @return The number of bytes added. */
402 int JSON_encode_negtest_raw(JSON_Tokenizer&) const;
406 class UNIVERSAL_CHARSTRING_ELEMENT {
407 friend class UNIVERSAL_CHARSTRING;
408 friend UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
409 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
410 friend boolean operator==(const char *string_value,
411 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
412 friend UNIVERSAL_CHARSTRING operator+(const char *string_value,
413 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
414 friend UNIVERSAL_CHARSTRING CHARSTRING::operator+
415 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value) const;
418 UNIVERSAL_CHARSTRING& str_val;
422 UNIVERSAL_CHARSTRING_ELEMENT(boolean par_bound_flag,
423 UNIVERSAL_CHARSTRING& par_str_val, int par_uchar_pos);
425 UNIVERSAL_CHARSTRING_ELEMENT& operator=(const universal_char& other_value);
426 UNIVERSAL_CHARSTRING_ELEMENT& operator=(const char* other_value);
427 UNIVERSAL_CHARSTRING_ELEMENT& operator=(const CHARSTRING& other_value);
428 UNIVERSAL_CHARSTRING_ELEMENT& operator=
429 (const CHARSTRING_ELEMENT& other_value);
430 UNIVERSAL_CHARSTRING_ELEMENT& operator=
431 (const UNIVERSAL_CHARSTRING& other_value);
432 UNIVERSAL_CHARSTRING_ELEMENT& operator=
433 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
435 boolean operator==(const universal_char& other_value) const;
436 boolean operator==(const char* other_value) const;
437 boolean operator==(const CHARSTRING& other_value) const;
438 boolean operator==(const CHARSTRING_ELEMENT& other_value) const;
439 boolean operator==(const UNIVERSAL_CHARSTRING& other_value) const;
440 boolean operator==(const UNIVERSAL_CHARSTRING_ELEMENT&
443 boolean operator!=(const universal_char& other_value) const
444 { return !(*this == other_value); }
445 boolean operator!=(const char* other_value) const
446 { return !(*this == other_value); }
447 boolean operator!=(const CHARSTRING& other_value) const
448 { return !(*this == other_value); }
449 boolean operator!=(const CHARSTRING_ELEMENT& other_value) const
450 { return !(*this == other_value); }
451 boolean operator!=(const UNIVERSAL_CHARSTRING& other_value) const
452 { return !(*this == other_value); }
453 boolean operator!=(const UNIVERSAL_CHARSTRING_ELEMENT&
454 other_value) const { return !(*this == other_value); }
456 UNIVERSAL_CHARSTRING operator+(const universal_char& other_value) const;
457 UNIVERSAL_CHARSTRING operator+(const char* other_value) const;
458 UNIVERSAL_CHARSTRING operator+(const CHARSTRING& other_value) const;
459 UNIVERSAL_CHARSTRING operator+(const CHARSTRING_ELEMENT& other_value) const;
460 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING& other_value) const;
461 UNIVERSAL_CHARSTRING operator+(const UNIVERSAL_CHARSTRING_ELEMENT&
464 inline boolean is_bound() const { return bound_flag; }
465 inline boolean is_present() const { return bound_flag; }
466 inline boolean is_value() const { return bound_flag; }
467 inline void must_bound(const char *err_msg) const
468 { if (!bound_flag) TTCN_error("%s", err_msg); }
470 const universal_char& get_uchar() const;
474 extern boolean operator==(const universal_char& uchar_value,
475 const UNIVERSAL_CHARSTRING& other_value);
476 extern boolean operator==(const universal_char& uchar_value,
477 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
479 inline boolean operator!=(const universal_char& uchar_value,
480 const UNIVERSAL_CHARSTRING& other_value)
482 return !(uchar_value == other_value);
485 inline boolean operator!=(const universal_char& uchar_value,
486 const UNIVERSAL_CHARSTRING_ELEMENT& other_value)
488 return !(uchar_value == other_value);
491 inline boolean operator!=(const universal_char& uchar_value,
492 const universal_char& other_value)
494 return !(uchar_value == other_value);
497 extern UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
498 const UNIVERSAL_CHARSTRING& other_value);
499 extern UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value,
500 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
502 extern boolean operator==(const char *string_value,
503 const UNIVERSAL_CHARSTRING& other_value);
504 extern boolean operator==(const char *string_value,
505 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
507 inline boolean operator!=(const char *string_value,
508 const UNIVERSAL_CHARSTRING& other_value)
510 return !(string_value == other_value);
513 inline boolean operator!=(const char *string_value,
514 const UNIVERSAL_CHARSTRING_ELEMENT& other_value)
516 return !(string_value == other_value);
519 extern UNIVERSAL_CHARSTRING operator+(const char *string_value,
520 const UNIVERSAL_CHARSTRING& other_value);
521 extern UNIVERSAL_CHARSTRING operator+(const char *string_value,
522 const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
525 class UNIVERSAL_CHARSTRING_template : public Restricted_Length_Template {
527 UNIVERSAL_CHARSTRING single_value;
528 CHARSTRING* pattern_string;
531 unsigned int n_values;
532 UNIVERSAL_CHARSTRING_template *list_value;
535 boolean min_is_set, max_is_set;
536 universal_char min_value, max_value;
540 regex_t posix_regexp;
544 void copy_template(const CHARSTRING_template& other_value);
545 void copy_template(const UNIVERSAL_CHARSTRING_template& other_value);
548 UNIVERSAL_CHARSTRING_template();
549 UNIVERSAL_CHARSTRING_template(template_sel other_value);
550 UNIVERSAL_CHARSTRING_template(const CHARSTRING& other_value);
551 UNIVERSAL_CHARSTRING_template(const UNIVERSAL_CHARSTRING& other_value);
552 UNIVERSAL_CHARSTRING_template(const CHARSTRING_ELEMENT& other_value);
553 UNIVERSAL_CHARSTRING_template
554 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
555 UNIVERSAL_CHARSTRING_template(const OPTIONAL<CHARSTRING>& other_value);
556 UNIVERSAL_CHARSTRING_template
557 (const OPTIONAL<UNIVERSAL_CHARSTRING>& other_value);
558 UNIVERSAL_CHARSTRING_template
559 (const CHARSTRING_template& other_value);
560 UNIVERSAL_CHARSTRING_template
561 (const UNIVERSAL_CHARSTRING_template& other_value);
562 UNIVERSAL_CHARSTRING_template(template_sel p_sel, const CHARSTRING& p_str);
564 ~UNIVERSAL_CHARSTRING_template();
567 UNIVERSAL_CHARSTRING_template& operator=(template_sel other_value);
568 UNIVERSAL_CHARSTRING_template& operator=(const CHARSTRING& other_value);
569 UNIVERSAL_CHARSTRING_template& operator=
570 (const UNIVERSAL_CHARSTRING& other_value);
571 UNIVERSAL_CHARSTRING_template& operator=
572 (const CHARSTRING_ELEMENT& other_value);
573 UNIVERSAL_CHARSTRING_template& operator=
574 (const UNIVERSAL_CHARSTRING_ELEMENT& other_value);
575 UNIVERSAL_CHARSTRING_template& operator=
576 (const OPTIONAL<CHARSTRING>& other_value);
577 UNIVERSAL_CHARSTRING_template& operator=
578 (const OPTIONAL<UNIVERSAL_CHARSTRING>& other_value);
579 UNIVERSAL_CHARSTRING_template& operator=
580 (const CHARSTRING_template& other_value);
581 UNIVERSAL_CHARSTRING_template& operator=
582 (const UNIVERSAL_CHARSTRING_template& other_value);
584 UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value);
585 UNIVERSAL_CHARSTRING_ELEMENT operator[](const INTEGER& index_value);
586 const UNIVERSAL_CHARSTRING_ELEMENT operator[](int index_value) const;
587 const UNIVERSAL_CHARSTRING_ELEMENT operator[]
588 (const INTEGER& index_value) const;
590 boolean match(const UNIVERSAL_CHARSTRING& other_value, boolean legacy = FALSE) const;
591 const UNIVERSAL_CHARSTRING& valueof() const;
593 int lengthof() const;
595 void set_type(template_sel template_type, unsigned int list_length = 0);
596 UNIVERSAL_CHARSTRING_template& list_item(unsigned int list_index);
598 void set_min(const UNIVERSAL_CHARSTRING& min_value);
599 void set_max(const UNIVERSAL_CHARSTRING& max_value);
602 void log_match(const UNIVERSAL_CHARSTRING& match_value, boolean legacy = FALSE) const;
604 void set_param(Module_Param& param);
605 Module_Param* get_param(Module_Param_Name& param_name) const;
607 void encode_text(Text_Buf& text_buf) const;
608 void decode_text(Text_Buf& text_buf);
610 boolean is_present(boolean legacy = FALSE) const;
611 boolean match_omit(boolean legacy = FALSE) const;
613 #ifdef TITAN_RUNTIME_2
614 void valueofv(Base_Type* value) const { *(static_cast<UNIVERSAL_CHARSTRING*>(value)) = valueof(); }
615 void set_value(template_sel other_value) { *this = other_value; }
616 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); }
617 Base_Template* clone() const { return new UNIVERSAL_CHARSTRING_template(*this); }
618 const TTCN_Typedescriptor_t* get_descriptor() const { return &UNIVERSAL_CHARSTRING_descr_; }
619 boolean matchv(const Base_Type* other_value, boolean legacy) const { return match(*(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)), legacy); }
620 void log_matchv(const Base_Type* match_value, boolean legacy) const { log_match(*(static_cast<const UNIVERSAL_CHARSTRING*>(match_value)), legacy); }
622 void check_restriction(template_res t_res, const char* t_name=NULL, boolean legacy = FALSE) const;
625 const CHARSTRING& get_single_value() const;
628 typedef UNIVERSAL_CHARSTRING BMPString;
629 typedef UNIVERSAL_CHARSTRING UniversalString;
630 typedef UNIVERSAL_CHARSTRING UTF8String;
631 typedef UNIVERSAL_CHARSTRING TeletexString;
632 typedef TeletexString T61String;
633 typedef UNIVERSAL_CHARSTRING VideotexString;
634 typedef UNIVERSAL_CHARSTRING GraphicString;
635 typedef UNIVERSAL_CHARSTRING GeneralString;
637 typedef UNIVERSAL_CHARSTRING_template BMPString_template;
638 typedef UNIVERSAL_CHARSTRING_template UniversalString_template;
639 typedef UNIVERSAL_CHARSTRING_template UTF8String_template;
640 typedef UNIVERSAL_CHARSTRING_template TeletexString_template;
641 typedef TeletexString_template T61String_template;
642 typedef UNIVERSAL_CHARSTRING_template VideotexString_template;
643 typedef UNIVERSAL_CHARSTRING_template GraphicString_template;
644 typedef UNIVERSAL_CHARSTRING_template GeneralString_template;
646 typedef GraphicString ObjectDescriptor;
647 typedef GraphicString_template ObjectDescriptor_template;
649 OCTETSTRING TTCN_TeletexString_2_ISO2022(const TeletexString& p_s);
650 TeletexString TTCN_ISO2022_2_TeletexString(const OCTETSTRING& p_os);
651 OCTETSTRING TTCN_VideotexString_2_ISO2022(const VideotexString& p_s);
652 VideotexString TTCN_ISO2022_2_VideotexString(const OCTETSTRING& p_os);
653 OCTETSTRING TTCN_GraphicString_2_ISO2022(const GraphicString& p_s);
654 GraphicString TTCN_ISO2022_2_GraphicString(const OCTETSTRING& p_os);
655 OCTETSTRING TTCN_GeneralString_2_ISO2022(const GeneralString& p_s);
656 GeneralString TTCN_ISO2022_2_GeneralString(const OCTETSTRING& p_os);