Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Doomwad::Wad Class Reference

List of all members.

Detailed Description

Collection of Lump objects that abastracts a single .wad file.

See also:
Lump WadGroup
A Wad is a collection of Lump objects. It also has a type, either IWAD or PWAD, that is used to determine if this is a primary wad or a patch wad. The type is not all that important for most people, just use PWAD.

For the most part use a Wad like you would a std::list, as that is its base class anyway. It adds functions to manage its type and adds operator overloading. It can also read and write to files, including reading from a file in its constructor.

Definition at line 84 of file wad.hpp.

Public Types

enum  wad_type { IWAD, PWAD }
 Two types of Wads allowed by Doom.

Public Member Functions

wad_type getType (void) const throw ()
 Get the type.
std::string getWadDirectory (char= '\n') const throw ()
 Get a directory of the wad.
bool isIwad (void) const throw ()
 See if this is an IWAD.
bool isPwad (void) const throw ()
 See if this is a PWAD.
bool operator!= (const Wad &) const throw ()
 Inequality comparison operator.
Wad operator+ (const Wad &) const throw ()
 Concatenation operator, make new wad.
Wadoperator+= (const Wad &) throw ()
 Concatenation operator.
bool operator== (const Wad &) const throw ()
 Equality comparison operator.
bool readFromFile (const std::string &) throw ()
 Read wad from a file.
bool setType (wad_type) throw ()
 Set the type.
 Wad (const Lump &, wad_type=PWAD) throw ()
 Construct from a single lump and a type.
 Wad (const std::string &) throw ()
 Construct from a wad file.
 Wad (wad_type) throw ()
 Construct with a type.
 Wad (void) throw ()
 Default constructor.
bool writeToFile (const std::string &) const throw ()
 Write wad to a file.

Protected Attributes

wad_type m_type
 Type of this Wad.


Constructor & Destructor Documentation

Wad::Wad wad_type  type  )  throw ()
 

Construct with a type.

Parameters:
type Wad type.

Definition at line 59 of file wad.cpp.

Wad::Wad const std::string &  filename  )  throw ()
 

Construct from a wad file.

Parameters:
filename Name of the file to read.

Definition at line 69 of file wad.cpp.

References readFromFile().

Wad::Wad const Lump lump,
wad_type  type = PWAD
throw ()
 

Construct from a single lump and a type.

Parameters:
lump Lump contained by the new Wad.
type Wad type.

Definition at line 80 of file wad.cpp.


Member Function Documentation

Wad::wad_type Wad::getType void   )  const throw ()
 

Get the type.

Returns:
Type of this Wad.

Definition at line 193 of file wad.cpp.

References m_type.

std::string Wad::getWadDirectory char  delimiter = '\n'  )  const throw ()
 

Get a directory of the wad.

Returns a std::string object containing the names of the Lumps in this Wad separated by the given delimiter. The default delimiter is a newline.

Parameters:
delimiter Character to insert between Lump names.
Returns:
std::string containing the directory.

Definition at line 221 of file wad.cpp.

Referenced by Doomwad::WadGroup::getMasterDirectory().

bool Wad::isIwad void   )  const throw ()
 

See if this is an IWAD.

Returns:
True if this Wad is an IWAD.

Definition at line 173 of file wad.cpp.

References m_type.

bool Wad::isPwad void   )  const throw ()
 

See if this is a PWAD.

Returns:
True if this Wad is a PWAD.

Definition at line 183 of file wad.cpp.

References m_type.

bool Wad::operator!= const Wad wad  )  const throw ()
 

Inequality comparison operator.

Parameters:
wad Other Wad to test against.
Returns:
True if inequal, false if equal.

Definition at line 132 of file wad.cpp.

Wad Wad::operator+ const Wad wad  )  const throw ()
 

Concatenation operator, make new wad.

Parameters:
wad Other Wad to add.
Returns:
Copy of new wad.

Definition at line 162 of file wad.cpp.

Wad & Wad::operator+= const Wad wad  )  throw ()
 

Concatenation operator.

Parameters:
wad Other Wad to add.
Returns:
Reference to this wad.

Definition at line 144 of file wad.cpp.

bool Wad::operator== const Wad wad  )  const throw ()
 

Equality comparison operator.

Compares two wads for equality. Uses short-circuit logic to speed up the operation whenever possible.

Parameters:
wad Other Wad to test against.
Returns:
True if equal, false if not equal.

Definition at line 96 of file wad.cpp.

bool Wad::readFromFile const std::string &  filename  )  throw ()
 

Read wad from a file.

Reads data from a file and constructs Wad data from it. This operation is not atomic (yet).

Parameters:
filename Name of the file to read.
Returns:
True if successful, false if not.

Definition at line 352 of file wad.cpp.

References Doomwad::Lump::assign(), m_type, and Doomwad::Lump::setName().

Referenced by Wad().

bool Wad::setType wad_type  type  )  throw ()
 

Set the type.

Parameters:
type The new type.
return True.

Definition at line 205 of file wad.cpp.

bool Wad::writeToFile const std::string &  filename  )  const throw ()
 

Write wad to a file.

Writes this Wad object to a file. If the file exists it erases it.

Parameters:
filename Name of the file to which to write.
Returns:
true if successful, false if not.

Definition at line 243 of file wad.cpp.


Generated on Fri Jun 10 19:38:52 2005 for libdoomwad by  doxygen 1.4.0