1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 #include "internalnode.hxx"
27 
28 #include <algorithm>
29 #include <connectivity/sqlparse.hxx>
30 
31 using namespace connectivity;
32 
33 //-----------------------------------------------------------------------------
OSQLInternalNode(const sal_Char * pNewValue,SQLNodeType eNodeType,sal_uInt32 nNodeID)34 OSQLInternalNode::OSQLInternalNode(const sal_Char* pNewValue,
35 								   SQLNodeType eNodeType,
36 								   sal_uInt32 nNodeID)
37 				 : OSQLParseNode(pNewValue,eNodeType,nNodeID)
38 {
39 	OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
40 	(*OSQLParser::s_pGarbageCollector)->push_back(this);
41 }
42 
43 //-----------------------------------------------------------------------------
OSQLInternalNode(const::rtl::OString & _NewValue,SQLNodeType eNodeType,sal_uInt32 nNodeID)44 OSQLInternalNode::OSQLInternalNode(const ::rtl::OString &_NewValue,
45 								 SQLNodeType eNodeType,
46 								 sal_uInt32 nNodeID)
47 				:OSQLParseNode(_NewValue,eNodeType,nNodeID)
48 {
49 	OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
50 	(*OSQLParser::s_pGarbageCollector)->push_back(this);
51 }
52 
53 //-----------------------------------------------------------------------------
OSQLInternalNode(const sal_Unicode * pNewValue,SQLNodeType eNodeType,sal_uInt32 nNodeID)54 OSQLInternalNode::OSQLInternalNode(const sal_Unicode* pNewValue,
55 								   SQLNodeType eNodeType,
56 								   sal_uInt32 nNodeID)
57 				 :OSQLParseNode(pNewValue,eNodeType,nNodeID)
58 {
59 	OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
60 	(*OSQLParser::s_pGarbageCollector)->push_back(this);
61 }
62 
63 //-----------------------------------------------------------------------------
OSQLInternalNode(const::rtl::OUString & _NewValue,SQLNodeType eNodeType,sal_uInt32 nNodeID)64 OSQLInternalNode::OSQLInternalNode(const ::rtl::OUString &_NewValue,
65 								 SQLNodeType eNodeType,
66 								 sal_uInt32 nNodeID)
67 				:OSQLParseNode(_NewValue,eNodeType,nNodeID)
68 {
69 	OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
70 	(*OSQLParser::s_pGarbageCollector)->push_back(this);
71 }
72 
73 
74 //-----------------------------------------------------------------------------
~OSQLInternalNode()75 OSQLInternalNode::~OSQLInternalNode()
76 {
77 	// remove the node from the garbage list
78 
79 	OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
80     (*OSQLParser::s_pGarbageCollector)->erase(this);
81 }
82