Public Member Functions | Private Attributes
Tileset Class Reference

#include <tileset.h>

Inheritance diagram for Tileset:
ImageSet Resource MemoryCounter

Public Member Functions

 Tileset (Image *const img, const int w, const int h, const int firstGid, const int margin, const int spacing)
int getFirstGid () const
void setProperties (const std::map< std::string, std::string > &props)
std::string getProperty (const std::string &name)
int calcMemoryLocal () const
void setEmpty (const bool b)
bool isEmpty () const
- Public Member Functions inherited from ImageSet
 ImageSet (Image *const img, const int w, const int h, const int margin, const int spacing)
 ~ImageSet ()
int getWidth () const
int getHeight () const
Imageget (const size_type i) const
size_type size () const
int getOffsetX () const
void setOffsetX (const int n)
int getOffsetY () const
void setOffsetY (const int n)
const std::vector< Image * > & getImages () const
- Public Member Functions inherited from Resource
 Resource ()
 ~Resource ()
virtual void incRef ()
virtual void decRef ()
int calcMemoryLocal () const
std::string getCounterName () const
- Public Member Functions inherited from MemoryCounter
 MemoryCounter ()
virtual ~MemoryCounter ()
int calcMemory (const int level) const
virtual int calcMemoryChilds (const int level) const

Private Attributes

std::map< std::string, std::string > mProperties
int mFirstGid
bool mIsEmpty

Additional Inherited Members

- Public Types inherited from ImageSet
typedef std::vector< Image * >::size_type size_type
- Data Fields inherited from Resource
time_t mTimeStamp
std::string mIdPath
std::string mSource
unsigned int mRefCount
bool mProtected
bool mNotCount

Detailed Description

A tileset, which is basically just an image set but it stores a firstgid.

Definition at line 33 of file tileset.h.

Constructor & Destructor Documentation

◆ Tileset()

Tileset::Tileset ( Image *const  img,
const int  w,
const int  h,
const int  firstGid,
const int  margin,
const int  spacing 


Definition at line 39 of file tileset.h.

44  :
45  ImageSet(img, w, h, margin, spacing),
46  mProperties(),
47  mFirstGid(firstGid),
48  mIsEmpty(false)
49  {
50  }

Referenced by calcMemoryLocal().

Member Function Documentation

◆ calcMemoryLocal()

int Tileset::calcMemoryLocal ( ) const

Reimplemented from ImageSet.

Definition at line 79 of file tileset.h.

80  {
81  int sz = ImageSet::calcMemoryLocal() +
82  static_cast<int>(sizeof(Tileset));
83  const std::map<std::string, std::string>::const_iterator it_end =
84  mProperties.end();
85  std::map<std::string, std::string>::const_iterator it =
86  mProperties.begin();
87  while (it != it_end)
88  {
89  sz += static_cast<int>((*it).first.capacity() +
90  (*it).second.capacity());
91  ++ it;
92  }
93  return sz;
94  }

References ImageSet::calcMemoryLocal(), mProperties, and Tileset().

◆ getFirstGid()

int Tileset::getFirstGid ( ) const

Returns the first gid.

Definition at line 57 of file tileset.h.

58  { return mFirstGid; }

References mFirstGid.

Referenced by setTile().

◆ getProperty()

std::string Tileset::getProperty ( const std::string &  name)

Returns property value.

Definition at line 70 of file tileset.h.

71  {
72  const std::map<std::string, std::string>::const_iterator
73  it = mProperties.find(name);
74  if (it == mProperties.end())
75  return "";
76  return mProperties[name];
77  }

References mProperties.

◆ isEmpty()

bool Tileset::isEmpty ( ) const

Definition at line 99 of file tileset.h.

100  { return mIsEmpty; }

References mIsEmpty.

Referenced by setTile().

◆ setEmpty()

void Tileset::setEmpty ( const bool  b)

Definition at line 96 of file tileset.h.

97  { mIsEmpty = b; }

References mIsEmpty.

Referenced by MapReader::readTileset().

◆ setProperties()

void Tileset::setProperties ( const std::map< std::string, std::string > &  props)

Set tileset property.

Definition at line 63 of file tileset.h.

65  { mProperties = props; }

References mProperties.

Referenced by MapReader::readTileset().

Field Documentation

◆ mFirstGid

int Tileset::mFirstGid

Definition at line 104 of file tileset.h.

Referenced by getFirstGid().

◆ mIsEmpty

bool Tileset::mIsEmpty

Definition at line 105 of file tileset.h.

Referenced by isEmpty(), and setEmpty().

◆ mProperties

std::map<std::string, std::string> Tileset::mProperties

Definition at line 103 of file tileset.h.

Referenced by calcMemoryLocal(), getProperty(), and setProperties().

The documentation for this class was generated from the following file:
int calcMemoryLocal() const
Definition: imageset.cpp:77
bool mIsEmpty
Definition: tileset.h:105
std::map< std::string, std::string > mProperties
Definition: tileset.h:103
int mFirstGid
Definition: tileset.h:104
ImageSet(Image *const img, const int w, const int h, const int margin, const int spacing)
Definition: imageset.cpp:34
Tileset(Image *const img, const int w, const int h, const int firstGid, const int margin, const int spacing)
Definition: tileset.h:39