1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SOLTOOLS_ST_GILRW_HXX 25 #define SOLTOOLS_ST_GILRW_HXX 26 27 28 #include "gilacces.hxx" 29 #include "st_list.hxx" 30 31 class Simstr; 32 class List_GenericInfo; 33 class GenericInfo; 34 class GenericInfo_Parser; 35 36 class ST_InfoListReader : public GenericInfoParseTypes, 37 private GenericInfoList_Builder 38 { 39 public: 40 // LIFECYCLE 41 ST_InfoListReader(); 42 ~ST_InfoListReader(); 43 // OPERATIONS 44 bool LoadList( 45 List_GenericInfo & o_rList, 46 const Simstr & i_sFileName ); 47 // INFO 48 E_Error GetLastError( 49 UINT32 * o_pErrorLine = 0 ) const; 50 private: 51 // Interface GenericInfoList_Builder 52 virtual void AddKey( 53 const char * i_sKey, 54 UINT32 i_nKeyLength, 55 const char * i_sValue, 56 UINT32 i_nValueLength, 57 const char * i_sComment, 58 UINT32 i_nCommentLength ); 59 60 virtual void OpenList(); 61 virtual void CloseList(); 62 63 // Forbid copies: 64 ST_InfoListReader( const ST_InfoListReader & ); 65 ST_InfoListReader & operator=( const ST_InfoListReader & ); 66 67 // DATA 68 GenericInfo_Parser * 69 dpParser; 70 71 ST_List< List_GenericInfo * > 72 aListStack; 73 GenericInfo * pCurKey; 74 }; 75 76 class ST_InfoListWriter : public GenericInfoParseTypes, 77 private GenericInfoList_Browser 78 { 79 public: 80 // LIFECYCLE 81 ST_InfoListWriter(); 82 ~ST_InfoListWriter(); 83 // OPERATIONS 84 bool SaveList( 85 const Simstr & i_sFileName, 86 List_GenericInfo & io_rList ); 87 88 // INFO 89 E_Error GetLastError() const; 90 91 private: 92 // Interface GenericInfoList_Browser 93 virtual bool Start_CurList(); 94 virtual bool NextOf_CurList(); 95 96 virtual void Get_CurKey( 97 char * o_rKey ) const; 98 virtual void Get_CurValue( 99 char * o_rValue ) const; 100 virtual void Get_CurComment( 101 char * o_rComment ) const; 102 virtual bool HasSubList_CurKey() const; 103 104 virtual void Push_CurList(); 105 virtual void Pop_CurList(); 106 107 // Forbid copies: 108 ST_InfoListWriter( const ST_InfoListWriter & ); 109 ST_InfoListWriter & operator=( const ST_InfoListWriter & ); 110 111 // DATA 112 GenericInfo_Parser * 113 dpParser; 114 115 ST_List< List_GenericInfo * > 116 aListStack; 117 GenericInfo * pCurKey; 118 }; 119 120 #endif 121 122