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

Doomwad::Lump Class Reference

List of all members.

Detailed Description

The Lump class represents a general piece of data in a Doom wad file.

See also:
Wad WadEntry
Lumps are the basic building block of wad files. If a Wad is like an archive, then lumps are individual files in that archive. However, lumps are a little different. For the most part their order is irrelevant, however, sometimes it is. Maps have zero-length lumps as markers, with several lumps that follow in a specific order. Graphics, sounds, et al. belong in certain parts of a wad, but their order within is not important.

Anyway, the goal of this class is to encapsulate one of those lumps in a Wad file. While it does not inherit from the STL Container library, it behaves in a similar manner. It has bidirectional iterators and the functions that come with them. It does not, however, have an allocator, because it handles allocation on its own. It has standard typedefs for its value type. It uses operator overloading in a sensible manner. Most of the functions are fairly self-explanatory.

Essentially, a lump is a sequence of bytes of fixed length. Resizing is possible, but not in the same way a vector or string allows insertions in the middle. Since there are various types of lumps and each has its own internal format, this class merely holds data while other classes read and write to it. For example, if a lump is of type Vertexes, use the Vertexes class to read the data from the lump. Manipulate it with the other class, then create a new Lump from the Vertexes object and save it to disk or put it in a Wad or whatever.

There are several convenience functions for reading and writing to streams and file names: use them. My intention is, for example, that you can read and write raw Lump data to files, or you can use the stream functions if you handle the file yourself, want to use standard I/O, or are using string streams. Whatever. The logic is already here to do all that.

Definition at line 133 of file lump.hpp.

Public Types

typedef __gnu_cxx::__normal_iterator<
const_pointer, Lump
const_iterator
 Const iterator.
typedef const value_typeconst_pointer
 Const pointer to data type.
typedef const value_typeconst_reference
 Const reference to data type.
typedef std::reverse_iterator<
const_iterator
const_reverse_iterator
 Const reverse iterator.
typedef __gnu_cxx::__normal_iterator<
pointer, Lump
iterator
 Bidirectional iterator.
typedef value_typepointer
 Pointer to data type.
typedef value_typereference
 Reference to data type.
typedef std::reverse_iterator<
iterator
reverse_iterator
 Bidirectional reverse iterator.
typedef size_t size_type
 Integer that can hold all valid sizes of data.
typedef byte value_type
 Type of data in the buffer.

Public Member Functions

virtual bool append (const_iterator &, const_iterator &) throw (std::range_error)
 Append data between two iterators.
virtual bool append (const_pointer, size_t) throw (std::invalid_argument, std::range_error)
 Append a char array.
virtual bool assign (const_iterator &, const_iterator &) throw (std::bad_alloc)
 Assign data from iterators.
virtual bool assign (const_pointer, size_t) throw (std::invalid_argument, std::bad_alloc)
 Assign data from a pointer.
const_reference at (size_t) const throw (std::out_of_range)
 Index function.
reference at (size_t) throw (std::out_of_range)
 Index function.
const_iterator begin (void) const throw ()
 Get constant iterator to start of data.
iterator begin (void) throw ()
 Get iterator to start of data.
virtual bool clear (void) throw ()
 Clear all Lump contents.
bool clearData (void) throw ()
 Clear the data buffer.
bool clearName (void) throw ()
 Clear the name.
bool empty (void) const throw ()
 Check if the Lump has no data.
const_iterator end (void) const throw ()
 Get constant iterator to end of data.
iterator end (void) throw ()
 Get iterator to end of data.
