tbx  0.7.3
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tbx::res::ResBase Class Referenceabstract

Base class for objects, gadgets and menu items from ressources. More...

#include <resbase.h>

Inheritance diagram for tbx::res::ResBase:
tbx::res::ResGadget tbx::res::ResMenuItem tbx::res::ResObject tbx::res::ResShortcut tbx::res::ResActionButton tbx::res::ResAdjuster tbx::res::ResButton tbx::res::ResDisplayField tbx::res::ResDraggable tbx::res::ResLabel tbx::res::ResLabelledBox tbx::res::ResNumberRange tbx::res::ResOptionButton tbx::res::ResPopUp tbx::res::ResRadioButton tbx::res::ResScrollList tbx::res::ResSlider tbx::res::ResStringSet tbx::res::ResTextArea tbx::res::ResToolAction tbx::res::ResWritableField tbx::res::ResColourDbox tbx::res::ResColourMenu tbx::res::ResDCS tbx::res::ResFileInfo tbx::res::ResFontDbox tbx::res::ResFontMenu tbx::res::ResIconbar tbx::res::ResMenu tbx::res::ResPrintDbox tbx::res::ResProgInfo tbx::res::ResQuit tbx::res::ResSaveAs tbx::res::ResScale tbx::res::ResWindow

Public Member Functions

 ResBase (const ResBase &other)
 Copy constructor. More...
 
virtual ~ResBase ()
 Destructor.
 
ResBaseoperator= (const ResBase &other)
 Assignment. More...
 

Protected Member Functions

 ResBase (ResImpl *impl)
 Create from internal resource implementation. More...
 
virtual void make_writeable ()=0
 Make object writeable, call before any change.
 
const char * string (int offset) const
 Return a string at the given offset. More...
 
void string (int offset, const char *value)
 Set a string at the given offset. More...
 
void string (int offset, std::string value)
 Set a string at the given offset. More...
 
void string_with_length (int offset, const char *value, int length=-1)
 Assign a string where the length is at offset+4. More...
 
void string_with_length (int offset, const std::string &value, int length=-1)
 Assign a string where the length is at offset+4. More...
 
const char * message (int offset) const
 Get the message string at the given offset. More...
 
void message (int offset, const char *value)
 Set a message at the given offset. More...
 
void message (int offset, std::string value)
 Set a message at the given offset. More...
 
void message_with_length (int offset, const char *value, int length=-1)
 Assign a message where the length is at offset+4. More...
 
void message_with_length (int offset, const std::string &value, int length=-1)
 Assign a message where the length is at offset+4. More...
 
int int_value (int offset) const
 Get an integer value. More...
 
void int_value (int offset, int value)
 Set a number at the specified offset. More...
 
unsigned int uint_value (int offset) const
 Get an unsigned integer value. More...
 
void uint_value (int offset, unsigned int value)
 Set an unsigned number at the specified offset. More...
 
unsigned char byte_value (int offset) const
 Get a byte value. More...
 
void byte_value (int offset, unsigned char value)
 Set an unsigned byte (8 bit value) at the specified offset. More...
 
unsigned short ushort_value (int offset) const
 Get a unsigned short value. More...
 
void ushort_value (int offset, unsigned short value)
 Set an unsigned short (16 bit value) at the specified offset. More...
 
bool flag (int offset, int mask) const
 Check if any of the bits in a mask are set. More...
 
void flag (int offset, int mask, bool on)
 Set/clear the bits in mask. More...
 
int flag_value (int offset, int mask) const
 Get the bits for the given mask. More...
 
void flag_value (int offset, int mask, int value)
 Set bits in given mask clearing others. More...
 
void init_string (int offset, const char *value)
 Initialise a string in a constructor helper. More...
 
void init_message (int offset, const char *value)
 Initialise a message in a constructor helper. More...
 
void init_sprite_area_ref (int offset)
 Initialise a sprite area reference. More...
 
void init_object_ref (int offset)
 Initialise an object reference. More...
 

Protected Attributes

ResImpl * _impl
 Internal Resource implementation.
 

Detailed Description

Base class for objects, gadgets and menu items from ressources.

Constructor & Destructor Documentation

tbx::res::ResBase::ResBase ( ResImpl *  impl)
inlineprotected

Create from internal resource implementation.

Parameters
implinternal implementation class
tbx::res::ResBase::ResBase ( const ResBase other)

Copy constructor.

Parameters
otherResBase to copy

Member Function Documentation

unsigned char tbx::res::ResBase::byte_value ( int  offset) const
inlineprotected

Get a byte value.

Parameters
offsetoffset to retrieve value for
Returns
an unsigned 8 bit value
void tbx::res::ResBase::byte_value ( int  offset,
unsigned char  value 
)
protected

Set an unsigned byte (8 bit value) at the specified offset.

Parameters
offsetoffset of the value in the object
valuenew value
bool tbx::res::ResBase::flag ( int  offset,
int  mask 
) const
inlineprotected

Check if any of the bits in a mask are set.

