Titan Core Initial Contribution
[deliverable/titan.core.git] / regression_test / XML / TTCNandXML / 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 #ifndef OLD_NAMES
12 namespace Flattener {
13 #endif
14
15 UNIVERSAL_CHARSTRING flatten(UNIVERSAL_CHARSTRING const& par) {
16 TTCN_Buffer buf;
17 const int max = par.lengthof();
18 for (int i = 0; i < max; ++i) {
19 universal_char uc = par[i].get_uchar();
20 //if ( !uc.uc_group && !uc.uc_plane && !uc.uc_row && isprint(uc.uc_cell))
21
22 // Drop characters which are in 0000-00FF and unprintable
23 if ( uc.uc_group || uc.uc_plane || uc.uc_row || isprint(uc.uc_cell))
24 {
25 buf.put_s(4, (const unsigned char*)&uc);
26 }
27 }
28 buf.put_s(4, (const unsigned char*)"\0\0\0\n");
29
30 UNIVERSAL_CHARSTRING retval;
31 buf.get_string(retval);
32 return retval;
33 }
34
35
36 #ifndef OLD_NAMES
37 } // namespace
38 #endif
This page took 0.031799 seconds and 5 git commands to generate.