virtual byte getByte (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual const_pointer getData (void) throw ()
 Get a pointer to the data.
virtual std::string getDString (size_t=0) const throw (std::range_error)
 Get a Doom string from inside a Lump.
virtual dword getDWord (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual int16 getInt16 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual int32 getInt32 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual int64 getInt64 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual int8 getInt8 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
std::string getName (void) const throw ()
 Get the name.
virtual qword getQWord (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual std::string getString (size_t=0) const throw (std::range_error)
 Get a string from inside a Lump.
virtual uint16 getUInt16 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual uint32 getUInt32 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual uint64 getUInt64 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual uint8 getUInt8 (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual word getWord (size_t=0) const throw (std::range_error)
 Get an integer from inside a Lump.
virtual bool grow (size_t) throw (std::range_error, std::bad_alloc)
 Increase the size of the Lump's data.
 Lump (const WadEntry &) throw ()
 Construct from a WadEntry.
 Lump (const_iterator &, const_iterator &) throw ()
 Construct from two iterators.
 Lump (const std::string &, size_t, const_pointer) throw (std::bad_alloc, std::invalid_argument)
 Construct with a name and data buffer.
 Lump (const std::string &, size_t=0) throw (std::bad_alloc)
 Construct with a name and a blank data buffer.
 Lump (const Lump &) throw (std::bad_alloc)
 Copy constructor.
 Lump (void) throw ()
 Default constructor.
 operator bool (void) throw ()
 Cast to bool.
 operator size_t (void) throw ()
 Cast to size_t.
 operator std::string & (void) throw ()
 Cast to std::string reference.
virtual bool operator!= (const Lump &) const throw ()
 Inequality operator.
virtual Lump operator+ (const Lump &) const throw (std::bad_alloc, std::range_error)
 Addition operator.
virtual Lumpoperator+= (const Lump &) throw (std::bad_alloc, std::range_error)
 Concatenation operator.
virtual Lumpoperator= (const WadEntry &) throw (std::bad_alloc)
 Assign from a WadEntry.
virtual Lumpoperator= (const Lump &) throw (std::bad_alloc)
 Assignment operator.
virtual bool operator== (const Lump &) const throw ()
 Equality operator.
const_reference operator[] (size_t) const throw ()
 Array index operator.
reference operator[] (size_t) throw ()
 Array index operator.
const_reverse_iterator rbegin (void) const throw ()
 Get constant reverse iterator to end of data.
reverse_iterator rbegin (void) throw ()
 Get reverse iterator to end of data.
virtual bool readFromFile (const std::string &) throw ()
 Read from a file given a filename.
virtual bool readFromFile (std::ifstream &) throw (std::bad_alloc)
 Read from a file stream.
virtual bool readFromStream (std::istream &, size_t) throw ()
 Read from an input stream.
const_reverse_iterator rend (void) const throw ()
 Get constant reverse iterator to beginning of data.
reverse_iterator rend (void) throw ()
 Get reverse iterator to beginning of data.
virtual bool setByte (byte=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setDString (const std::string &, size_t=0) throw (std::range_error)
 Set a Doom string at a location in a Lump.
virtual bool setDWord (dword=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setInt16 (int16=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setInt32 (int32=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setInt64 (int64=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setInt8 (int8=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
bool setName (const std::string &) throw ()
 Set the name.
virtual bool setQWord (qword=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setSize (size_t) throw (std::bad_alloc)
 Set the size of the Lump's data.
virtual bool setString (const std::string &, size_t=0) throw (std::range_error)
 Set a string at a location in a Lump.
virtual bool setUInt16 (uint16=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setUInt32 (uint32=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setUInt64 (uint64=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setUInt8 (uint8=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool setWord (word=0, size_t=0) throw (std::range_error)
 Set an integer at a location in a Lump.
virtual bool shrink (size_t) throw (std::range_error, std::bad_alloc)
 Decrease the size of the Lump's data.
size_t size (void) const throw ()
 Get the length of the data.
virtual bool writeToFile (const std::string &) const throw ()
 Write to a file given a filename.
virtual bool writeToFile (std::ofstream &) const throw ()
 Write to a file stream.
virtual bool writeToStream (std::ostream &) const throw ()
 Write to an output stream.
virtual bool writeToTextStream (std::ostream &, size_t=32, char= '.') const throw ()
 Write to an output stream.
virtual ~Lump (void) throw ()
 Destructor.

Static Public Attributes

static const size_t MAX_SIZE = std::numeric_limits<size_t>::max ()
 Maximum size of a Lump data buffer.
static const size_t MIN_SIZE = std::numeric_limits<size_t>::min ()
 Minimum size of a Lump data buffer.

Protected Attributes

pointer m_data
 Internal data buffer.
std::string m_name
size_t m_size
 Size of the Lump in bytes. This is also the length of the data buffer.


Constructor & Destructor Documentation

Lump::Lump void   )  throw ()
 

Default constructor.

Create an empty Lump with no data and an empty name.

Definition at line 68 of file lump.cpp.

Lump::Lump const Lump lump  )  throw (std::bad_alloc)
 

Copy constructor.

Create an exact copy of another Lump. This constructor is guaranteed to be atomic. If memory allocation fails, it cleans up after itself and rethrows the bad_alloc exception. According to section 15.2 of the C++ standard, if a constructor throws an exception the stack unwinds to the nearest try block's catch. This calls destructors for partially constructed objects. In practice, it is better to ensure that individual functions (methods? Do we speak Java?) are atomic because not all compilers are compliant with this part of the standard, not even all recent versions.

Parameters:
lump Lump from which to copy state information.
Exceptions:
std::bad_alloc if memory allocation fails.

Definition at line 88 of file lump.cpp.

References m_data, m_name, m_size, and Doomwad::EventLog::printLine().

Lump::Lump const std::string &  name,
size_t  length = 0
throw (std::bad_alloc)
 

Construct with a name and a blank data buffer.

Constructs a Lump with a string name and a data buffer of a given size initialized to all nulls. If memory allocation fails, the constructor will clean up after itself and when the stack unwinds this object will be destroyed.

Parameters:
name Name of the new Lump.
length Size of the new lump.
Exceptions:
std::bad_alloc if memory allocation fails.

Definition at line 134 of file lump.cpp.

References Doomwad::EventLog::printLine().

Lump::Lump const std::string &  name,
size_t  length,
const_pointer  data
throw (std::bad_alloc, std::invalid_argument)
 

Construct with a name and data buffer.

Constructs a Lump with a string name and a data buffer of a given size initialized to a copy of the contents of the given buffer. If memory allocation fails, the constructor will clean up after itself and let stack unwinding take care of the rest.

Parameters:
name Name of the new Lump.
length Size of the source data buffer.
data Pointer to source data buffer.
Exceptions:
std::bad_alloc if memory allocation fails.
std::invalid_argument if a null pointer is passed in and the size is not zero.

Definition at line 186 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Lump::Lump const_iterator first,
const_iterator last
throw ()
 

Construct from two iterators.

Constructs a Lump from two iterators. All of the elements between the two iterators, starting with the element pointed to by the first element and ending with the one before the last element, are copied into the new object. Note that if the iterators do not belong to the same Lump that the behavior of this constructor is not defined. Please play nicely.

Parameters:
first Iterator to first element.
last Iterator to one past the last element.

Definition at line 257 of file lump.cpp.

References assign().

Lump::Lump const WadEntry we  )  throw ()
 

Construct from a WadEntry.

Parameters:
we WadEntry object.

Definition at line 268 of file lump.cpp.

Lump::~Lump void   )  throw () [virtual]
 

Destructor.

Destroys a Lump object. Never call it explicitly. It is guaranteed not to throw any exceptions. We are good citizens and clean up after ourselves.

Definition at line 280 of file lump.cpp.

References clear().


Member Function Documentation

bool Lump::append const_iterator first,
const_iterator last
throw (std::range_error) [virtual]
 

Append data between two iterators.

Works much like the other Lump::append() function, except this one uses iterators to mark the beginning and end rather than a pointer and integer size.

Parameters:
first Iterator to first element.
last Iterator to one past the last element.
Returns:
True if successful, false if not.
Exceptions:
std::range_error 

Definition at line 852 of file lump.cpp.

References append().

bool Lump::append const_pointer  data,
size_t  length
throw (std::invalid_argument, std::range_error) [virtual]
 

Append a char array.

Appends a raw char array onto the end of this Lump. Acts similar to the other overloaded member function except this one throws an exception if the pointer is null and the length is positive. This is designed to facilitate handling lumps in a loop by simplifying the use of the class: do not worry about zero length entries, the class handles it for you.

Parameters:
data Pointer to source data buffer.
length Length of source data buffer.
Returns:
True if successful, false if not.
Exceptions:
std::invalid_argument if the pointer is null and the length is positive.
std::range_error if the new size is larger than MAX_SIZE

Definition at line 770 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Referenced by append(), and readFromFile().

bool Lump::assign const_iterator first,
const_iterator last
throw (std::bad_alloc) [virtual]
 

Assign data from iterators.

Assigns data to a Lump given two iterators from another Lump. This function follows the standard practice of the last iterator pointing to one past the last element desired.

Parameters:
first Iterator to the first element.
last Iterator to one past the last element.
Returns:
True if successful, false if not.
Exceptions:
std::bad_alloc if there is a memory allocation error.

Definition at line 943 of file lump.cpp.

References assign().

bool Lump::assign const_pointer  data,
size_t  length
throw (std::invalid_argument, std::bad_alloc) [virtual]
 

Assign data from a pointer.

Assigns new data to a Lump. Copies the contents of a data buffer into this Lump. If the pointer to the input buffer is null and the size is not zero, this function throws an exception. Assigning with a null pointer and zero size is acceptable. It will clear the buffer. If a memory error occurs, it throws a std::bad_alloc. This function is atomic: if a memory error occurs, it does not overwrite its data.

Parameters:
data Input data buffer.
length Size of the input data buffer.
Returns:
True.
Exceptions:
std::invalid_argument if the buffer pointer is null and the size is not zero.
std::bad_alloc if there is a memory allocation error.

Definition at line 885 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Referenced by assign(), Lump(), Doomwad::Wad::readFromFile(), readFromFile(), and Doomwad::TextWadEntry::toLump().

Lump::const_reference Lump::at size_t  offset  )  const throw (std::out_of_range)
 

Index function.

Gets a const reference to the element at a specified location. This is like Lump::operator[] except this function checks array bounds and throws an exception if it is out of bounds.

Parameters:
offset Offset of the element in the buffer.
Returns:
Const reference to the element.
Exceptions:
std::out_of_range if the offset is out of bounds.

Definition at line 739 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Lump::reference Lump::at size_t  offset  )  throw (std::out_of_range)
 

Index function.

Gets a reference to the element at a specified location. This is like Lump::operator[] except this function checks array bounds and throws an exception if it is out of bounds.

Parameters:
offset Offset of the element in the buffer.
Returns:
Reference to the element.
Exceptions:
std::out_of_range if the offset is out of bounds.

Definition at line 713 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Lump::const_iterator Lump::begin void   )  const throw ()
 

Get constant iterator to start of data.

Gets a const_iterator to the first data element.

Returns:
const_iterator

Definition at line 317 of file lump.cpp.

Lump::iterator Lump::begin void   )  throw ()
 

Get iterator to start of data.

Gets an iterator to the first data element.

Returns:
iterator

Definition at line 293 of file lump.cpp.

Referenced by setDString().

bool Lump::clear void   )  throw () [virtual]
 

Clear all Lump contents.

Erases all contents.

Returns:
True.

Definition at line 1390 of file lump.cpp.

References clearData(), and clearName().

Referenced by clearName(), and ~Lump().

bool Lump::clearData void   )  throw ()
 

Clear the data buffer.

Erases all data and sets the buffer to zero length.

Returns:
True.

Definition at line 1404 of file lump.cpp.

References m_data, and m_size.

Referenced by clear(), operator+=(), and operator=().

bool Lump::clearName void   )  throw ()
 

Clear the name.

Clear the name and set to an empty string.

Returns:
True.

Definition at line 1422 of file lump.cpp.

References clear(), and m_name.

Referenced by clear().

bool Lump::empty void   )  const throw ()
 

Check if the Lump has no data.

Checks the length of the Lump to see if it is zero.

Returns:
True if empty, false if not.

Definition at line 1435 of file lump.cpp.

References m_size.

Lump::const_iterator Lump::end void   )  const throw ()
 

Get constant iterator to end of data.

Gets a const_iterator to one past the last data element.

Returns:
const_iterator

Definition at line 329 of file lump.cpp.

Lump::iterator Lump::end void   )  throw ()
 

Get iterator to end of data.

Gets an iterator to one past the last data element.

Returns:
iterator

Definition at line 305 of file lump.cpp.

Doomwad::byte Lump::getByte size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1461 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Lump::const_pointer Lump::getData void   )  throw () [virtual]
 

Get a pointer to the data.

Gets a const pointer to the data buffer.

Returns:
Pointer to buffer.

Definition at line 993 of file lump.cpp.

References m_data.

std::string Lump::getDString size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get a Doom string from inside a Lump.

Parameters:
index Location of the string.
Returns:
std::string containing the character data.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 2038 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

dword Lump::getDWord size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1505 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

int16 Lump::getInt16 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1593 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Referenced by Doomwad::GLNode::read().

int32 Lump::getInt32 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1637 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

int64 Lump::getInt64 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1681 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

int8 Lump::getInt8 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1549 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

std::string Lump::getName void   )  const throw ()
 

Get the name.

Gets the name of this Lump.

Returns:
The name.

Definition at line 964 of file lump.cpp.

References m_name.

qword Lump::getQWord size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1527 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

std::string Lump::getString size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get a string from inside a Lump.

Parameters:
index Location of the string.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 2013 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

uint16 Lump::getUInt16 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1615 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Referenced by Doomwad::GLNode::read().

uint32 Lump::getUInt32 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1659 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

uint64 Lump::getUInt64 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1703 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

uint8 Lump::getUInt8 size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1571 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

word Lump::getWord size_t  index = 0  )  const throw (std::range_error) [virtual]
 

Get an integer from inside a Lump.

