![]() ![]() |
![]() |
1 chuck 1.1.2.3 //%2004//////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development 4 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems. 5 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L. P.; 6 // IBM Corp.; EMC Corporation, The Open Group. 7 // 8 // Permission is hereby granted, free of charge, to any person obtaining a copy 9 // of this software and associated documentation files (the "Software"), to 10 // deal in the Software without restriction, including without limitation the 11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 12 // sell copies of the Software, and to permit persons to whom the Software is 13 // furnished to do so, subject to the following conditions: 14 // 15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED 17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 chuck 1.1.2.3 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 // 24 //============================================================================== 25 // 26 // Authors: David Rosckes (rosckes@us.ibm.com) 27 // Bert Rivero (hurivero@us.ibm.com) 28 // Chuck Carmack (carmack@us.ibm.com) 29 // Brian Lucier (lucier@us.ibm.com) 30 // 31 // Modified By: 32 // 33 //%///////////////////////////////////////////////////////////////////////////// 34 | ||
35 humberto 1.1.2.1 #include "QueryContext.h" 36 #include <Pegasus/Common/System.h> 37 | ||
38 chuck 1.1.2.3 PEGASUS_NAMESPACE_BEGIN 39 40 QueryContext::QueryContext(CIMNamespaceName& inNS) 41 :_NS(inNS) 42 { 43 } 44 45 QueryContext::QueryContext(const QueryContext& ctx) 46 :_NS(ctx._NS), 47 _AliasClassTable(ctx._AliasClassTable), 48 _fromList(ctx._fromList) 49 { 50 } 51 52 QueryContext::~QueryContext() 53 { | ||
54 humberto 1.1.2.1 } 55 | ||
56 chuck 1.1.2.3 QueryContext& QueryContext::operator=(const QueryContext& rhs) 57 { 58 if (this == &rhs) 59 return *this; 60 61 _NS = rhs._NS; 62 _fromList = rhs._fromList; 63 _AliasClassTable = rhs._AliasClassTable; 64 65 return *this; 66 } 67 68 String QueryContext::getHost(Boolean fullyQualified) 69 { | ||
70 humberto 1.1.2.1 if(fullyQualified) return System::getFullyQualifiedHostName(); 71 return System::getHostName(); 72 } 73 | ||
74 chuck 1.1.2.3 CIMNamespaceName QueryContext::getNamespace() const 75 { | ||
76 humberto 1.1.2.1 return _NS; 77 } 78 | ||
79 chuck 1.1.2.3 void QueryContext::insertClassPath(const CQLIdentifier& inIdentifier, String inAlias) 80 { 81 if(inAlias != String::EMPTY) 82 { | ||
83 humberto 1.1.2.1 _AliasClassTable.insert(inAlias, inIdentifier); 84 } 85 _fromList.append(inIdentifier); 86 } 87 | ||
88 chuck 1.1.2.3 CQLIdentifier QueryContext::findClass(const String& inAlias) 89 { | ||
90 humberto 1.1.2.1 // look for alias match 91 CQLIdentifier _class; 92 if(_AliasClassTable.lookup(inAlias, _class)) return _class; 93 94 // look if inAlias is really a class name 95 _class = CQLIdentifier(inAlias); 96 Array<CQLIdentifier> _identifiers = getFromList(); 97 for(Uint32 i = 0; i < _identifiers.size(); i++){ 98 if(_class == _identifiers[i]) return _identifiers[i]; 99 } 100 101 // could not find inAlias 102 return CQLIdentifier(""); | ||
103 chuck 1.1.2.3 } 104 105 Array<CQLIdentifier> QueryContext::getFromList() const 106 { | ||
107 humberto 1.1.2.1 return _fromList; 108 } 109 | ||
110 chuck 1.1.2.4 void QueryContext::clear(){ 111 _fromList.clear(); 112 } 113 | ||
114 humberto 1.1.2.1 PEGASUS_NAMESPACE_END 115 |
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |