xref: /aoo42x/main/soltools/giparser/st_gilrw.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_soltools.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <st_gilrw.hxx>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <gen_info.hxx>
35*cdf0e10cSrcweir #include <gi_list.hxx>
36*cdf0e10cSrcweir #include <gi_parse.hxx>
37*cdf0e10cSrcweir #include <simstr.hxx>
38*cdf0e10cSrcweir #include <st_list.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir using namespace std;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir ST_InfoListReader::ST_InfoListReader()
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir     dpParser = new GenericInfo_Parser;
47*cdf0e10cSrcweir }
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir ST_InfoListReader::~ST_InfoListReader()
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir     delete dpParser;
52*cdf0e10cSrcweir }
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir bool
56*cdf0e10cSrcweir ST_InfoListReader::LoadList( List_GenericInfo &  o_rList,
57*cdf0e10cSrcweir                              const Simstr &      i_sFileName )
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir     aListStack.push_back(&o_rList);
60*cdf0e10cSrcweir     return dpParser->LoadList(*this, i_sFileName);
61*cdf0e10cSrcweir }
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir ST_InfoListReader::E_Error
64*cdf0e10cSrcweir ST_InfoListReader::GetLastError( UINT32 * o_pErrorLine ) const
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir     return dpParser->GetLastError(o_pErrorLine);
67*cdf0e10cSrcweir }
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir void
70*cdf0e10cSrcweir ST_InfoListReader::AddKey( const char *        i_sKey,
71*cdf0e10cSrcweir                            UINT32              i_nKeyLength,
72*cdf0e10cSrcweir                            const char *        i_sValue,
73*cdf0e10cSrcweir                            UINT32              i_nValueLength,
74*cdf0e10cSrcweir                            const char *        i_sComment,
75*cdf0e10cSrcweir                            UINT32              i_nCommentLength )
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir     Simstr sKey(i_sKey, i_nKeyLength);
78*cdf0e10cSrcweir     Simstr sValue(i_sValue, i_nValueLength);
79*cdf0e10cSrcweir     Simstr sComment(i_sComment, i_nCommentLength);
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir     pCurKey = new GenericInfo(sKey, sValue, sComment);
82*cdf0e10cSrcweir     aListStack.back()->InsertInfo( pCurKey );
83*cdf0e10cSrcweir }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir void
86*cdf0e10cSrcweir ST_InfoListReader::OpenList()
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir     if ( pCurKey == 0 )
89*cdf0e10cSrcweir     {
90*cdf0e10cSrcweir      	cerr << "error: '{' without key found." << endl;
91*cdf0e10cSrcweir         exit(1);
92*cdf0e10cSrcweir     }
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir     aListStack.push_back( & pCurKey->SubList() );
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir void
98*cdf0e10cSrcweir ST_InfoListReader::CloseList()
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir     if ( aListStack.size() == 0 )
101*cdf0e10cSrcweir     {
102*cdf0e10cSrcweir      	cerr << "error: '}' without corresponding '}' found." << endl;
103*cdf0e10cSrcweir         exit(1);
104*cdf0e10cSrcweir     }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     aListStack.pop_back();
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir #if 0
111*cdf0e10cSrcweir ST_InfoListWriter::ST_InfoListWriter()
112*cdf0e10cSrcweir {
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir }
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir ST_InfoListWriter::~ST_InfoListWriter()
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir bool
119*cdf0e10cSrcweir ST_InfoListWriter::SaveList( const Simstr &      i_sFileName,
120*cdf0e10cSrcweir                              List_GenericInfo &  io_rList )
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir E_Error
126*cdf0e10cSrcweir ST_InfoListWriter::GetLastError() const
127*cdf0e10cSrcweir {
128*cdf0e10cSrcweir     return dpParser->GetLastError(o_pErrorLine);
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir bool
132*cdf0e10cSrcweir ST_InfoListWriter::Start_CurList()
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir bool
138*cdf0e10cSrcweir ST_InfoListWriter::NextOf_CurList()
139*cdf0e10cSrcweir {
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir void
144*cdf0e10cSrcweir ST_InfoListWriter::Get_CurKey( char * o_rKey ) const
145*cdf0e10cSrcweir {
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir void
150*cdf0e10cSrcweir ST_InfoListWriter::Get_CurValue( char * o_rValue ) const
151*cdf0e10cSrcweir {
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir }
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir void
156*cdf0e10cSrcweir ST_InfoListWriter::Get_CurComment( char * o_rComment ) const
157*cdf0e10cSrcweir {
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir }
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir bool
162*cdf0e10cSrcweir ST_InfoListWriter::HasSubList_CurKey() const
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir }
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir void
168*cdf0e10cSrcweir ST_InfoListWriter::Push_CurList()
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir void
174*cdf0e10cSrcweir ST_InfoListWriter::Pop_CurList()
175*cdf0e10cSrcweir {
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir #endif
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 
181