Parameters:
index Location of the integer.
Returns:
Value at the index.
Exceptions:
std::range_error if the index is out of bounds.

Definition at line 1483 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

bool Lump::grow size_t  amount  )  throw (std::range_error, std::bad_alloc) [virtual]
 

Increase the size of the Lump's data.

Grows the data buffer by a specified amount, padding with nulls. The amount is not the new amount, it is a relative size. For example, 5 means "grow by five bytes."

Parameters:
amount Size by which to grow.
Returns:
True.
Exceptions:
std::range_error if there is an overflow, i.e. the new size is more than a Lump can handle.
std::bad_alloc if there is a memory allocation error.

Definition at line 1013 of file lump.cpp.

References Doomwad::exceptionString(), and Doomwad::EventLog::printLine().

Lump::operator bool void   )  throw ()
 

Cast to bool.

Tests whether there is data in the buffer (i.e. the length is greater than zero).

Returns:
True if length is positive, false if zero.

Definition at line 664 of file lump.cpp.

References m_size.

Lump::operator size_t void   )  throw ()
 

Cast to size_t.

Gets the size of the data buffer.

Returns:
Size of the data buffer.

Definition at line 651 of file lump.cpp.

References m_size.

Lump::operator std::string & void   )  throw ()
 

Cast to std::string reference.

