xref: /trunk/main/sot/source/sdstor/stgio.hxx (revision bbfc4cc7)
1*bbfc4cc7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*bbfc4cc7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*bbfc4cc7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*bbfc4cc7SAndrew Rist  * distributed with this work for additional information
6*bbfc4cc7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*bbfc4cc7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*bbfc4cc7SAndrew Rist  * "License"); you may not use this file except in compliance
9*bbfc4cc7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*bbfc4cc7SAndrew Rist  *
11*bbfc4cc7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*bbfc4cc7SAndrew Rist  *
13*bbfc4cc7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*bbfc4cc7SAndrew Rist  * software distributed under the License is distributed on an
15*bbfc4cc7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*bbfc4cc7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*bbfc4cc7SAndrew Rist  * specific language governing permissions and limitations
18*bbfc4cc7SAndrew Rist  * under the License.
19*bbfc4cc7SAndrew Rist  *
20*bbfc4cc7SAndrew Rist  *************************************************************/
21*bbfc4cc7SAndrew Rist 
22*bbfc4cc7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _STGIO_HXX
25cdf0e10cSrcweir #define _STGIO_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stgcache.hxx>
28cdf0e10cSrcweir #include <stgelem.hxx>
29cdf0e10cSrcweir #include <tools/string.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class StgFATStrm;
32cdf0e10cSrcweir class StgDataStrm;
33cdf0e10cSrcweir class StgDirStrm;
34cdf0e10cSrcweir class String;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir enum FAT_ERROR
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	FAT_OK,
39cdf0e10cSrcweir 	FAT_WRONGLENGTH,
40cdf0e10cSrcweir 	FAT_UNREFCHAIN,
41cdf0e10cSrcweir 	FAT_OVERWRITE,
42cdf0e10cSrcweir 	FAT_OUTOFBOUNDS,
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 	FAT_INMEMORYERROR,
45cdf0e10cSrcweir 	FAT_ONFILEERROR,
46cdf0e10cSrcweir 	FAT_BOTHERROR
47cdf0e10cSrcweir };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir struct StgLinkArg
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 	String aFile;
52cdf0e10cSrcweir 	sal_uLong nErr;
53cdf0e10cSrcweir };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class StgIo : public StgCache {
56cdf0e10cSrcweir 	void SetupStreams();			// load all internal streams
57cdf0e10cSrcweir 	sal_Bool         bCopied;
58cdf0e10cSrcweir public:
59cdf0e10cSrcweir 	StgIo();
60cdf0e10cSrcweir    ~StgIo();
61cdf0e10cSrcweir 	StgHeader    aHdr;				// storage file header
62cdf0e10cSrcweir 	StgFATStrm*  pFAT;				// FAT stream
63cdf0e10cSrcweir 	StgDirStrm*  pTOC;				// TOC stream
64cdf0e10cSrcweir 	StgDataStrm* pDataFAT;			// small data FAT stream
65cdf0e10cSrcweir 	StgDataStrm* pDataStrm;			// small data stream
66cdf0e10cSrcweir 	short	  	 GetDataPageSize();	// get the logical data page size
67cdf0e10cSrcweir 	sal_Bool Load();					// load a storage file
68cdf0e10cSrcweir 	sal_Bool Init();					// set up an empty file
69cdf0e10cSrcweir 	sal_Bool CommitAll();				// commit everything (root commit)
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	static void SetErrorLink( const Link& );
72cdf0e10cSrcweir 	static const Link& GetErrorLink();
73cdf0e10cSrcweir 	sal_uLong ValidateFATs( );
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
76cdf0e10cSrcweir #endif
77