tbx  0.7.6
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
tbx::TagAttribute Class Reference

Class to represent a single attribute. More...

#include <tag.h>

Public Member Functions

int id () const
 Attribute Id.
 
const std::string & value ()
 Get the current string value for the attribute.
 
int integer () const
 Return the current value as an integer. More...
 
void value (const std::string &value)
 Set the value of the attribute. More...
 
void has_value (bool has)
 Set if the attribute has a value associated with it. More...
 
bool has_value () const
 Check if the attribute has a value. More...
 
TagAttributenext ()
 Get the next attribute for the same tag. More...
 

Protected Member Functions

 TagAttribute (int id)
 Construct an attribute without a value. More...
 
 TagAttribute (int id, const std::string &value)
 Construct an attribute with the given value. More...
 

Protected Attributes

int _id
 Id of attribute.
 
std::string _value
 Value of attribute (if any)
 
bool _has_value
 true if attribute has a value
 
TagAttribute_next
 Next attribute for the same tag.
 

Friends

class Tag
 

Detailed Description

Class to represent a single attribute.

Constructor & Destructor Documentation

◆ TagAttribute() [1/2]

TagAttribute::TagAttribute ( int  id)
protected

Construct an attribute without a value.

Parameters
idID of the name for this type of tag attribute

◆ TagAttribute() [2/2]

TagAttribute::TagAttribute ( int  id,
const std::string &  value 
)
protected

Construct an attribute with the given value.

Parameters
idID of the name for this type of tag attribute
valuevalue of the tag attribute

Member Function Documentation

◆ has_value() [1/2]

bool tbx::TagAttribute::has_value ( ) const
inline

Check if the attribute has a value.

Returns
true if the attribute has a value

◆ has_value() [2/2]

void tbx::TagAttribute::has_value ( bool  has)
inline

Set if the attribute has a value associated with it.

Parameters
hastrue if the attribute has a value

◆ integer()

int tbx::TagAttribute::integer ( ) const
inline

Return the current value as an integer.

Returns
integer value or 0 if the current value is not an integer

◆ next()

TagAttribute* tbx::TagAttribute::next ( )
inline

Get the next attribute for the same tag.

Returns
next attribute or 0 if there are no more attributes

◆ value()

void tbx::TagAttribute::value ( const std::string &  value)
inline

Set the value of the attribute.

Parameters
valuethe new string value of the attribute

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