Gets a reference to the object's name.

Returns:
Reference to name.

Definition at line 639 of file lump.cpp.

References m_name.

bool Lump::operator!= const Lump lump  )  const throw () [virtual]
 

Inequality operator.

Tests for inequality between two Lumps. See Lump::operator==().

Parameters:
lump Lump against which to test inequality.
Returns:
True if not equal, false if equal.

Definition at line 627 of file lump.cpp.

References m_name.

Lump Lump::operator+ const Lump lump  )  const throw (std::bad_alloc, std::range_error) [virtual]
 

Addition operator.

Creates a new, temporary Lump that is a concatenation of this one and another. If a memory allocation error occurs, the function throws a bad_alloc.

Parameters:
lump Source Lump object to concatenate along with this one.
Returns:
Lump on the stack.
Exceptions:
std::bad_alloc if a memory allocation error occurs.

Definition at line 547 of file lump.cpp.

References Doomwad::exceptionString(), m_data, m_name, m_size, MAX_SIZE, and Doomwad::EventLog::printLine().

Lump & Lump::operator+= const Lump lump  )  throw (std::bad_alloc, std::range_error) [virtual]
 

Concatenation operator.

Appends the contents of a Lump object onto another. Name is not copied, but the contents of the source's data buffer is. Guaranteed to be atomic. If a memory allocation error occurs, no changes are made, and the function throws a bad_alloc. Will be efficient in terms of empty buffers (i.e. short circuit logic).

Parameters:
lump Source Lump object to concatenate.
Returns:
Reference to this object.
Exceptions:
std::bad_alloc if a memory allocation error occurs.
std::range_error if the new size is too large.

Definition at line 466 of file lump.cpp.

References clearData(), Doomwad::exceptionString(), m_data, m_size, MAX_SIZE, and Doomwad::EventLog::printLine().

Lump & Lump::operator= const WadEntry we  )  throw (std::bad_alloc) [virtual]
 

Assign from a WadEntry.

Parameters:
we Source WadEntry object.
Exceptions:
std::bad_alloc if there is a problem allocating memory.
Returns:
Reference to this object.

Definition at line 444 of file lump.cpp.

Lump & Lump::operator= const Lump lump  )  throw (std::bad_alloc) [virtual]
 

Assignment operator.

Deeply copies a Lump object into this one. Guaranteed to be atomic. If an error occurs, the function does not make any changes and it throws a bad_alloc exception to the caller. After this is done, *this == lump.

Parameters:
lump Source Lump object from which to copy.
Returns:
Reference to this object for multiple assignment.
Exceptions:
std::bad_alloc if a memory allocation error occurs.

Definition at line 395 of file lump.cpp.

References clearData(), m_data, m_name, m_size, and Doomwad::EventLog::printLine().

bool Lump::operator== const Lump lump  )  const throw () [virtual]
 

Equality operator.

Tests for equality between two Lumps. Two lumps are equal if their names are equal in accordance with std::string::operator==, their lengths are equal, and their data is equal in accordance with std::memcmp().

Parameters:
lump Lump against which to test equality.
Returns:
True if equal, false if not equal.

Definition at line 613 of file lump.cpp.

References m_name.

<
Lump::const_reference Lump::operator[]