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