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


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

Inheritance diagram for KAr:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=46pt]{classKAr__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KAr:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=95pt]{classKAr__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KAr} (const {\bf QString} \&filename)
\item 
{\bf KAr} ({\bf QIODevice} $\ast$dev)
\item 
virtual {\bf $\sim$KAr} ()
\item 
{\bf QString} {\bf file\-Name} ()
\item 
virtual bool {\bf prepare\-Writing} (const {\bf QString} \&, const {\bf QString} \&, const {\bf QString} \&, uint)
\item 
virtual bool {\bf done\-Writing} (uint)
\item 
virtual bool {\bf write\-Dir} (const {\bf QString} \&, const {\bf QString} \&, const {\bf QString} \&)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf open\-Archive} (int mode)
\item 
virtual bool {\bf close\-Archive} ()
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKAr_b2}

\end{CompactItemize}


\subsection{Detailed Description}
KAr is a class for reading archives in ar format. A class for reading ar archives. 

Writing is not supported. 

\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 38 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.). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dev}]the device to read from \end{description}
\end{Desc}


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. 

\begin{Desc}
\item[Returns:]the filename. Null if you used the {\bf QIODevice} constructor \end{Desc}


Definition at line 65 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 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}


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

Definition at line 71 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 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{classKAr_a4})} \end{Desc}


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

Definition at line 77 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.

\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}


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

Definition at line 83 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(), endl(), QString::find(), kd\-Debug(), kd\-Warning(), QString::left(), QString::mid(), QCString::mid(), QIODevice::read\-Block(), QString::replace(), QCString::resize(), QCString::right(), KArchive::root\-Dir(), QString::strip\-White\-Space(), QString::to\-Int(), and QCString::to\-Int().\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 close. 

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

Definition at line 163 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}
