xref: /aoo4110/main/soltools/giparser/st_gilrw.cxx (revision b1cdbd2c)
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 
28 #include <st_gilrw.hxx>
29 
30 #include <gen_info.hxx>
31 #include <gi_list.hxx>
32 #include <gi_parse.hxx>
33 #include <simstr.hxx>
34 #include <st_list.hxx>
35 
36 
37 using namespace std;
38 
39 
ST_InfoListReader()40 ST_InfoListReader::ST_InfoListReader()
41 {
42     dpParser = new GenericInfo_Parser;
43 }
44 
~ST_InfoListReader()45 ST_InfoListReader::~ST_InfoListReader()
46 {
47     delete dpParser;
48 }
49 
50 
51 bool
LoadList(List_GenericInfo & o_rList,const Simstr & i_sFileName)52 ST_InfoListReader::LoadList( List_GenericInfo &  o_rList,
53                              const Simstr &      i_sFileName )
54 {
55     aListStack.push_back(&o_rList);
56     return dpParser->LoadList(*this, i_sFileName);
57 }
58 
59 ST_InfoListReader::E_Error
GetLastError(UINT32 * o_pErrorLine) const60 ST_InfoListReader::GetLastError( UINT32 * o_pErrorLine ) const
61 {
62     return dpParser->GetLastError(o_pErrorLine);
63 }
64 
65 void
AddKey(const char * i_sKey,UINT32 i_nKeyLength,const char * i_sValue,UINT32 i_nValueLength,const char * i_sComment,UINT32 i_nCommentLength)66 ST_InfoListReader::AddKey( const char *        i_sKey,
67                            UINT32              i_nKeyLength,
68                            const char *        i_sValue,
69                            UINT32              i_nValueLength,
70                            const char *        i_sComment,
71                            UINT32              i_nCommentLength )
72 {
73     Simstr sKey(i_sKey, i_nKeyLength);
74     Simstr sValue(i_sValue, i_nValueLength);
75     Simstr sComment(i_sComment, i_nCommentLength);
76 
77     pCurKey = new GenericInfo(sKey, sValue, sComment);
78     aListStack.back()->InsertInfo( pCurKey );
79 }
80 
81 void
OpenList()82 ST_InfoListReader::OpenList()
83 {
84     if ( pCurKey == 0 )
85     {
86      	cerr << "error: '{' without key found." << endl;
87         exit(1);
88     }
89 
90     aListStack.push_back( & pCurKey->SubList() );
91 }
92 
93 void
CloseList()94 ST_InfoListReader::CloseList()
95 {
96     if ( aListStack.size() == 0 )
97     {
98      	cerr << "error: '}' without corresponding '}' found." << endl;
99         exit(1);
100     }
101 
102     aListStack.pop_back();
103 }
104 
105 
106 #if 0
107 ST_InfoListWriter::ST_InfoListWriter()
108 {
109 
110 }
111 
112 ST_InfoListWriter::~ST_InfoListWriter()
113 
114 bool
115 ST_InfoListWriter::SaveList( const Simstr &      i_sFileName,
116                              List_GenericInfo &  io_rList )
117 {
118 
119 }
120 
121 E_Error
122 ST_InfoListWriter::GetLastError() const
123 {
124     return dpParser->GetLastError(o_pErrorLine);
125 }
126 
127 bool
128 ST_InfoListWriter::Start_CurList()
129 {
130 
131 }
132 
133 bool
134 ST_InfoListWriter::NextOf_CurList()
135 {
136 
137 }
138 
139 void
140 ST_InfoListWriter::Get_CurKey( char * o_rKey ) const
141 {
142 
143 }
144 
145 void
146 ST_InfoListWriter::Get_CurValue( char * o_rValue ) const
147 {
148 
149 }
150 
151 void
152 ST_InfoListWriter::Get_CurComment( char * o_rComment ) const
153 {
154 
155 }
156 
157 bool
158 ST_InfoListWriter::HasSubList_CurKey() const
159 {
160 
161 }
162 
163 void
164 ST_InfoListWriter::Push_CurList()
165 {
166 
167 }
168 
169 void
170 ST_InfoListWriter::Pop_CurList()
171 {
172 
173 }
174 #endif
175 
176 
177