• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

strigi/src/streams

Strigi::ArchiveReader

Strigi::ArchiveReader Class Reference

Provides an API for accessing members of an archive. More...

#include <archivereader.h>

Inheritance diagram for Strigi::ArchiveReader:
Inheritance graph
[legend]

List of all members.

Classes

class  DirLister
 Lists the contents of a directory. More...

Public Member Functions

 ArchiveReader ()
 ~ArchiveReader ()
void addStreamOpener (StreamOpener *opener)
bool canHandle (const std::string &url)
void closeStream (InputStream *stream)
DirLister dirEntries (const std::string &url)
bool isArchive (const std::string &url)
InputStream * openStream (const std::string &url)
int stat (const std::string &url, EntryInfo &e)

Detailed Description

Provides an API for accessing members of an archive.

ArchiveReader doesn't know how to open streams itself. It must be supplied with StreamOpeners. For example, a FileStreamOpener can be passed to an ArchiveReader to tell it how to access files on the filesystem.

Definition at line 71 of file archivereader.h.


Constructor & Destructor Documentation

ArchiveReader::ArchiveReader (  ) 

Constructor.

Definition at line 361 of file archivereader.cpp.

ArchiveReader::~ArchiveReader (  ) 

Destructor.

Definition at line 363 of file archivereader.cpp.


Member Function Documentation

void ArchiveReader::addStreamOpener ( StreamOpener *  opener  ) 

Adds a StreamOpener for use by the class.

ArchiveReader uses StreamOpeners to resolve URLs and get information about and open the resources they point to. For example, a FileStreamOpener may be used to open files on the local system, and another StreamOpener may be capable of accessing files over HTTP.

This method provides ArchiveReader with a StreamOpener for opening URLs. An ArchiveReader object is only capable of handling an URL if there is a StreamOpener capable of either handling the URL or handling part of the URL that points to an archive.

Parameters:
opener the StreamOpener to add

Definition at line 402 of file archivereader.cpp.

bool ArchiveReader::canHandle ( const std::string &  url  ) 

Check if the archivereader can handle a file.

Checks to see if the object at the location described by url exists and is an archive, or if any parent of it is an archive.

A parent is determined by examining the URL and splitting it into a path delimited by /.

Parameters:
url the URL of the object to check for
Returns:
true if the object described by url or any parent of it is an archive, false if url and all its parents are not archives

Definition at line 487 of file archivereader.cpp.

void ArchiveReader::closeStream ( InputStream *  stream  ) 

Cleans up after a stream is finished with.

Frees the memory used to handle an open stream.

Note that this memory will be cleaned up on the destruction of the ArchiveReader anyway. This just allows you to free up the memory as soon as you are done with a particular stream.

Parameters:
stream the stream to clean up after

Definition at line 406 of file archivereader.cpp.

ArchiveReader::DirLister ArchiveReader::dirEntries ( const std::string &  url  ) 

Lists the contents of the specified directory.

If the url is one that the ArchiveReader can handle (see canHandle()), and refers to a directory (or an archive), it will fetch a list of the contents of the directory.

Parameters:
url the directory to list the contents of
Returns:
a DirLister containing information about the contents of the directory, or an empty DirLister if the file did not exist, was not a directory or could not be handled

Definition at line 435 of file archivereader.cpp.

bool ArchiveReader::isArchive ( const std::string &  url  ) 

Check if a file is an archive.

Checks the StreamOpeners, in the order they were passed to addStreamOpener(), to find the file specified by url. It considers an archive to be a file that is also a directory (from the point of view of the StreamOpener).

It will only check the first StreamOpener that recognises the given URL.

Parameters:
url URL of the file to check, as recognised by a StreamOpener registered with addStreamOpener()
Returns:
true if the URL specifies an archive, false if the URL was not recognised by any StreamOpener, or the URL does not specify an archive

Definition at line 417 of file archivereader.cpp.

InputStream* Strigi::ArchiveReader::openStream ( const std::string &  url  )  [virtual]

Opens a stream for a member of an archive.

This function is only able to open a stream for an URL if either a registered StreamOpener is capable of doing so (see addStreamOpener()) or the URL can be handled directly (see canHandle()).

Parameters:
url path to a member of an archive, relative to the archive root
Returns:
a stream representing the archive member given by url

Implements Strigi::StreamOpener.

int ArchiveReader::stat ( const std::string &  url,
EntryInfo &  e 
) [virtual]

Gets information about a given url.

This function is only able to get information about an URL if either a registered StreamOpener is capable of doing so (see addStreamOpener()) or the URL can be handled directly (see canHandle()).

Parameters:
url path to a member of the archive, relative to the archive root
e an EntryInfo object to populate with information about the archive member given by url
Returns:
0 if information about the item was found, -1 on error

Implements Strigi::StreamOpener.

Definition at line 367 of file archivereader.cpp.


The documentation for this class was generated from the following files:
  • archivereader.h
  • archivereader.cpp

strigi/src/streams

Skip menu "strigi/src/streams"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • grantlee
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal