\section{KArchive Class Reference}
\label{classKArchive}\index{KArchive@{KArchive}}
KArchive is a base class for reading and writing archives. generic class for reading/writing archives.  


{\tt \#include $<$karchive.h$>$}

Inheritance diagram for KArchive:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=89pt]{classKArchive__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KArchive:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=50pt]{classKArchive__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf open} (int mode)
\item 
virtual void {\bf close} ()
\item 
bool {\bf is\-Opened} () const 
\item 
int {\bf mode} () const 
\item 
{\bf QIODevice} $\ast$ {\bf device} () const 
\item 
const {\bf KArchive\-Directory} $\ast$ {\bf directory} () const 
\item 
bool {\bf add\-Local\-File} (const {\bf QString} \&file\-Name, const {\bf QString} \&dest\-Name)
\item 
bool {\bf add\-Local\-Directory} (const {\bf QString} \&path, const {\bf QString} \&dest\-Name)
\item 
virtual bool {\bf write\-Dir} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group)=0
\item 
bool {\bf write\-Dir} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime)
\item 
bool {\bf write\-Sym\-Link} (const {\bf QString} \&name, const {\bf QString} \&target, const {\bf QString} \&user, const {\bf QString} \&group, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime)
\item 
virtual bool {\bf write\-File} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, uint size, const char $\ast$data)
\item 
bool {\bf write\-File} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, uint size, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime, const char $\ast$data)
\item 
virtual bool {\bf prepare\-Writing} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, uint size)=0
\item 
bool {\bf prepare\-Writing} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, uint size, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime)
\item 
bool {\bf write\-Data} (const char $\ast$data, uint size)
\item 
virtual bool {\bf done\-Writing} (uint size)=0
\end{CompactItemize}
\subsection*{Protected Types}
\begin{CompactItemize}
\item 
enum \{ \par
{\bf VIRTUAL\_\-WRITE\_\-DATA} =  1, 
{\bf VIRTUAL\_\-WRITE\_\-SYMLINK}, 
{\bf VIRTUAL\_\-WRITE\_\-DIR}, 
{\bf VIRTUAL\_\-WRITE\_\-FILE}, 
\par
{\bf VIRTUAL\_\-PREPARE\_\-WRITING}
 \}
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KArchive} ({\bf QIODevice} $\ast$dev)
\item 
virtual bool {\bf open\-Archive} (int mode)=0
\item 
virtual bool {\bf close\-Archive} ()=0
\item 
virtual {\bf KArchive\-Directory} $\ast$ {\bf root\-Dir} ()
\item 
{\bf KArchive\-Directory} $\ast$ {\bf find\-Or\-Create} (const {\bf QString} \&path)
\item 
void {\bf set\-Device} ({\bf QIODevice} $\ast$dev)\label{classKArchive_b5}

\item 
void {\bf set\-Root\-Dir} ({\bf KArchive\-Directory} $\ast$root\-Dir)\label{classKArchive_b6}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKArchive_b7}

\item 
bool {\bf prepare\-Writing\_\-impl} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, uint size, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime)\label{classKArchive_b8}

\item 
bool {\bf write\-File\_\-impl} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, uint size, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime, const char $\ast$data)\label{classKArchive_b9}

\item 
bool {\bf write\-Dir\_\-impl} (const {\bf QString} \&name, const {\bf QString} \&user, const {\bf QString} \&group, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime)\label{classKArchive_b10}

\item 
bool {\bf write\-Sym\-Link\_\-impl} (const {\bf QString} \&name, const {\bf QString} \&target, const {\bf QString} \&user, const {\bf QString} \&group, mode\_\-t perm, time\_\-t atime, time\_\-t mtime, time\_\-t ctime)\label{classKArchive_b11}

\item 
bool {\bf write\-Data\_\-impl} (const char $\ast$data, uint size)\label{classKArchive_b12}

\end{CompactItemize}


\subsection{Detailed Description}
KArchive is a base class for reading and writing archives. generic class for reading/writing archives. 

\begin{Desc}
\item[Author:]David Faure $<${\tt faure@kde.org}$>$ \end{Desc}




Definition at line 42 of file karchive.h.

\subsection{Constructor \& Destructor Documentation}
\index{KArchive@{KArchive}!KArchive@{KArchive}}
\index{KArchive@{KArchive}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KArchive::KArchive ({\bf QIODevice} $\ast$ {\em dev})\hspace{0.3cm}{\tt  [protected]}}\label{classKArchive_b0}


Base constructor (protected since this is a pure virtual class). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dev}]the I/O device where the archive reads its data Note that this can be a file, but also a data buffer, a compression filter, etc. \end{description}
\end{Desc}