Parameters
offsetoffset to check bits at
maskbits to check
Returns
true if one or more of the mask bits are set
void tbx::res::ResBase::flag ( int  offset,
int  mask,
bool  on 
)
protected

Set/clear the bits in mask.

Parameters
offsetoffset of the value to change
maskbits to set on or off
ontrue to set mask bits to 1, false to set them to 0
int tbx::res::ResBase::flag_value ( int  offset,
int  mask 
) const
inlineprotected

Get the bits for the given mask.

Parameters
offsetof value to check bits off
maskbits to check
Returns
value & mask bits
void tbx::res::ResBase::flag_value ( int  offset,
int  mask,
int  value 
)
protected

Set bits in given mask clearing others.

Parameters
offsetof value to change
maskbits to change
valuenew value for bits in mask
void tbx::res::ResBase::init_message ( int  offset,
const char *  value 
)
protected

Initialise a message in a constructor helper.

Parameters
offsetoffset of the message in the object
valueinitial value for the message
void tbx::res::ResBase::init_object_ref ( int  offset)
protected

Initialise an object reference.

Parameters
offsetoffset of the object reference in the object
void tbx::res::ResBase::init_sprite_area_ref ( int  offset)
protected

Initialise a sprite area reference.

Parameters
offsetoffset of the sprite area reference in the object
void tbx::res::ResBase::init_string ( int  offset,
const char *  value 
)
protected

Initialise a string in a constructor helper.

Parameters
offsetoffset of string in the object
valueinitial value for the string
int tbx::res::ResBase::int_value ( int  offset) const
inlineprotected

Get an integer value.

Parameters
offsetoffset to retrieve value for
Returns
integer value at the offset
void tbx::res::ResBase::int_value ( int  offset,
int  value 
)
protected

Set a number at the specified offset.

Parameters
offsetoffset of the number in the object
valuenew value
const char * tbx::res::ResBase::message ( int  offset) const
protected

Get the message string at the given offset.

Parameters
offsetoffset of message in the object
void tbx::res::ResBase::message ( int  offset,
const char *  value 
)
protected

Set a message at the given offset.

Parameters
offsetoffset of message in the object
valuenew value for the message
void tbx::res::ResBase::message ( int  offset,
std::string  value 
)
protected

Set a message at the given offset.

Parameters
offsetoffset of message in the object
valuenew value for the message
void tbx::res::ResBase::message_with_length ( int  offset,
const char *  value,
int  length = -1 
)
protected

Assign a message where the length is at offset+4.

Parameters
offsetoffset into body of message
valuenew value for the message
lengthnew length or -1 to use existing length. The length is always adjusted so it is big enough for the value.
void tbx::res::ResBase::message_with_length ( int  offset,
const std::string &  value,
int  length = -1 
)
inlineprotected

Assign a message where the length is at offset+4.

Parameters
offsetoffset into body of message
valuenew value for the message
lengthnew length or -1 to use existing length. The length is always adjusted so it is big enough for the value.
ResBase & tbx::res::ResBase::operator= ( const ResBase other)

Assignment.

Parameters
otherResBase to copy
const char * tbx::res::ResBase::string ( int  offset) const
protected

Return a string at the given offset.

Parameters
offsetoffset of pointer to string in object
void tbx::res::ResBase::string ( int  offset,
const char *  value 
)
protected

Set a string at the given offset.

Parameters
offsetoffset of string in the object
valuenew value for the string
void tbx::res::ResBase::string ( int  offset,
std::string  value 
)
protected

Set a string at the given offset.

Parameters
offsetoffset of string in the object
valuenew value for the string
void tbx::res::ResBase::string_with_length ( int  offset,
const char *  value,
int  length = -1 
)
protected

Assign a string where the length is at offset+4.

Parameters
offset- offset into body of string
value- new value for the string
length- new length or -1 to use existing length. The length is always adjusted so it is big enough for the value.
void tbx::res::ResBase::string_with_length ( int  offset,
const std::string &  value,
int  length = -1 
)
inlineprotected

Assign a string where the length is at offset+4.

Parameters
offset- offset into body of string
value- new value for the string
length- new length or -1 to use existing length. The length is always adjusted so it is big enough for the value.
unsigned int tbx::res::ResBase::uint_value ( int  offset) const
inlineprotected

Get an unsigned integer value.

Parameters
offsetoffset to retrieve value for
Returns
integer value at the offset
void tbx::res::ResBase::uint_value ( int  offset,
unsigned int  value 
)
protected

Set an unsigned number at the specified offset.

Parameters
offsetoffset of the number in the object
valuenew value
unsigned short tbx::res::ResBase::ushort_value ( int  offset) const
inlineprotected

Get a unsigned short value.

Parameters
offsetoffset to retrieve value for
Returns
unsigned 16 bit value at the offset
void tbx::res::ResBase::ushort_value ( int  offset,
unsigned short  value 
)
protected

Set an unsigned short (16 bit value) at the specified offset.

Parameters
offsetoffset of the value in the object
valuenew value

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