xref: /trunk/main/soltools/giparser/st_gilrw.cxx (revision 7a4715d3)
1*7a4715d3SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*7a4715d3SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*7a4715d3SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*7a4715d3SAndrew Rist  * distributed with this work for additional information
6*7a4715d3SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*7a4715d3SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*7a4715d3SAndrew Rist  * "License"); you may not use this file except in compliance
9*7a4715d3SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*7a4715d3SAndrew Rist  *
11*7a4715d3SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*7a4715d3SAndrew Rist  *
13*7a4715d3SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*7a4715d3SAndrew Rist  * software distributed under the License is distributed on an
15*7a4715d3SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*7a4715d3SAndrew Rist  * KIND, either express or implied.  See the License for the
17*7a4715d3SAndrew Rist  * specific language governing permissions and limitations
18*7a4715d3SAndrew Rist  * under the License.
19*7a4715d3SAndrew Rist  *
20*7a4715d3SAndrew Rist  *************************************************************/
21*7a4715d3SAndrew Rist 
22*7a4715d3SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_soltools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <st_gilrw.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <gen_info.hxx>
31cdf0e10cSrcweir #include <gi_list.hxx>
32cdf0e10cSrcweir #include <gi_parse.hxx>
33cdf0e10cSrcweir #include <simstr.hxx>
34cdf0e10cSrcweir #include <st_list.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir 
37cdf0e10cSrcweir using namespace std;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
ST_InfoListReader()40cdf0e10cSrcweir ST_InfoListReader::ST_InfoListReader()
41cdf0e10cSrcweir {
42cdf0e10cSrcweir     dpParser = new GenericInfo_Parser;
43cdf0e10cSrcweir }
44cdf0e10cSrcweir 
~ST_InfoListReader()45cdf0e10cSrcweir ST_InfoListReader::~ST_InfoListReader()
46cdf0e10cSrcweir {
47cdf0e10cSrcweir     delete dpParser;
48cdf0e10cSrcweir }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 
51cdf0e10cSrcweir bool
LoadList(List_GenericInfo & o_rList,const Simstr & i_sFileName)52cdf0e10cSrcweir ST_InfoListReader::LoadList( List_GenericInfo &  o_rList,
53cdf0e10cSrcweir                              const Simstr &      i_sFileName )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     aListStack.push_back(&o_rList);
56cdf0e10cSrcweir     return dpParser->LoadList(*this, i_sFileName);
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir ST_InfoListReader::E_Error
GetLastError(UINT32 * o_pErrorLine) const60cdf0e10cSrcweir ST_InfoListReader::GetLastError( UINT32 * o_pErrorLine ) const
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     return dpParser->GetLastError(o_pErrorLine);
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir void
AddKey(const char * i_sKey,UINT32 i_nKeyLength,const char * i_sValue,UINT32 i_nValueLength,const char * i_sComment,UINT32 i_nCommentLength)66cdf0e10cSrcweir ST_InfoListReader::AddKey( const char *        i_sKey,
67cdf0e10cSrcweir                            UINT32              i_nKeyLength,
68cdf0e10cSrcweir                            const char *        i_sValue,
69cdf0e10cSrcweir                            UINT32              i_nValueLength,
70cdf0e10cSrcweir                            const char *        i_sComment,
71cdf0e10cSrcweir                            UINT32              i_nCommentLength )
72cdf0e10cSrcweir {
73cdf0e10cSrcweir     Simstr sKey(i_sKey, i_nKeyLength);
74cdf0e10cSrcweir     Simstr sValue(i_sValue, i_nValueLength);
75cdf0e10cSrcweir     Simstr sComment(i_sComment, i_nCommentLength);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     pCurKey = new GenericInfo(sKey, sValue, sComment);
78cdf0e10cSrcweir     aListStack.back()->InsertInfo( pCurKey );
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir void
OpenList()82cdf0e10cSrcweir ST_InfoListReader::OpenList()
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     if ( pCurKey == 0 )
85cdf0e10cSrcweir     {
86cdf0e10cSrcweir      	cerr << "error: '{' without key found." << endl;
87cdf0e10cSrcweir         exit(1);
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     aListStack.push_back( & pCurKey->SubList() );
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir void
CloseList()94cdf0e10cSrcweir ST_InfoListReader::CloseList()
95cdf0e10cSrcweir {
96cdf0e10cSrcweir     if ( aListStack.size() == 0 )
97cdf0e10cSrcweir     {
98cdf0e10cSrcweir      	cerr << "error: '}' without corresponding '}' found." << endl;
99cdf0e10cSrcweir         exit(1);
100cdf0e10cSrcweir     }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     aListStack.pop_back();
103cdf0e10cSrcweir }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir #if 0
107cdf0e10cSrcweir ST_InfoListWriter::ST_InfoListWriter()
108cdf0e10cSrcweir {
109cdf0e10cSrcweir 
110cdf0e10cSrcweir }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir ST_InfoListWriter::~ST_InfoListWriter()
113cdf0e10cSrcweir 
114cdf0e10cSrcweir bool
115cdf0e10cSrcweir ST_InfoListWriter::SaveList( const Simstr &      i_sFileName,
116cdf0e10cSrcweir                              List_GenericInfo &  io_rList )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir E_Error
122cdf0e10cSrcweir ST_InfoListWriter::GetLastError() const
123cdf0e10cSrcweir {
124cdf0e10cSrcweir     return dpParser->GetLastError(o_pErrorLine);
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir bool
128cdf0e10cSrcweir ST_InfoListWriter::Start_CurList()
129cdf0e10cSrcweir {
130cdf0e10cSrcweir 
131cdf0e10cSrcweir }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir bool
134cdf0e10cSrcweir ST_InfoListWriter::NextOf_CurList()
135cdf0e10cSrcweir {
136cdf0e10cSrcweir 
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir void
140cdf0e10cSrcweir ST_InfoListWriter::Get_CurKey( char * o_rKey ) const
141cdf0e10cSrcweir {
142cdf0e10cSrcweir 
143cdf0e10cSrcweir }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir void
146cdf0e10cSrcweir ST_InfoListWriter::Get_CurValue( char * o_rValue ) const
147cdf0e10cSrcweir {
148cdf0e10cSrcweir 
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir void
152cdf0e10cSrcweir ST_InfoListWriter::Get_CurComment( char * o_rComment ) const
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 
155cdf0e10cSrcweir }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir bool
158cdf0e10cSrcweir ST_InfoListWriter::HasSubList_CurKey() const
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 
161cdf0e10cSrcweir }
162cdf0e10cSrcweir 
163cdf0e10cSrcweir void
164cdf0e10cSrcweir ST_InfoListWriter::Push_CurList()
165cdf0e10cSrcweir {
166cdf0e10cSrcweir 
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir void
170cdf0e10cSrcweir ST_InfoListWriter::Pop_CurList()
171cdf0e10cSrcweir {
172cdf0e10cSrcweir 
173cdf0e10cSrcweir }
174cdf0e10cSrcweir #endif
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 
177