merge the formfield patch from ooo-build
[ooovba.git] / soltools / giparser / st_gilrw.cxx
blob207fb9670b406646a2bbbd450335a40cad7fcd26
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: st_gilrw.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_soltools.hxx"
35 #include <st_gilrw.hxx>
37 #include <gen_info.hxx>
38 #include <gi_list.hxx>
39 #include <gi_parse.hxx>
40 #include <simstr.hxx>
41 #include <st_list.hxx>
44 using namespace std;
47 ST_InfoListReader::ST_InfoListReader()
49 dpParser = new GenericInfo_Parser;
52 ST_InfoListReader::~ST_InfoListReader()
54 delete dpParser;
58 bool
59 ST_InfoListReader::LoadList( List_GenericInfo & o_rList,
60 const Simstr & i_sFileName )
62 aListStack.push_back(&o_rList);
63 return dpParser->LoadList(*this, i_sFileName);
66 ST_InfoListReader::E_Error
67 ST_InfoListReader::GetLastError( UINT32 * o_pErrorLine ) const
69 return dpParser->GetLastError(o_pErrorLine);
72 void
73 ST_InfoListReader::AddKey( const char * i_sKey,
74 UINT32 i_nKeyLength,
75 const char * i_sValue,
76 UINT32 i_nValueLength,
77 const char * i_sComment,
78 UINT32 i_nCommentLength )
80 Simstr sKey(i_sKey, i_nKeyLength);
81 Simstr sValue(i_sValue, i_nValueLength);
82 Simstr sComment(i_sComment, i_nCommentLength);
84 pCurKey = new GenericInfo(sKey, sValue, sComment);
85 aListStack.back()->InsertInfo( pCurKey );
88 void
89 ST_InfoListReader::OpenList()
91 if ( pCurKey == 0 )
93 cerr << "error: '{' without key found." << endl;
94 exit(1);
97 aListStack.push_back( & pCurKey->SubList() );
100 void
101 ST_InfoListReader::CloseList()
103 if ( aListStack.size() == 0 )
105 cerr << "error: '}' without corresponding '}' found." << endl;
106 exit(1);
109 aListStack.pop_back();
113 #if 0
114 ST_InfoListWriter::ST_InfoListWriter()
119 ST_InfoListWriter::~ST_InfoListWriter()
121 bool
122 ST_InfoListWriter::SaveList( const Simstr & i_sFileName,
123 List_GenericInfo & io_rList )
128 E_Error
129 ST_InfoListWriter::GetLastError() const
131 return dpParser->GetLastError(o_pErrorLine);
134 bool
135 ST_InfoListWriter::Start_CurList()
140 bool
141 ST_InfoListWriter::NextOf_CurList()
146 void
147 ST_InfoListWriter::Get_CurKey( char * o_rKey ) const
152 void
153 ST_InfoListWriter::Get_CurValue( char * o_rValue ) const
158 void
159 ST_InfoListWriter::Get_CurComment( char * o_rComment ) const
164 bool
165 ST_InfoListWriter::HasSubList_CurKey() const
170 void
171 ST_InfoListWriter::Push_CurList()
176 void
177 ST_InfoListWriter::Pop_CurList()
181 #endif