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>
38 #include <st_list.hxx>
44 ST_InfoListReader::ST_InfoListReader()
46 dpParser
= new GenericInfo_Parser
;
49 ST_InfoListReader::~ST_InfoListReader()
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
);
70 ST_InfoListReader::AddKey( const char * i_sKey
,
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
);
86 ST_InfoListReader::OpenList()
90 cerr
<< "error: '{' without key found." << endl
;
94 aListStack
.push_back( & pCurKey
->SubList() );
98 ST_InfoListReader::CloseList()
100 if ( aListStack
.size() == 0 )
102 cerr
<< "error: '}' without corresponding '}' found." << endl
;
106 aListStack
.pop_back();
111 ST_InfoListWriter::ST_InfoListWriter()
116 ST_InfoListWriter::~ST_InfoListWriter()
119 ST_InfoListWriter::SaveList( const Simstr
& i_sFileName
,
120 List_GenericInfo
& io_rList
)
126 ST_InfoListWriter::GetLastError() const
128 return dpParser
->GetLastError(o_pErrorLine
);
132 ST_InfoListWriter::Start_CurList()
138 ST_InfoListWriter::NextOf_CurList()
144 ST_InfoListWriter::Get_CurKey( char * o_rKey
) const
150 ST_InfoListWriter::Get_CurValue( char * o_rValue
) const
156 ST_InfoListWriter::Get_CurComment( char * o_rComment
) const
162 ST_InfoListWriter::HasSubList_CurKey() const
168 ST_InfoListWriter::Push_CurList()
174 ST_InfoListWriter::Pop_CurList()