Sync with 5.2.0
[deliverable/titan.core.git] / regression_test / XML / XER / Flatten.cc
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 #include <TTCN3.hh>
9 #include <ctype.h>
10
11
12 void flatten(CHARSTRING& par) {
13 CHARSTRING retval(0, ""); // empty string
14 const int max = par.lengthof();
15 for (int i = 0; i < max; ++i) {
16 char c = par[i].get_char();
17 //if ( c != '\t'
18 // && c != '\n') {
19 if ( isprint(c) ) {
20 retval += c;
21 }
22 }
23 par = retval;
24 }
25
26 void flatten(UNIVERSAL_CHARSTRING& par) {
27 TTCN_Buffer buf;
28 const int max = par.lengthof();
29 for (int i = 0; i < max; ++i) {
30 universal_char uc = par[i].get_uchar();
31 //if ( c != '\t'
32 // && c != '\n') {
33 if ( !uc.uc_group && !uc.uc_plane && !uc.uc_row && isprint(uc.uc_cell)) {
34 buf.put_s(4, (const unsigned char*)&uc);
35 }
36 }
37 buf.get_string(par);
38 }
39
40
41 namespace Txerasntypes {
42 void flatten(CHARSTRING& par)
43 { ::flatten(par); }
44 void flatten(UNIVERSAL_CHARSTRING& par)
45 { ::flatten(par); }
46 }
47
48 namespace Txerboolean {
49 void flatten(CHARSTRING& par)
50 { ::flatten(par); }
51 void flatten(UNIVERSAL_CHARSTRING& par)
52 { ::flatten(par); }
53 }
54
55 namespace Txerint {
56 void flatten(CHARSTRING& par)
57 { ::flatten(par); }
58 void flatten(UNIVERSAL_CHARSTRING& par)
59 { ::flatten(par); }
60 }
61
62 namespace Txerstring {
63 void flatten(CHARSTRING& par)
64 { ::flatten(par); }
65 void flatten(UNIVERSAL_CHARSTRING& par)
66 { ::flatten(par); }
67 }
68
69 namespace Txerfloat {
70 void flatten(CHARSTRING& par)
71 { ::flatten(par); }
72 void flatten(UNIVERSAL_CHARSTRING& par)
73 { ::flatten(par); }
74 }
75
76 namespace Txerenum {
77 void flatten(CHARSTRING& par)
78 { ::flatten(par); }
79 void flatten(UNIVERSAL_CHARSTRING& par)
80 { ::flatten(par); }
81 }
82
83 namespace Txernested {
84 void flatten(CHARSTRING& par)
85 { ::flatten(par); }
86 void flatten(UNIVERSAL_CHARSTRING& par)
87 { ::flatten(par); }
88 }
89
90 namespace Txersets {
91 void flatten(CHARSTRING& par)
92 { ::flatten(par); }
93 void flatten(UNIVERSAL_CHARSTRING& par)
94 { ::flatten(par); }
95 }
96
97 namespace Txerobjclass {
98 void flatten(CHARSTRING& par)
99 { ::flatten(par); }
100 void flatten(UNIVERSAL_CHARSTRING& par)
101 { ::flatten(par); }
102 }
103
This page took 0.041739 seconds and 5 git commands to generate.