Bitstream Interpretation Library (BIL)  0.1
V5CfgTileMap.cpp
Go to the documentation of this file.
1 
8 
9 using namespace bil;
10 
11 
13  m_rowCount(0),
14  m_columnCount(0),
15  m_entries()
16 {
17 
18 }
19 
20 
21 unsigned V5CfgTileMap::rowCount() const
22 {
23  return m_rowCount;
24 }
25 
26 
27 unsigned V5CfgTileMap::columnCount() const
28 {
29  return m_columnCount;
30 }
31 
32 
33 V5CfgTileMapEntry& V5CfgTileMap::entries(unsigned row, unsigned column)
34 {
35  if (row >= m_rowCount) throw Exception();
36  if (column >= m_columnCount) throw Exception();
37  return m_entries[(row * m_columnCount) + column];
38 }
39 
40 
41 const V5CfgTileMapEntry& V5CfgTileMap::entries(unsigned row, unsigned column) const
42 {
43  if (row >= m_rowCount) throw Exception();
44  if (column >= m_columnCount) throw Exception();
45  return m_entries[(row * m_columnCount) + column];
46 }
47 
48 
49 void V5CfgTileMap::resize(unsigned rowCount, unsigned columnCount)
50 {
51  // resize entries
52  m_entries.resize(rowCount * columnCount);
53  m_rowCount = rowCount;
54  m_columnCount = columnCount;
55  // clear out entries
56  size_t entryCount = m_entries.size();
57  for (size_t i = 0; i < entryCount; ++i)
58  (m_entries[i]).clear();
59 }
60 
61 
63 {
64  m_rowCount = 0;
65  m_columnCount = 0;
66  m_entries.clear();
67 }