1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gi_parse.hxx,v $
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 ************************************************************************/
30 #ifndef SOLTOOLS_GI_PARSE_HXX
31 #define SOLTOOLS_GI_PARSE_HXX
34 #include "gilacces.hxx"
37 class GenericInfoList_Builder
;
38 class GenericInfoList_Browser
;
40 /** Reads generic information files into a simple structure in memory.
42 Information files used by this parser have the following format:
61 class GenericInfo_Parser
: public GenericInfoParseTypes
64 typedef unsigned long UINT32
;
68 ~GenericInfo_Parser();
70 /** reads a information file and stores the data in a
74 GenericInfoList_Builder
&
76 const Simstr
& i_sSourceFileName
);
78 /** save the InformationList to rSourceFile
79 returns false on error
82 const Simstr
& i_rOutputFile
,
83 GenericInfoList_Browser
&
87 UINT32
* o_pErrorLine
= 0 ) const;
102 GenericInfoList_Builder
&
105 GenericInfoList_Browser
&
109 bool InterpretLine();
110 E_LineType
ClassifyLine();
113 void PushLevel_Read(); /// When list is opened by '{':
114 void PopLevel_Read(); /// When list is closed by '}':
115 void AddCurLine2CurComment();
118 std::ostream
& o_rFile
);
120 void PushLevel_Write(); /// When SubList is pushed in pResource
121 void PopLevel_Write(); /// When SubList is popped in pResource
124 std::ostream
& o_rFile
,
125 const char * i_sStr
);
127 std::ostream
& o_rFile
,
128 const char * i_sStr
);
130 std::ostream
& o_rFile
,
131 const char * i_sStr
);
132 void WriteIndentation(
133 std::ostream
& o_rFile
);
136 const char * sCurParsePosition
;
147 GenericInfoList_Builder
*
149 GenericInfoList_Browser
*
157 inline GenericInfo_Parser::E_Error
158 GenericInfo_Parser::GetLastError( UINT32
* o_pErrorLine
) const
160 if ( o_pErrorLine
!= 0 )
161 *o_pErrorLine
= nErrorLine
;