File: qopen.hpp

package info (click to toggle)
unrar-nonfree 1%3A5.2.7-0.1%2Bdeb8u1
  • links: PTS
  • area: non-free
  • in suites: jessie
  • size: 1,344 kB
  • ctags: 3,512
  • sloc: cpp: 24,411; makefile: 124; sh: 10
file content (61 lines) | stat: -rw-r--r-- 1,212 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef _RAR_QOPEN_
#define _RAR_QOPEN_

struct QuickOpenItem
{
  byte *Header;
  size_t HeaderSize;
  uint64 ArcPos;
  QuickOpenItem *Next;
};


class Archive;
class RawRead;

class QuickOpen
{
  private:
    void Close();


    uint ReadBuffer();
    bool ReadRaw(RawRead &Raw);
    bool ReadNext();

    Archive *Arc;
    bool WriteMode;

    QuickOpenItem *ListStart;
    QuickOpenItem *ListEnd;
    
    byte *Buf;
    static const size_t MaxBufSize=0x10000; // Must be multiple of CRYPT_BLOCK_SIZE.
    size_t CurBufSize;
#ifndef RAR_NOCRYPT // For shell extension.
    CryptData Crypt;
#endif

    bool Loaded;
    uint64 QLHeaderPos;
    uint64 RawDataStart;
    uint64 RawDataSize;
    uint64 RawDataPos;
    size_t ReadBufSize;
    size_t ReadBufPos;
    Array<byte> LastReadHeader;
    uint64 LastReadHeaderPos;
    uint64 SeekPos;
    bool UnsyncSeekPos; // QOpen SeekPos does not match an actual file pointer.
  public:
    QuickOpen();
    ~QuickOpen();
    void Init(Archive *Arc,bool WriteMode);
    void Load(uint64 BlockPos);
    void Unload() { Loaded=false; }
    bool Read(void *Data,size_t Size,size_t &Result);
    bool Seek(int64 Offset,int Method);
    bool Tell(int64 *Pos);
};

#endif