ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

SearchSet enables access to a group of Archives through the Archive interface. More...

#include <archive.h>

Inheritance diagram for Common::SearchSet:
Collaboration diagram for Common::SearchSet:

List of all members.

Classes

struct  Node

Public Member Functions

virtual ~SearchSet ()
void add (const String &name, Archive *arch, int priority=0, bool autoFree=true)
 Add a new archive to the searchable set.
void addDirectory (const String &name, const String &directory, int priority=0, int depth=1, bool flat=false)
 Create and add a FSDirectory by name.
void addDirectory (const String &name, const FSNode &directory, int priority=0, int depth=1, bool flat=false)
 Create and add a FSDirectory by FSNode.
void addSubDirectoryMatching (const FSNode &directory, const String &caselessName, int priority=0, int depth=1, bool flat=false)
 Create and add a sub directory by name (caseless).
void addSubDirectoriesMatching (const FSNode &directory, String origPattern, bool ignoreCase, int priority=0, int depth=1, bool flat=false)
 Create and add sub directories by pattern.
void remove (const String &name)
 Remove an archive from the searchable set.
bool hasArchive (const String &name) const
 Check if a given archive name is already present.
virtual void clear ()
 Empties the searchable set.
void setPriority (const String &name, int priority)
 Change the order of searches.
virtual bool hasFile (const String &name) const
 Check if a member with the given name is present in the Archive.
virtual int listMatchingMembers (ArchiveMemberList &list, const String &pattern) const
 Add all members of the Archive matching the specified pattern to list.
virtual int listMembers (ArchiveMemberList &list) const
 Add all members of the Archive to list.
virtual const ArchiveMemberPtr getMember (const String &name) const
 Returns a ArchiveMember representation of the given file.
virtual SeekableReadStreamcreateReadStreamForMember (const String &name) const
 Implements createReadStreamForMember from Archive base class.

Private Types

typedef List< NodeArchiveNodeList

Private Member Functions

ArchiveNodeList::iterator find (const String &name)
ArchiveNodeList::const_iterator find (const String &name) const
void insert (const Node &node)

Private Attributes

ArchiveNodeList _list

Detailed Description

SearchSet enables access to a group of Archives through the Archive interface.

Its intended usage is a situation in which there are no name clashes among names in the contained Archives, hence the simplistic policy of always looking for the first match. SearchSet *DOES* guarantee that searches are performed in *DESCENDING* priority order. In case of conflicting priorities, insertion order prevails.

Definition at line 136 of file common/archive.h.


Member Typedef Documentation

Definition at line 146 of file common/archive.h.


Constructor & Destructor Documentation

virtual Common::SearchSet::~SearchSet (  )  [inline, virtual]

Definition at line 156 of file common/archive.h.


Member Function Documentation

void Common::SearchSet::add ( const String name,
Archive arch,
int  priority = 0,
bool  autoFree = true 
)

Add a new archive to the searchable set.

Definition at line 97 of file common/archive.cpp.

void Common::SearchSet::addDirectory ( const String name,
const String directory,
int  priority = 0,
int  depth = 1,
bool  flat = false 
)

Create and add a FSDirectory by name.

Definition at line 109 of file common/archive.cpp.

void Common::SearchSet::addDirectory ( const String name,
const FSNode directory,
int  priority = 0,
int  depth = 1,
bool  flat = false 
)

Create and add a FSDirectory by FSNode.

Definition at line 114 of file common/archive.cpp.

void Common::SearchSet::addSubDirectoriesMatching ( const FSNode directory,
String  origPattern,
bool  ignoreCase,
int  priority = 0,
int  depth = 1,
bool  flat = false 
)

Create and add sub directories by pattern.

It is also possible to add sub directories of sub directories (of any depth) with this function. The path seperator for this case is SLASH for *all* systems.

An example would be:

"game/itedata"

In this example the code would first try to search for all directories matching "game" in the path "directory" first and search through all of the matches for "itedata". If "ingoreCase" is set to true, the code would do a case insensitive match, otherwise it is doing a case sensitive match.

This method works of course also with tokens. For a list of available tokens see the documentation for Common::matchString.

See also:
Common::matchString

Definition at line 121 of file common/archive.cpp.

void Common::SearchSet::addSubDirectoryMatching ( const FSNode directory,
const String caselessName,
int  priority = 0,
int  depth = 1,
bool  flat = false 
) [inline]

Create and add a sub directory by name (caseless).

It is also possible to add sub directories of sub directories (of any depth) with this function. The path seperator for this case is SLASH for *all* systems.

An example would be:

"game/itedata"

In this example the code would first try to search for all directories matching "game" (case insensitive) in the path "directory" first and search through all of the matches for "itedata" (case insensitive too).

Note that it will add *all* matches found!

Even though this method is currently implemented via addSubDirectoriesMatching it is not safe to assume that this method is using anything other than a simple case insensitive compare. Thus do not use any tokens like '*' or '?' in the "caselessName" parameter of this function!

Definition at line 193 of file common/archive.h.

void Common::SearchSet::clear (  )  [virtual]

Empties the searchable set.

Reimplemented in Common::SearchManager.

Definition at line 183 of file common/archive.cpp.

SeekableReadStream * Common::SearchSet::createReadStreamForMember ( const String name  )  const [virtual]

Implements createReadStreamForMember from Archive base class.

The current policy is opening the first file encountered that matches the name.

Implements Common::Archive.

Definition at line 254 of file common/archive.cpp.

SearchSet::ArchiveNodeList::const_iterator Common::SearchSet::find ( const String name  )  const [private]

Definition at line 74 of file common/archive.cpp.

SearchSet::ArchiveNodeList::iterator Common::SearchSet::find ( const String name  )  [private]

Definition at line 65 of file common/archive.cpp.

const ArchiveMemberPtr Common::SearchSet::getMember ( const String name  )  const [virtual]

Returns a ArchiveMember representation of the given file.

Implements Common::Archive.

Definition at line 241 of file common/archive.cpp.

bool Common::SearchSet::hasArchive ( const String name  )  const

Check if a given archive name is already present.

Definition at line 179 of file common/archive.cpp.

bool Common::SearchSet::hasFile ( const String name  )  const [virtual]

Check if a member with the given name is present in the Archive.

Patterns are not allowed, as this is meant to be a quick File::exists() replacement.

Implements Common::Archive.

Definition at line 208 of file common/archive.cpp.

void Common::SearchSet::insert ( const Node node  )  [private]

Definition at line 88 of file common/archive.cpp.

int Common::SearchSet::listMatchingMembers ( ArchiveMemberList list,
const String pattern 
) const [virtual]

Add all members of the Archive matching the specified pattern to list.

Must only append to list, and not remove elements from it.

Returns:
the number of members added to list

Reimplemented from Common::Archive.

Definition at line 221 of file common/archive.cpp.

int Common::SearchSet::listMembers ( ArchiveMemberList list  )  const [virtual]

Add all members of the Archive to list.

Must only append to list, and not remove elements from it.

Returns:
the number of names added to list

Implements Common::Archive.

Definition at line 231 of file common/archive.cpp.

void Common::SearchSet::remove ( const String name  ) 

Remove an archive from the searchable set.

Definition at line 170 of file common/archive.cpp.

void Common::SearchSet::setPriority ( const String name,
int  priority 
)

Change the order of searches.

Definition at line 192 of file common/archive.cpp.


Member Data Documentation

Definition at line 147 of file common/archive.h.


The documentation for this class was generated from the following files:


Generated on Sat Jan 12 2019 05:03:59 for ResidualVM by doxygen 1.7.1
curved edge   curved edge