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