xref: /trunk/main/soltools/giparser/gen_info.cxx (revision 7a4715d3)
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_soltools.hxx"
26 
27 #include <gen_info.hxx>
28 #include <gi_list.hxx>
29 
30 
GenericInfo(const Simstr & i_sKey,const Simstr & i_sValue,const Simstr & i_sComment)31 GenericInfo::GenericInfo( const Simstr &      i_sKey,
32                           const Simstr &      i_sValue,
33                           const Simstr &      i_sComment )
34     :   sKey(i_sKey),
35 	    sValue(i_sValue),
36 	    sComment(i_sComment),
37 	    dpSubList(0)
38 {
39 }
40 
GenericInfo(const GenericInfo & i_rInfo)41 GenericInfo::GenericInfo( const GenericInfo & i_rInfo )
42     :   sKey(i_rInfo.sKey),
43 	    sValue(i_rInfo.sValue),
44 	    sComment(i_rInfo.sComment),
45         dpSubList(0)
46 {
47     if ( i_rInfo.HasSubList() )
48     {
49         dpSubList = new List_GenericInfo(i_rInfo.SubList());
50     }
51 }
52 
~GenericInfo()53 GenericInfo::~GenericInfo()
54 {
55     if ( dpSubList != 0 )
56         delete dpSubList;
57 }
58 
59 GenericInfo &
operator =(const GenericInfo & i_rInfo)60 GenericInfo::operator=( const GenericInfo & i_rInfo )
61 {
62     sKey = i_rInfo.sKey;
63     sValue = i_rInfo.sValue;
64     sComment = i_rInfo.sComment;
65 
66     if ( dpSubList != 0 )
67         delete dpSubList;
68     if ( i_rInfo.HasSubList() )
69     {
70         dpSubList = new List_GenericInfo(i_rInfo.SubList());
71     }
72     else
73         dpSubList = 0;
74 
75     return *this;
76 }
77 
78 List_GenericInfo &
CreateMyList() const79 GenericInfo::CreateMyList() const
80 {
81     return * ( const_cast<GenericInfo&>(*this).dpSubList = new List_GenericInfo);
82 
83 }
84 
85