merged tag ooo/DEV300_m102
[LibreOffice.git] / soltools / giparser / st_gilrw.cxx
blobd57d8811cb31bed46eb2e7a84d757e38d1470f42
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_soltools.hxx"
32 #include <st_gilrw.hxx>
34 #include <gen_info.hxx>
35 #include <gi_list.hxx>
36 #include <gi_parse.hxx>
37 #include <simstr.hxx>
38 #include <st_list.hxx>
41 using namespace std;
44 ST_InfoListReader::ST_InfoListReader()
46 dpParser = new GenericInfo_Parser;
49 ST_InfoListReader::~ST_InfoListReader()
51 delete dpParser;
55 bool
56 ST_InfoListReader::LoadList( List_GenericInfo & o_rList,
57 const Simstr & i_sFileName )
59 aListStack.push_back(&o_rList);
60 return dpParser->LoadList(*this, i_sFileName);
63 ST_InfoListReader::E_Error
64 ST_InfoListReader::GetLastError( UINT32 * o_pErrorLine ) const
66 return dpParser->GetLastError(o_pErrorLine);
69 void
70 ST_InfoListReader::AddKey( const char * i_sKey,
71 UINT32 i_nKeyLength,
72 const char * i_sValue,
73 UINT32 i_nValueLength,
74 const char * i_sComment,
75 UINT32 i_nCommentLength )
77 Simstr sKey(i_sKey, i_nKeyLength);
78 Simstr sValue(i_sValue, i_nValueLength);
79 Simstr sComment(i_sComment, i_nCommentLength);
81 pCurKey = new GenericInfo(sKey, sValue, sComment);
82 aListStack.back()->InsertInfo( pCurKey );
85 void
86 ST_InfoListReader::OpenList()
88 if ( pCurKey == 0 )
90 cerr << "error: '{' without key found." << endl;
91 exit(1);
94 aListStack.push_back( & pCurKey->SubList() );
97 void
98 ST_InfoListReader::CloseList()
100 if ( aListStack.size() == 0 )
102 cerr << "error: '}' without corresponding '}' found." << endl;
103 exit(1);
106 aListStack.pop_back();
110 #if 0
111 ST_InfoListWriter::ST_InfoListWriter()
116 ST_InfoListWriter::~ST_InfoListWriter()
118 bool
119 ST_InfoListWriter::SaveList( const Simstr & i_sFileName,
120 List_GenericInfo & io_rList )
125 E_Error
126 ST_InfoListWriter::GetLastError() const
128 return dpParser->GetLastError(o_pErrorLine);
131 bool
132 ST_InfoListWriter::Start_CurList()
137 bool
138 ST_InfoListWriter::NextOf_CurList()
143 void
144 ST_InfoListWriter::Get_CurKey( char * o_rKey ) const
149 void
150 ST_InfoListWriter::Get_CurValue( char * o_rValue ) const
155 void
156 ST_InfoListWriter::Get_CurComment( char * o_rComment ) const
161 bool
162 ST_InfoListWriter::HasSubList_CurKey() const
167 void
168 ST_InfoListWriter::Push_CurList()
173 void
174 ST_InfoListWriter::Pop_CurList()
178 #endif