Definition at line 74 of file karchive.cpp.

\subsection{Member Function Documentation}
\index{KArchive@{KArchive}!open@{open}}
\index{open@{open}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::open (int {\em mode})\hspace{0.3cm}{\tt  [virtual]}}\label{classKArchive_a1}


Opens the archive for reading or writing. 

Inherited classes might want to reimplement open\-Archive instead. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mode}]may be IO\_\-Read\-Only or IO\_\-Write\-Only \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf close}{\rm (p.\,\pageref{classKArchive_a2})} \end{Desc}


Definition at line 90 of file karchive.cpp.

References close(), QIODevice::open(), and open\-Archive().

Referenced by KZip::open\-Archive().\index{KArchive@{KArchive}!close@{close}}
\index{close@{close}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KArchive::close ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKArchive_a2}


Closes the archive. 

Inherited classes might want to reimplement close\-Archive instead.

\begin{Desc}
\item[See also:]{\bf open}{\rm (p.\,\pageref{classKArchive_a1})} \end{Desc}


Definition at line 107 of file karchive.cpp.

References QIODevice::close(), and close\-Archive().

Referenced by open(), KAr::$\sim$KAr(), KTar::$\sim$KTar(), and KZip::$\sim$KZip().\index{KArchive@{KArchive}!isOpened@{isOpened}}
\index{isOpened@{isOpened}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::is\-Opened () const\hspace{0.3cm}{\tt  [inline]}}\label{classKArchive_a3}


Checks whether the archive is open. 

\begin{Desc}
\item[Returns:]true if the archive is opened \end{Desc}


Definition at line 75 of file karchive.h.

Referenced by KTar::set\-Orig\-File\-Name(), KTar::write\-Dir(), KAr::$\sim$KAr(), KTar::$\sim$KTar(), and KZip::$\sim$KZip().\index{KArchive@{KArchive}!mode@{mode}}
\index{mode@{mode}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KArchive::mode () const\hspace{0.3cm}{\tt  [inline]}}\label{classKArchive_a4}


Returns the mode in which the archive was opened. 

\begin{Desc}
\item[Returns:]the mode in which the archive was opened (IO\_\-Read\-Only or IO\_\-Write\-Only) \end{Desc}
\begin{Desc}
\item[See also:]{\bf open()}{\rm (p.\,\pageref{classKArchive_a1})} \end{Desc}


Definition at line 82 of file karchive.h.

Referenced by KZip::close\-Archive(), KTar::close\-Archive(), KTar::done\-Writing(), KTar::set\-Orig\-File\-Name(), and KTar::write\-Dir().\index{KArchive@{KArchive}!device@{device}}
\index{device@{device}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QIODevice}$\ast$ KArchive::device () const\hspace{0.3cm}{\tt  [inline]}}\label{classKArchive_a5}


The underlying device. 

\begin{Desc}
\item[Returns:]the underlying device. \end{Desc}


Definition at line 88 of file karchive.h.

Referenced by KZip::close\-Archive(), KArchive\-File::data(), KZip::done\-Writing(), KTar::done\-Writing(), KZip::open\-Archive(), KTar::open\-Archive(), KAr::open\-Archive(), KTar::write\-Dir(), KAr::$\sim$KAr(), KTar::$\sim$KTar(), and KZip::$\sim$KZip().\index{KArchive@{KArchive}!directory@{directory}}
\index{directory@{directory}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf KArchive\-Directory} $\ast$ KArchive::directory () const}\label{classKArchive_a6}


If an archive is opened for reading, then the contents of the archive can be accessed via this function. 

\begin{Desc}
\item[Returns:]the directory of the archive \end{Desc}


Definition at line 123 of file karchive.cpp.\index{KArchive@{KArchive}!addLocalFile@{addLocalFile}}
\index{addLocalFile@{addLocalFile}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::add\-Local\-File (const {\bf QString} \& {\em file\-Name}, const {\bf QString} \& {\em dest\-Name})}\label{classKArchive_a7}


Writes a local file into the archive. 

The main difference with write\-File, is that this method minimizes memory usage, by not loading the whole file into memory in one go.

If {\tt file\-Name} is a symbolic link, it will be written as is, i. e. it will not be resolved before. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]full path to an existing local file, to be added to the archive. \item[{\em dest\-Name}]the resulting name (or relative path) of the file in the archive. \end{description}
\end{Desc}


Definition at line 130 of file karchive.cpp.

