1 : //==============================================================================
2 : // File <$/src/cpp/dev/idlc/context.cpp>
3 : // This file is part of YaOrb : Yet Another Object Request Broker,
4 : // Copyright (c) 2000-2003, Marc Alff.
5 : //
6 : // This program is free software; you can redistribute it and/or
7 : // modify it under the terms of the GNU General Public License
8 : // as published by the Free Software Foundation; either version 2
9 : // of the License, or (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program; if not, write to the Free Software
18 : // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 : //
20 : //==============================================================================
21 :
22 : #include "src/cpp/prod/tool/DEVELOPMENT.h"
23 :
24 : #include "src/cpp/prod/tool/Assert.h"
25 :
26 : #include "src/cpp/dev/idlc/symbol.h"
27 : #include "src/cpp/dev/idlc/context.h"
28 :
29 3734 : Context::Context(const String& name, Context *parent)
30 3734 : : SymbolContainer(parent), _name(name)
31 0 : {}
32 :
33 3734 : Context::~Context()
34 : {
35 3734 : }
36 :
37 10274 : const String& Context::GetName(void)
38 : {
39 : return _name ;
40 : }
41 :
42 54 : void Context::print(std::ostream& str, const String& tab) const
43 : {
44 54 : String tab2(80) ;
45 :
46 54 : tab2 = tab ;
47 54 : tab2 += " " ;
48 :
49 54 : str << tab << "Context named <" << _name << "> {" << std::endl ;
50 :
51 54 : SymbolContainer::print(str, tab2) ;
52 :
53 108 : str << tab << "}" << std::endl ;
54 54 : }
55 :
56 26037 : String Context::GetFullyQualifiedName(void) const
57 : {
58 26037 : String result ;
59 26037 : const Context *parent = GetParent() ;
60 :
61 26037 : if (parent == NULL)
62 : {
63 12731 : result = "" ;
64 : }
65 : else
66 : {
67 13306 : result = parent->GetFullyQualifiedName() ;
68 13306 : result += "::" ;
69 : }
70 :
71 26037 : result += _name ;
72 :
73 0 : return result ;
74 63 : }
75 63 :
|