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 ///////////////////////////////////////////////////////////////////////////////
11 #include "../Setting.hh"
12 #include "../Identifier.hh"
13 #include "../../common/memory.h"
15 struct textAST_matching_values {
19 bool generated_decode_token;
22 struct textAST_enum_def {
23 Common::Identifier *name;
24 textAST_matching_values value;
27 struct textAST_param_values {
39 TextAST(const TextAST&);
40 TextAST& operator=(const TextAST&);
42 textAST_matching_values *begin_val;
43 textAST_matching_values *end_val;
44 textAST_matching_values *separator_val;
45 textAST_param_values coding_params;
46 textAST_param_values decoding_params;
48 textAST_enum_def **field_params;
49 textAST_matching_values *true_params;
50 textAST_matching_values *false_params;
54 TextAST() { init_TextAST(); }
55 TextAST(const TextAST *other_val);
58 void print_TextAST() const;
59 int get_field_param_index(const Common::Identifier *name);
62 void copy_textAST_matching_values(textAST_matching_values **to,
63 const textAST_matching_values *from);
65 /** Checks for forbidden references within {} and substitutes the escape
66 * sequences of apostrophes ('' and \') and quotation marks("" and \") in
67 * \a decode_token. Returns the result of substitution. Argument \a loc is
68 * used for error reporting. */
69 char *process_decode_token(const char *decode_token,
70 const Common::Location& loc);
72 /** "Encode" the TEXT matching pattern.
74 * @param str TTCN pattern from the TEXT attribute
75 * @param cs true for case sensitive matching, false for case insensitive
76 * @return a newly allocated string whose first character is
77 * 'I' for case sensitive matching, 'N' for case insensitive matching,
78 * or 'F' for fixed string matching.
79 * The rest of the string is the POSIX regexp corresponding to the pattern
80 * in \p str (or a copy of \p str for fixed string matching).
82 * The string must be deallocated by the caller using \b Free()
84 char *make_posix_str_code(const char *str, bool cs);
86 /** Converts a TTCN-3 charstring value to an equivalent TTCN-3 pattern. The
87 * special characters of TTCN-3 patterns are escaped. */
88 extern char *convert_charstring_to_pattern(const char *str);
90 void init_textAST_matching_values(textAST_matching_values *val);