1
/* POLE - Portable library to access OLE Storage
2
Copyright (C) 2002 Ariya Hidayat <ariya@kde.org>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, US
20
#ifndef POLE_STORAGEIO_H
21
#define POLE_STORAGEIO_H
27
#include <polestorage.h>
40
std::vector<Entry*> children;
44
Entry( const Entry& );
45
Entry& operator=( const Entry& );
62
void resize( unsigned long newsize );
64
void set( unsigned long index, unsigned long val );
66
std::vector<unsigned long> follow( unsigned long start );
68
unsigned long operator[](unsigned long index );
72
std::vector<unsigned long> data;
74
AllocTable( const AllocTable& );
76
AllocTable& operator=( const AllocTable& );
83
// result of operation
86
// owner of this object
89
// filename (possible required)
92
// working mode: ReadOnly, WriteOnly, or ReadWrite
99
unsigned long filesize;
101
// header (first 512 byte)
102
unsigned char header[512];
104
// magic id, first 8 bytes of header
105
unsigned char magic[8];
107
// switch from small to big file (usually 4K)
110
// size of big block (should be 512 bytes)
113
// size of small block (should be 64 bytes )
116
// allocation table for big blocks
119
// allocation table for small blocks
122
// starting block index to store small-BAT
125
// blocks where to find data for "small" files
126
std::vector<unsigned long> sb_blocks;
128
// starting block to store meta BAT
131
// starting block index to store directory info
132
unsigned dirent_start;
134
// root directory entry
137
// current directory entry
141
StorageIO( Storage* storage, const char* fileName, int mode );
148
unsigned long loadBigBlocks( std::vector<unsigned long> blocks, unsigned char* buffer, unsigned long maxlen );
150
unsigned long loadBigBlock( unsigned long block, unsigned char* buffer, unsigned long maxlen );
152
unsigned long loadSmallBlocks( std::vector<unsigned long> blocks, unsigned char* buffer, unsigned long maxlen );
154
unsigned long loadSmallBlock( unsigned long block, unsigned char* buffer, unsigned long maxlen );
156
// construct directory tree
157
Entry* buildTree( Entry* parent, int index, const unsigned char* dirent );
159
std::string fullName( Entry* e );
161
// given a fullname (e.g "/ObjectPool/_1020961869"), find the entry
162
Entry* entry( const std::string& name );
172
StorageIO( const StorageIO& );
173
StorageIO& operator=( const StorageIO& );
180
#endif // POLE_STORAGEIO_H