summaryrefslogtreecommitdiffstats
path: root/kioslave/iso/kiso.h
blob: de0f06dca9d2f75079dd4b4635b845dd7a32b8f9 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/***************************************************************************
                                kiso.h
                             -------------------
    begin                : Oct 25 2002
    copyright            : (C) 2002 by Szombathelyi Gy�gy
    email                : gyurco@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

 /* This file is heavily based on ktar.h from tdelibs
  * (c) Torben Weis <weis@kde.org>, David Faure <faure@kde.org>
  */

#ifndef KISO_H
#define KISO_H

#include <sys/stat.h>
#include <sys/types.h>

#include <tqdatetime.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqdict.h>

#include "kisofile.h"
#include "kisodirectory.h"

/**
 * @short A class for reading (optionnally compressed) iso9660 files.
 * @author Gy�gy Szombathelyi <gyurco@users.sourceforge.net>,
 * Torben Weis <weis@kde.org>, David Faure <faure@kde.org>
 */
class KIso : public KArchive
{
public:
    /**
     * Creates an instance that operates on the given filename.
     * using the compression filter associated to given mimetype.
     *
     * @param filename is a local path (e.g. "/home/weis/myfile.tgz")
     * @param mimetype "application/x-gzip" or "application/x-bzip2"
     * Do not use application/x-tgz or so. Only the compression layer !
     * If the mimetype is ommitted, it will be determined from the filename.
     */
    KIso( const TQString& filename, const TQString & mimetype = TQString::null );

    /**
     * Creates an instance that operates on the given device.
     * The device can be compressed (KFilterDev) or not (TQFile, etc.).
     * WARNING: don't assume that giving a TQFile here will decompress the file,
     * in case it's compressed!
     */
    KIso( TQIODevice * dev );

    /**
     * If the .iso is still opened, then it will be
     * closed automatically by the destructor.
     */
    virtual ~KIso();

    /**
     * The name of the os file, as passed to the constructor
     * Null if you used the TQIODevice constructor.
     */
    TQString fileName() { return m_filename; }

    bool writeDir( const TQString& , const TQString& , const TQString& );
    bool prepareWriting( const TQString& , const TQString& , const TQString& , uint );
    bool doneWriting( uint );

    void setStartSec(int startsec) { m_startsec = startsec; }
    int startSec() { return m_startsec; }

    bool showhidden,showrr;
    int level,joliet;
    KIsoDirectory *dirent;
protected:
    /**
     * Opens the archive for reading.
     * Parses the directory listing of the archive
     * and creates the KArchiveDirectory/KArchiveFile entries.
     *
     */
    void readParams();
    virtual bool openArchive( int mode );
    virtual bool closeArchive();

private:
    /**
     * @internal
     */
    void addBoot(struct el_torito_boot_descriptor* bootdesc);
    void prepareDevice( const TQString & filename, const TQString & mimetype, bool forced = false );
    int m_startsec;

    TQString m_filename;
protected:
    virtual void virtual_hook( int id, void* data );
private:
    class KIsoPrivate;
    KIsoPrivate * d;
};

#endif