References done\-Writing(), endl(), QFile\-Info::group(), QFile\-Info::is\-File(), QFile\-Info::is\-Sym\-Link(), kd\-Warning(), QFile::open(), QFile\-Info::owner(), prepare\-Writing(), QFile\-Info::read\-Link(), QFile\-Info::size(), write\-Data(), and write\-Sym\-Link().

Referenced by add\-Local\-Directory().\index{KArchive@{KArchive}!addLocalDirectory@{addLocalDirectory}}
\index{addLocalDirectory@{addLocalDirectory}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::add\-Local\-Directory (const {\bf QString} \& {\em path}, const {\bf QString} \& {\em dest\-Name})}\label{classKArchive_a8}


Writes a local directory into the archive, including all its contents, recursively. 

Calls add\-Local\-File for each file to be added.

Since {\bf KDE} 3.2 it will also add a {\tt path} that is a symbolic link to a directory. The symbolic link will be dereferenced and the content of the directory it is pointing to added recursively. However, symbolic links $\ast$under$\ast$ {\tt path} will be stored as is. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em path}]full path to an existing local directory, to be added to the archive. \item[{\em dest\-Name}]the resulting name (or relative path) of the file in the archive. \end{description}
\end{Desc}


Definition at line 194 of file karchive.cpp.

References add\-Local\-File(), QDir::entry\-List(), QDir::exists(), QFile\-Info::is\-Dir(), QFile\-Info::is\-File(), and QFile\-Info::is\-Sym\-Link().\index{KArchive@{KArchive}!writeDir@{writeDir}}
\index{writeDir@{writeDir}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KArchive::write\-Dir (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em user}, const {\bf QString} \& {\em group})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKArchive_a9}


If an archive is opened for writing then you can add new directories using this function. 

KArchive won't write one directory twice.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the directory \item[{\em user}]the user that owns the directory \item[{\em group}]the group that owns the directory // TODO(BIC): make this a thin wrapper around // write\-Dir(name,user,group,perm,atime,mtime,ctime) // or elimitate it \end{description}
\end{Desc}


Implemented in {\bf KAr} {\rm (p.\,\pageref{classKAr_a6})}, {\bf KTar} {\rm (p.\,\pageref{classKTar_a6})}, and {\bf KZip} {\rm (p.\,\pageref{classKZip_b2})}.

Referenced by KTar::write\-Dir().\index{KArchive@{KArchive}!writeDir@{writeDir}}
\index{writeDir@{writeDir}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::write\-Dir (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em user}, const {\bf QString} \& {\em group}, mode\_\-t {\em perm}, time\_\-t {\em atime}, time\_\-t {\em mtime}, time\_\-t {\em ctime})}\label{classKArchive_a10}


If an archive is opened for writing then you can add new directories using this function. 

KArchive won't write one directory twice.

This method also allows some file metadata to be set. However, depending on the archive type not all metadata might be regarded. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the directory \item[{\em user}]the user that owns the directory \item[{\em group}]the group that owns the directory \item[{\em perm}]permissions of the directory \item[{\em atime}]time the file was last accessed \item[{\em mtime}]modification time of the file \item[{\em ctime}]creation time of the file \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.2 // TODO(BIC): make this virtual. For now use virtual hook \end{Desc}


Reimplemented in {\bf KTar} {\rm (p.\,\pageref{classKTar_a7})}.

Definition at line 297 of file karchive.cpp.\index{KArchive@{KArchive}!writeSymLink@{writeSymLink}}
\index{writeSymLink@{writeSymLink}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::write\-Sym\-Link (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em target}, const {\bf QString} \& {\em user}, const {\bf QString} \& {\em group}, mode\_\-t {\em perm}, time\_\-t {\em atime}, time\_\-t {\em mtime}, time\_\-t {\em ctime})}\label{classKArchive_a11}


Writes a symbolic link to the archive if the archive must be opened for writing. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]name of symbolic link \item[{\em target}]target of symbolic link \item[{\em user}]the user that owns the directory \item[{\em group}]the group that owns the directory \item[{\em perm}]permissions of the directory \item[{\em atime}]time the file was last accessed \item[{\em mtime}]modification time of the file \item[{\em ctime}]creation time of the file \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.2 // TODO(BIC) make virtual. For now it must be implemented by virtual\_\-hook. \end{Desc}


Reimplemented in {\bf KTar} {\rm (p.\,\pageref{classKTar_a5})}, and {\bf KZip} {\rm (p.\,\pageref{classKZip_a10})}.

Definition at line 320 of file karchive.cpp.

