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
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.
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
22 #include <q3ptrlist.h>
30 * @short This class represents a single tape index.
39 Q3PtrList
<Archive
> _children
;
43 void readVersion1Index( FILE* fptr
);
44 void readVersion2Index( FILE* fptr
);
45 void readVersion3Index( FILE* fptr
);
46 void readVersion4Index( FILE* fptr
);
51 void readAll( int version
);
55 * Create a new tape index, and automatically generate a unique tape ID.
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
);
67 * Destroy the tape index.
72 * Writes a KDat header containing the tape ID, at the beginning of the
73 * tape. All data on the tape will be lost.
78 * Get the unique ID for the tape.
80 * @return The tape id.
85 * Get the user-specified name for the tape.
87 * @return The name of the tape.
92 * Get the date and time that the tape was formatted.
94 * @return The tape format time, in seconds since the Epoch.
99 * Get the last time that the tape was modified.
101 * @return The tape modification time, in seconds since the Epoch.
106 * Get the total tape capacity.
108 * @return The tape capacity in kilobytes.
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.