Merge pull request #83 from eadrkir/master
[deliverable/titan.core.git] / core / simplify.pl
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 #
12 ###############################################################################
13 #! /usr/bin/perl -w
14 use strict;
15
16 my $is_enum = 0;
17
18 print <<HEAD;
19 #ifndef TITAN_LOGGER_API_SIMPLE_HH
20 #define TITAN_LOGGER_API_SIMPLE_HH
21 namespace TitanLoggerApiSimple {
22
23 HEAD
24
25 while (<>) {
26 if ($is_enum) { # already found the start of an enum
27 if (/enum\s*enum_type\s*{\s*([^}]+)};/) {
28 print $_; # copy enum_type
29 }
30 elsif (/^};$/) {
31 print $_; # copy the closing brace
32 $is_enum = 0;
33 }
34 }
35 else {
36 if (my ($class, $base) = /class\s*(\w+)\s*:\s*public\s*(\w+)\s*{\s*\/\/\s*enum/) {
37 print "\nclass $class {\npublic:\n";
38 $is_enum = 1;
39 }
40 }
41 }
42
43 print <<TAIL;
44 } // end namespace
45 #endif
46 TAIL
This page took 0.039979 seconds and 5 git commands to generate.