Referenced by add\-Local\-File(), KZip::write\-Sym\-Link(), and KTar::write\-Sym\-Link().\index{KArchive@{KArchive}!writeFile@{writeFile}}
\index{writeFile@{writeFile}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::write\-File (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em user}, const {\bf QString} \& {\em group}, uint {\em size}, const char $\ast$ {\em data})\hspace{0.3cm}{\tt  [virtual]}}\label{classKArchive_a12}


If an archive is opened for writing then you can add a new file using this function. 

If the file name is for example \char`\"{}mydir/test1\char`\"{} then the directory \char`\"{}mydir\char`\"{} is automatically appended first if that did not happen yet. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the file \item[{\em user}]the user that owns the file \item[{\em group}]the group that owns the file \item[{\em size}]the size of the file \item[{\em data}]the data to write ({\tt size} bytes) // TODO(BIC): make this a thin non-virtual wrapper around // write\-File(name,user,group,size,perm,atime,mtime,ctime,data) \end{description}
\end{Desc}


Reimplemented in {\bf KZip} {\rm (p.\,\pageref{classKZip_a8})}.

Definition at line 221 of file karchive.cpp.

Referenced by KZip::write\-File().\index{KArchive@{KArchive}!writeFile@{writeFile}}
\index{writeFile@{writeFile}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::write\-File (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em user}, const {\bf QString} \& {\em group}, uint {\em size}, mode\_\-t {\em perm}, time\_\-t {\em atime}, time\_\-t {\em mtime}, time\_\-t {\em ctime}, const char $\ast$ {\em data})}\label{classKArchive_a13}


If an archive is opened for writing then you can add a new file using this function. 

If the file name is for example \char`\"{}mydir/test1\char`\"{} then the directory \char`\"{}mydir\char`\"{} is automatically appended first if that did not happen yet.

This method also allows some file metadata to be set. However, depending on the archive type not all metadata might be regarded. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the file \item[{\em user}]the user that owns the file \item[{\em group}]the group that owns the file \item[{\em size}]the size of the file \item[{\em perm}]permissions of the file \item[{\em atime}]time the file was last accessed \item[{\em mtime}]modification time of the file \item[{\em ctime}]creation time of the file \item[{\em data}]the data to write ({\tt size} bytes) \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.2 // TODO(BIC): make virtual. For now use virtual hook \end{Desc}


Reimplemented in {\bf KZip} {\rm (p.\,\pageref{classKZip_a12})}.

Definition at line 252 of file karchive.cpp.\index{KArchive@{KArchive}!prepareWriting@{prepareWriting}}
\index{prepareWriting@{prepareWriting}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KArchive::prepare\-Writing (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em user}, const {\bf QString} \& {\em group}, uint {\em size})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKArchive_a14}


Here's another way of writing a file into an archive: Call prepare\-Writing, then call {\bf write\-Data()}{\rm (p.\,\pageref{classKArchive_a16})} as many times as wanted then call done\-Writing( total\-Size ). 

For tar.gz files, you need to know the size before hand, since it is needed in the header. For zip files, size isn't used.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the file \item[{\em user}]the user that owns the file \item[{\em group}]the group that owns the file \item[{\em size}]the size of the file // TODO(BIC): make this a thin non-virtual wrapper around // prepare\-Writing(name,user,group,size,perm,atime,mtime,ctime) or eliminate it. \end{description}
\end{Desc}


Implemented in {\bf KAr} {\rm (p.\,\pageref{classKAr_a4})}, {\bf KTar} {\rm (p.\,\pageref{classKTar_a8})}, and {\bf KZip} {\rm (p.\,\pageref{classKZip_a9})}.

Referenced by add\-Local\-File(), KZip::prepare\-Writing(), and KTar::prepare\-Writing().\index{KArchive@{KArchive}!prepareWriting@{prepareWriting}}
\index{prepareWriting@{prepareWriting}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::prepare\-Writing (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em user}, const {\bf QString} \& {\em group}, uint {\em size}, mode\_\-t {\em perm}, time\_\-t {\em atime}, time\_\-t {\em mtime}, time\_\-t {\em ctime})}\label{classKArchive_a15}


Here's another way of writing a file into an archive: Call prepare\-Writing, then call {\bf write\-Data()}{\rm (p.\,\pageref{classKArchive_a16})} as many times as wanted then call done\-Writing( total\-Size ). 

For tar.gz files, you need to know the size before hand, it is needed in the header! For zip files, size isn't used.

This method also allows some file metadata to be set. However, depending on the archive type not all metadata might be regarded. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the file \item[{\em user}]the user that owns the file \item[{\em group}]the group that owns the file \item[{\em size}]the size of the file \item[{\em perm}]permissions of the file \item[{\em atime}]time the file was last accessed \item[{\em mtime}]modification time of the file \item[{\em ctime}]creation time of the file \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.2 // TODO(BIC): make this virtual. For now use virtual hook. \end{Desc}


