\section{KAr Class Reference}
\label{classKAr}\index{KAr@{KAr}}
A class for reading ar archives.  


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

Inheritance diagram for KAr:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=47pt]{classKAr__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KAr:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=105pt]{classKAr__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KAr} (const  {\bf QString} \&filename)
\begin{CompactList}\small\item\em Creates an instance that operates on the given filename. \item\end{CompactList}\item 
{\bf KAr} ({\bf QIODevice} $\ast$dev)
\begin{CompactList}\small\item\em Creates an instance that operates on the given device. \item\end{CompactList}\item 
virtual {\bf $\sim$KAr} ()
\begin{CompactList}\small\item\em If the ar file is still opened, then it will be closed automatically by the destructor. \item\end{CompactList}\item 
{\bf QString} {\bf file\-Name} ()
\begin{CompactList}\small\item\em The name of the ar file, as passed to the constructor Null if you used the {\bf QIODevice} constructor. \item\end{CompactList}\item 
virtual bool {\bf prepare\-Writing} (const  {\bf QString} \&, const  {\bf QString} \&, const  {\bf QString} \&, uint)
\begin{CompactList}\small\item\em Here's another way of writing a file into an archive: Call {\bf prepare\-Writing}{\rm (p.\,\pageref{classKAr_a4})}, then call {\bf device()}{\rm (p.\,\pageref{classKArchive_a5})}-$>$write\-Block() (for tar files) or write\-Data (for zip files) [NEW VIRTUAL METHOD NEEDED] as many times as wanted then call {\bf done\-Writing}{\rm (p.\,\pageref{classKAr_a5})}( 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. \item\end{CompactList}\item 
virtual bool {\bf done\-Writing} (uint)
\begin{CompactList}\small\item\em Call {\bf done\-Writing}{\rm (p.\,\pageref{classKAr_a5})} after writing the data. \item\end{CompactList}\item 
virtual bool {\bf write\-Dir} (const  {\bf QString} \&, const  {\bf QString} \&, const  {\bf QString} \&)
\begin{CompactList}\small\item\em If an archive is opened for writing then you can add new directories using this function. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf open\-Archive} (int mode)
\begin{CompactList}\small\item\em Opens the archive for reading. \item\end{CompactList}\item 
virtual bool {\bf close\-Archive} ()
\begin{CompactList}\small\item\em Closes the archive. \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKAr_b2}

\end{CompactItemize}


\subsection{Detailed Description}
A class for reading ar archives. 

\begin{Desc}
\item[Author:]Laurence Anderson $<${\tt l.d.anderson@warwick.ac.uk}$>$ \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}




Definition at line 36 of file kar.h.

\subsection{Constructor \& Destructor Documentation}
\index{KAr@{KAr}!KAr@{KAr}}
\index{KAr@{KAr}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAr::KAr (const {\bf QString} \& {\em filename})}\label{classKAr_a0}


Creates an instance that operates on the given filename. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]is a local path (e.g. \char`\"{}/home/holger/myfile.ar\char`\"{}) \end{description}
\end{Desc}


Definition at line 42 of file kar.cpp.\index{KAr@{KAr}!KAr@{KAr}}
\index{KAr@{KAr}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAr::KAr ({\bf QIODevice} $\ast$ {\em dev})}\label{classKAr_a1}


Creates an instance that operates on the given device. 

The device can be compressed ({\bf KFilter\-Dev}{\rm (p.\,\pageref{classKFilterDev})}) or not ({\bf QFile}, etc.). 

Definition at line 51 of file kar.cpp.\index{KAr@{KAr}!~KAr@{$\sim$KAr}}
\index{~KAr@{$\sim$KAr}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAr::$\sim${\bf KAr} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKAr_a2}


If the ar file is still opened, then it will be closed automatically by the destructor. 



Definition at line 58 of file kar.cpp.

References KArchive::close(), KArchive::device(), QString::is\-Empty(), and KArchive::is\-Opened().

\subsection{Member Function Documentation}
\index{KAr@{KAr}!fileName@{fileName}}
\index{fileName@{fileName}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KAr::file\-Name ()\hspace{0.3cm}{\tt  [inline]}}\label{classKAr_a3}


The name of the ar file, as passed to the constructor Null if you used the {\bf QIODevice} constructor. 



Definition at line 62 of file kar.h.\index{KAr@{KAr}!prepareWriting@{prepareWriting}}
\index{prepareWriting@{prepareWriting}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KAr::prepare\-Writing (const {\bf QString} \&, const {\bf QString} \&, const {\bf QString} \&, uint)\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKAr_a4}


Here's another way of writing a file into an archive: Call {\bf prepare\-Writing}{\rm (p.\,\pageref{classKAr_a4})}, then call {\bf device()}{\rm (p.\,\pageref{classKArchive_a5})}-$>$write\-Block() (for tar files) or write\-Data (for zip files) [NEW VIRTUAL METHOD NEEDED] as many times as wanted then call {\bf done\-Writing}{\rm (p.\,\pageref{classKAr_a5})}( 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. 



Implements {\bf KArchive} {\rm (p.\,\pageref{classKArchive_a9})}.

Definition at line 67 of file kar.h.\index{KAr@{KAr}!doneWriting@{doneWriting}}
\index{doneWriting@{doneWriting}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KAr::done\-Writing (uint)\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKAr_a5}


Call {\bf done\-Writing}{\rm (p.\,\pageref{classKAr_a5})} after writing the data. 

\begin{Desc}
\item[See also:]{\bf prepare\-Writing}{\rm (p.\,\pageref{classKAr_a4})} \end{Desc}


Implements {\bf KArchive} {\rm (p.\,\pageref{classKArchive_a10})}.

Definition at line 68 of file kar.h.\index{KAr@{KAr}!writeDir@{writeDir}}
\index{writeDir@{writeDir}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KAr::write\-Dir (const {\bf QString} \&, const {\bf QString} \&, const {\bf QString} \&)\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKAr_a6}


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

{\bf KArchive}{\rm (p.\,\pageref{classKArchive})} won't write one directory twice. 

Implements {\bf KArchive} {\rm (p.\,\pageref{classKArchive_a7})}.

Definition at line 69 of file kar.h.\index{KAr@{KAr}!openArchive@{openArchive}}
\index{openArchive@{openArchive}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAr::open\-Archive (int {\em mode})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKAr_b0}


Opens the archive for reading. 

Parses the directory listing of the archive and creates the KArchive\-Directory/KArchive\-File entries. 

Implements {\bf KArchive} {\rm (p.\,\pageref{classKArchive_b1})}.

Definition at line 69 of file kar.cpp.

References KArchive\-Directory::add\-Entry(), QIODevice::at(), QIODevice::at\-End(), KArchive::device(), QString::find(), QString::left(), QString::mid(), QCString::mid(), KStd\-Accel::name(), QIODevice::read\-Block(), QString::replace(), QCString::resize(), QCString::right(), KArchive::root\-Dir(), and QString::strip\-White\-Space().\index{KAr@{KAr}!closeArchive@{closeArchive}}
\index{closeArchive@{closeArchive}!KAr@{KAr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAr::close\-Archive ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKAr_b1}


Closes the archive. 

Called by {\bf close}{\rm (p.\,\pageref{classKArchive_a2})}. 

Implements {\bf KArchive} {\rm (p.\,\pageref{classKArchive_b2})}.

Definition at line 161 of file kar.cpp.

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