1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 28 #ifndef SOLTOOLS_ST_GILRW_HXX 29 #define SOLTOOLS_ST_GILRW_HXX 30 31 32 #include "gilacces.hxx" 33 #include "st_list.hxx" 34 35 class Simstr; 36 class List_GenericInfo; 37 class GenericInfo; 38 class GenericInfo_Parser; 39 40 class ST_InfoListReader : public GenericInfoParseTypes, 41 private GenericInfoList_Builder 42 { 43 public: 44 // LIFECYCLE 45 ST_InfoListReader(); 46 ~ST_InfoListReader(); 47 // OPERATIONS 48 bool LoadList( 49 List_GenericInfo & o_rList, 50 const Simstr & i_sFileName ); 51 // INFO 52 E_Error GetLastError( 53 UINT32 * o_pErrorLine = 0 ) const; 54 private: 55 // Interface GenericInfoList_Builder 56 virtual void AddKey( 57 const char * i_sKey, 58 UINT32 i_nKeyLength, 59 const char * i_sValue, 60 UINT32 i_nValueLength, 61 const char * i_sComment, 62 UINT32 i_nCommentLength ); 63 64 virtual void OpenList(); 65 virtual void CloseList(); 66 67 // Forbid copies: 68 ST_InfoListReader( const ST_InfoListReader & ); 69 ST_InfoListReader & operator=( const ST_InfoListReader & ); 70 71 // DATA 72 GenericInfo_Parser * 73 dpParser; 74 75 ST_List< List_GenericInfo * > 76 aListStack; 77 GenericInfo * pCurKey; 78 }; 79 80 class ST_InfoListWriter : public GenericInfoParseTypes, 81 private GenericInfoList_Browser 82 { 83 public: 84 // LIFECYCLE 85 ST_InfoListWriter(); 86 ~ST_InfoListWriter(); 87 // OPERATIONS 88 bool SaveList( 89 const Simstr & i_sFileName, 90 List_GenericInfo & io_rList ); 91 92 // INFO 93 E_Error GetLastError() const; 94 95 private: 96 // Interface GenericInfoList_Browser 97 virtual bool Start_CurList(); 98 virtual bool NextOf_CurList(); 99 100 virtual void Get_CurKey( 101 char * o_rKey ) const; 102 virtual void Get_CurValue( 103 char * o_rValue ) const; 104 virtual void Get_CurComment( 105 char * o_rComment ) const; 106 virtual bool HasSubList_CurKey() const; 107 108 virtual void Push_CurList(); 109 virtual void Pop_CurList(); 110 111 // Forbid copies: 112 ST_InfoListWriter( const ST_InfoListWriter & ); 113 ST_InfoListWriter & operator=( const ST_InfoListWriter & ); 114 115 // DATA 116 GenericInfo_Parser * 117 dpParser; 118 119 ST_List< List_GenericInfo * > 120 aListStack; 121 GenericInfo * pCurKey; 122 }; 123 124 #endif 125 126