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

Doomwad::Switch Class Reference

Inheritance diagram for Doomwad::Switch:

Doomwad::WadEntryElement List of all members.

Detailed Description

Single switch in a Switches lump.

See also:
Switches

Definition at line 70 of file switches.hpp.

Public Member Functions

virtual size_t getLength (void) const throw ()
 Get the length of an element.
virtual bool read (const Lump &lump, Lump::size_type i) throw ()
 Read this element from a Lump.
 Switch (const std::string &, const std::string &, int16=DEFAULT)
 Constructor.
 Switch (void) throw ()
 Default constructor.
virtual std::string toString (void) const throw ()
 Convert this element to a string.
virtual bool write (Lump &lump, Lump::size_type i) const throw ()
 Write this element into a Lump.
virtual ~Switch (void) throw ()
 Destructor.

Public Attributes

std::string off
 Texture displayed when the switch is off.
std::string on
 Texture displayed when the switch is on.
int16 type
 Type, or which versions of Doom this works in.

Static Public Attributes

static const int16 DEFAULT = Switch::DOOM2
 Default type.
static const int16 DOOM = 0x0002
 Works with shareware and Ultimate Doom.
static const int16 DOOM2 = 0x0003
 Works with shareware, Ultimate, and Doom 2.
static const size_t LENGTH = 0x00000014
 Length of a Switch record.
static const int16 SHAREWARE = 0x0001
 Works with shareware Doom.
static const int16 TERMINATE = 0x0000
 Marks the end of a Switches resource.


Constructor & Destructor Documentation

Switch::Switch const std::string &  _off,
const std::string &  _on,
int16  _type = DEFAULT
 

Constructor.

The user must specify texture/flat names, the type and speed are optional.

Parameters:
_off Off texture.
_on On texture.
_type Type of animation.

Definition at line 77 of file switches.cpp.


Member Function Documentation

size_t Switch::getLength void   )  const throw () [virtual]
 

Get the length of an element.

Each element record type has a length. Some are fixed, in which case this function returns that length. Some records are variable-length, in which case this function returns zero.

Returns:
Length of the record.

Implements Doomwad::WadEntryElement.

Definition at line 82 of file switches.cpp.

References LENGTH.

bool Switch::read const Lump lump,
Lump::size_type  i
throw () [virtual]
 

Read this element from a Lump.

Read one element from a Lump at the specified index.

Parameters:
lump Reference to the target Lump.
i Index into the Lump's buffer.
Returns:
True if successful, false if not.

Implements Doomwad::WadEntryElement.

Definition at line 102 of file switches.cpp.

Referenced by Doomwad::Switches::setFromLump().

std::string Switch::toString void   )  const throw () [virtual]
 

Convert this element to a string.

The format of the string will vary from class to class, but every subclass must be able to format itself as a string. IMPORTANT: this string representation is not guaranteed to preserve all data. Reading back in is not supported. This function's goal is to make the object's state user-readable, not machine-readable.

Returns:
std::string object containing object state.

Implements Doomwad::WadEntryElement.

Definition at line 117 of file switches.cpp.

References off, on, and type.

bool Switch::write Lump lump,
Lump::size_type  i
const throw () [virtual]
 

Write this element into a Lump.

Write one element into a Lump at the specified index.

Parameters:
lump Reference to the target Lump.
i Index into the Lump's buffer.
Returns:
True if successful, false if not.

Implements Doomwad::WadEntryElement.

Definition at line 87 of file switches.cpp.


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