SVN_SILENT made messages (.desktop file)
[kdeadmin.git] / kdat / Tape.h
blobe8d20eb4f24e94a11635c910b492900f54e649b1
1 // KDat - a tar-based DAT archiver
2 // Copyright (C) 1998-2000 Sean Vyain, svyain@mail.tds.net
3 // Copyright (C) 2001-2002 Lawrence Widman, kdat@cardiothink.com
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef _Tape_h_
20 #define _Tape_h_
22 #include <q3ptrlist.h>
24 //Added by qt3to4:
25 #include <QByteArray>
27 #include "Archive.h"
29 /**
30 * @short This class represents a single tape index.
32 class Tape {
33 bool _stubbed;
34 QString _id;
35 int _ctime;
36 int _mtime;
37 QString _name;
38 int _size;
39 Q3PtrList<Archive> _children;
41 FILE* _fptr;
43 void readVersion1Index( FILE* fptr );
44 void readVersion2Index( FILE* fptr );
45 void readVersion3Index( FILE* fptr );
46 void readVersion4Index( FILE* fptr );
48 void calcRanges();
50 void read();
51 void readAll( int version );
52 void write();
53 public:
54 /**
55 * Create a new tape index, and automatically generate a unique tape ID.
57 Tape();
59 /**
60 * Create a new tape index for the given tape index ID.
62 * @param id The unique tape index identifier.
64 Tape( const char * id );
66 /**
67 * Destroy the tape index.
69 ~Tape();
71 /**
72 * Writes a KDat header containing the tape ID, at the beginning of the
73 * tape. All data on the tape will be lost.
75 void format();
77 /**
78 * Get the unique ID for the tape.
80 * @return The tape id.
82 QString getID();
84 /**
85 * Get the user-specified name for the tape.
87 * @return The name of the tape.
89 QString getName();
91 /**
92 * Get the date and time that the tape was formatted.
94 * @return The tape format time, in seconds since the Epoch.
96 int getCTime();
98 /**
99 * Get the last time that the tape was modified.
101 * @return The tape modification time, in seconds since the Epoch.
103 int getMTime();
106 * Get the total tape capacity.
108 * @return The tape capacity in kilobytes.
110 int getSize();
113 * Get the list of archives on this tape.
115 * @return The list of all archives on the tape.
117 const Q3PtrList<Archive>& getChildren();
120 * Set the name for the tape.
122 * @param name The new name for the tape.
124 void setName( const QString & name );
127 * Set the modification time for the tape to be the current time..
129 void setMTime( int mtime );
132 * Set the total capacity of the tape.
134 * @param size The total size, in kilobytes, of the tape.
136 void setSize( int size );
139 * Add an archive to the tape index.
141 * @param archive The archive to add.
143 void addChild( Archive* archive );
146 * Remove an archive and all the archives that follow it from the index.
148 * @param archive The archive to remove.
150 void removeChild( Archive* archive );
153 * Recursively destroy all children of the tape index.
155 void clear();
158 #endif