source: trunk/ETSI-Testsuites/ETSI_auto_IOT/adapter/validation/LibCommon/LibCommon_TextStrings.ttcn @ 55

Last change on this file since 55 was 22, checked in by rings, 14 years ago
  • Property svn:executable set to *
File size: 5.6 KB
Line 
1/**
2 *  @author   ETSI
3 *  @version  $URL: svn+ssh://vcs.etsi.org/TTCN3/LIB/Ttcn3LibCommon/trunk/ttcn/LibCommon_TextStrings.ttcn $
4 *            $Id: LibCommon_TextStrings.ttcn 35 2009-06-11 12:23:24Z kremer $
5 *  @desc     A collection of text string type and value definitions which
6 *            may be useful in the implementation of any TTCN-3 test
7 *            suite. "Text string" refers to TTCN-3 charstring and universal
8 *            charstring types.
9 *  @remark   End users should be aware that any changes made to the  in
10 *            definitions this module may be overwritten in future releases.
11 *            End users are encouraged to contact the distributers of this
12 *            module regarding their modifications or additions so that future
13 *            updates will include your changes.
14 */
15module LibCommon_TextStrings {
16
17  /**
18   * @desc  These constants can be used to add special characters into
19   *        TTCN-3 text strings by using the concatenation operator.
20   *        Example use:
21   *        var charstring v_text := "Hi!" & c_CRLF & "Hello!";
22   */
23  group usefulConstants {
24
25    const charstring c_NUL := oct2char('00'O);
26    const charstring c_SOH := oct2char('01'O);
27    const charstring c_STX := oct2char('02'O);
28    const charstring c_ETX := oct2char('03'O);
29    const charstring c_EOT := oct2char('04'O);
30    const charstring c_ENQ := oct2char('05'O);
31    const charstring c_ACK := oct2char('06'O);
32    const charstring c_BEL := oct2char('07'O);
33    const charstring c_BS  := oct2char('08'O);
34    const charstring c_TAB := oct2char('09'O);
35    const charstring c_LF  := oct2char('0A'O);
36    const charstring c_VT  := oct2char('0B'O);
37    const charstring c_FF  := oct2char('0C'O);
38    const charstring c_CR  := oct2char('0D'O);
39    const charstring c_SO  := oct2char('0E'O);
40    const charstring c_SI  := oct2char('0F'O);
41    const charstring c_DLE := oct2char('10'O);
42    const charstring c_DC1 := oct2char('11'O);
43    const charstring c_DC2 := oct2char('12'O);
44    const charstring c_DC3 := oct2char('13'O);
45    const charstring c_DC4 := oct2char('14'O);
46    const charstring c_NAK := oct2char('15'O);
47    const charstring c_SYN := oct2char('16'O);
48    const charstring c_ETB := oct2char('17'O);
49    const charstring c_CAN := oct2char('18'O);
50    const charstring c_EM  := oct2char('19'O);
51    const charstring c_SUB := oct2char('1A'O);
52    const charstring c_ESC := oct2char('1B'O);
53    const charstring c_FS  := oct2char('1C'O);
54    const charstring c_GS  := oct2char('1D'O);
55    const charstring c_RS  := oct2char('1E'O);
56    const charstring c_US  := oct2char('1F'O);
57    const charstring c_DEL := oct2char('7F'O);
58
59    const charstring c_CRLF := oct2char('0D'O) & oct2char('0A'O);
60
61  } // end group usefulConstants
62
63  /**
64   * @remark Number in name indicates string length in number of
65   *         _characters_
66   */
67  group textStringSubTypes {
68
69    type charstring String1    length(1) with { encode "length(1)"};
70    type charstring String2    length(2) with { encode "length(2)"};
71    type charstring String3    length(3) with { encode "length(3)"};
72    type charstring String4    length(4) with { encode "length(4)"};
73    type charstring String5    length(5) with { encode "length(5)"};
74    type charstring String6    length(6) with { encode "length(6)"};
75    type charstring String7    length(7) with { encode "length(7)"};
76    type charstring String8    length(8) with { encode "length(8)"};
77    type charstring String9    length(9) with { encode "length(9)"};
78    type charstring String10   length(10) with { encode "length(10)"};
79    type charstring String11   length(11) with { encode "length(11)"};
80    type charstring String12   length(12) with { encode "length(12)"};
81    type charstring String13   length(13) with { encode "length(13)"};
82    type charstring String14   length(14) with { encode "length(14)"};
83    type charstring String15   length(15) with { encode "length(15)"};
84    type charstring String16   length(16) with { encode "length(16)"};
85
86        type charstring String1To13 length(1..13) with {encode "length(1..13)"};
87    type charstring String1To63  length(1..63) with {encode "length(1..63)"};
88    type charstring String1To64  length(1..64) with {encode "length(1..64)"};
89    type charstring String1To127 length(1..127) with {encode "length(1..127)"};
90    type charstring String1To128 length(1..128) with {encode "length(1..128)"};
91    type charstring String1to255 length(1..255) with {encode "length(1..255)"};
92        type charstring String5to253 length (5..253) with {encode "length(5..253)"};
93
94  } // end stringSubTypes
95
96  group usefulTextStringTypes {
97
98    type universal charstring UnicodeText;
99
100    type universal charstring UnicodeText1to255 length(1..255)
101    with {encode "length(1..255)"};
102
103    /**
104     * @desc Subtyping can not be used in this type definition to ensure
105     *       values of this type are really alphanumeric.
106     *       Instead either codecs or a template have
107     *       to be used for this purpose. The type is kept here to ensure
108     *       backward compatibility.
109     * @see  LibCommon_TextStrings.mw_isAlphaNum
110     */
111    type charstring AlphaNum with { encode "alphanumeric"};
112    type AlphaNum   AlphaNum2 length(2) with { encode "alphanumeric;length(2)"};
113    type AlphaNum   AlphaNum1To32 length(1..32) with {encode "alphanumeric;length(1..32)"};
114
115  } // end group usefulTextStringTypes
116
117  group usefulTextStringTemplates {
118   
119          template charstring mw_isAlphaNum := pattern "([0-9]|[a-z]|[A-Z])+";
120
121  } // end group usefulTextStringTemplates
122
123} // end module LibCommon_TextStrings
Note: See TracBrowser for help on using the repository browser.