Reimplemented in {\bf KTar} {\rm (p.\,\pageref{classKTar_a9})}, and {\bf KZip} {\rm (p.\,\pageref{classKZip_a11})}.

Definition at line 228 of file karchive.cpp.\index{KArchive@{KArchive}!writeData@{writeData}}
\index{writeData@{writeData}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KArchive::write\-Data (const char $\ast$ {\em data}, uint {\em size})}\label{classKArchive_a16}


Write data into the current file - to be called after calling prepare\-Writing // TODO(BIC) make virtual. 

For now virtual\_\-hook allows reimplementing it. 

Reimplemented in {\bf KZip} {\rm (p.\,\pageref{classKZip_a13})}.

Definition at line 346 of file karchive.cpp.

Referenced by add\-Local\-File(), and KZip::write\-Data().\index{KArchive@{KArchive}!doneWriting@{doneWriting}}
\index{doneWriting@{doneWriting}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KArchive::done\-Writing (uint {\em size})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKArchive_a17}


Call done\-Writing after writing the data. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em size}]the size of the file \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf prepare\-Writing()}{\rm (p.\,\pageref{classKArchive_a14})} \end{Desc}


Implemented in {\bf KAr} {\rm (p.\,\pageref{classKAr_a5})}, {\bf KTar} {\rm (p.\,\pageref{classKTar_a10})}, and {\bf KZip} {\rm (p.\,\pageref{classKZip_a14})}.

Referenced by add\-Local\-File().\index{KArchive@{KArchive}!openArchive@{openArchive}}
\index{openArchive@{openArchive}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KArchive::open\-Archive (int {\em mode})\hspace{0.3cm}{\tt  [protected, pure virtual]}}\label{classKArchive_b1}


Opens an archive for reading or writing. 

Called by open. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mode}]may be IO\_\-Read\-Only or IO\_\-Write\-Only \end{description}
\end{Desc}


Implemented in {\bf KAr} {\rm (p.\,\pageref{classKAr_b0})}, {\bf KTar} {\rm (p.\,\pageref{classKTar_b0})}, and {\bf KZip} {\rm (p.\,\pageref{classKZip_b0})}.

Referenced by open().\index{KArchive@{KArchive}!closeArchive@{closeArchive}}
\index{closeArchive@{closeArchive}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KArchive::close\-Archive ()\hspace{0.3cm}{\tt  [protected, pure virtual]}}\label{classKArchive_b2}


Closes the archive. 

Called by close. 

Implemented in {\bf KAr} {\rm (p.\,\pageref{classKAr_b1})}, {\bf KTar} {\rm (p.\,\pageref{classKTar_b1})}, and {\bf KZip} {\rm (p.\,\pageref{classKZip_b1})}.

Referenced by close().\index{KArchive@{KArchive}!rootDir@{rootDir}}
\index{rootDir@{rootDir}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KArchive\-Directory} $\ast$ KArchive::root\-Dir ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKArchive_b3}


Retrieves or create the root directory. 

The default implementation assumes that {\bf open\-Archive()}{\rm (p.\,\pageref{classKArchive_b1})} did the parsing, so it creates a dummy rootdir if none was set (write mode, or no '/' in the archive). Reimplement this to provide parsing/listing on demand. \begin{Desc}
\item[Returns:]the root directory \end{Desc}


Definition at line 361 of file karchive.cpp.

References QFile::decode\-Name(), and QString::number().

Referenced by find\-Or\-Create(), KZip::open\-Archive(), KTar::open\-Archive(), and KAr::open\-Archive().\index{KArchive@{KArchive}!findOrCreate@{findOrCreate}}
\index{findOrCreate@{findOrCreate}!KArchive@{KArchive}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KArchive\-Directory} $\ast$ KArchive::find\-Or\-Create (const {\bf QString} \& {\em path})\hspace{0.3cm}{\tt  [protected]}}\label{classKArchive_b4}


Ensures that {\tt path} exists, create otherwise. 

This handles e.g. tar files missing directory entries, like mico-2.3.0.tar.gz :) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em path}]the path of the directory \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the directory with the given {\tt path} \end{Desc}


Definition at line 376 of file karchive.cpp.

References KArchive\-Directory::add\-Entry(), KArchive\-Directory::entry(), KArchive\-Entry::is\-Directory(), QString::left(), QString::mid(), and root\-Dir().

Referenced by KZip::open\-Archive(), and KTar::open\-Archive().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
karchive.h\item 
karchive.cpp\end{CompactItemize}
