added any2unistr predefined function (artf724008)
[deliverable/titan.core.git] / compiler2 / ttcn3 / TextAST.hh
CommitLineData
d44e3c4f 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
7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Raduly, Csaba
11 * Szabo, Janos Zoltan – initial implementation
12 * Szalai, Gabor
13 *
14 ******************************************************************************/
970ed795
EL
15#ifndef TEXT_AST_HH
16#define TEXT_AST_HH
17
18#include "../Setting.hh"
19#include "../Identifier.hh"
20#include "../../common/memory.h"
21
22struct textAST_matching_values {
23 char* encode_token;
24 char* decode_token;
25 bool case_sensitive;
26 bool generated_decode_token;
27};
28
29struct textAST_enum_def {
30 Common::Identifier *name;
31 textAST_matching_values value;
32};
33
34struct textAST_param_values {
35 bool leading_zero;
36 bool repeatable;
37 int min_length;
38 int max_length;
39 int convert;
40 int just;
41};
42
43class TextAST {
44 private:
45 void init_TextAST();
46 TextAST(const TextAST&);
47 TextAST& operator=(const TextAST&);
48 public:
49 textAST_matching_values *begin_val;
50 textAST_matching_values *end_val;
51 textAST_matching_values *separator_val;
52 textAST_param_values coding_params;
53 textAST_param_values decoding_params;
54 int nof_field_params;
55 textAST_enum_def **field_params;
56 textAST_matching_values *true_params;
57 textAST_matching_values *false_params;
58 char* decode_token;
59 bool case_sensitive;
60
61 TextAST() { init_TextAST(); }
62 TextAST(const TextAST *other_val);
63 ~TextAST();
64
65 void print_TextAST() const;
66 int get_field_param_index(const Common::Identifier *name);
67};
68
69void copy_textAST_matching_values(textAST_matching_values **to,
70 const textAST_matching_values *from);
71
72/** Checks for forbidden references within {} and substitutes the escape
73 * sequences of apostrophes ('' and \') and quotation marks("" and \") in
74 * \a decode_token. Returns the result of substitution. Argument \a loc is
75 * used for error reporting. */
76char *process_decode_token(const char *decode_token,
77 const Common::Location& loc);
78
79/** "Encode" the TEXT matching pattern.
80 *
81 * @param str TTCN pattern from the TEXT attribute
82 * @param cs true for case sensitive matching, false for case insensitive
83 * @return a newly allocated string whose first character is
84 * 'I' for case sensitive matching, 'N' for case insensitive matching,
85 * or 'F' for fixed string matching.
86 * The rest of the string is the POSIX regexp corresponding to the pattern
87 * in \p str (or a copy of \p str for fixed string matching).
88 *
89 * The string must be deallocated by the caller using \b Free()
90 */
91char *make_posix_str_code(const char *str, bool cs);
92
93/** Converts a TTCN-3 charstring value to an equivalent TTCN-3 pattern. The
94 * special characters of TTCN-3 patterns are escaped. */
95extern char *convert_charstring_to_pattern(const char *str);
96
97void init_textAST_matching_values(textAST_matching_values *val);
98
99#endif
This page took 0.028073 seconds and 5 git commands to generate.