lisp::ListIterator Class Reference

Small and a bit hacky helper class that helps parsing lisp lists where all entries are lists again themselves. More...

#include <list_iterator.hpp>

List of all members.

Public Member Functions

 ListIterator (const lisp::Lisp *cur)
const std::string & item () const
const lisp::Lisplisp () const
const lisp::Lispvalue () const
bool next ()

Private Member Functions

 ListIterator (const ListIterator &)
ListIteratoroperator= (const ListIterator &)

Private Attributes

std::string current_item
const lisp::Lispcurrent_lisp
const lisp::Lispcur


Detailed Description

Small and a bit hacky helper class that helps parsing lisp lists where all entries are lists again themselves.

Definition at line 28 of file list_iterator.hpp.


Constructor & Destructor Documentation

lisp::ListIterator::ListIterator ( const lisp::Lisp cur  ) 

Definition at line 22 of file list_iterator.cpp.

00022                                                   :
00023   current_item(),
00024   current_lisp(0), 
00025   cur(newlisp)
00026 {
00027 }

lisp::ListIterator::ListIterator ( const ListIterator  )  [private]


Member Function Documentation

const std::string& lisp::ListIterator::item (  )  const [inline]

Definition at line 33 of file list_iterator.hpp.

References current_item.

Referenced by BonusBlock::BonusBlock(), AddonManager::check_online(), worldmap::WorldMap::load(), Level::load(), TileSetParser::parse(), Sector::parse(), Sector::parse_old_format(), TileManager::parse_tileset_definition(), Path::read(), JoystickKeyboardController::read(), SpawnPoint::SpawnPoint(), and SpriteData::SpriteData().

00034   { return current_item; }

const lisp::Lisp* lisp::ListIterator::lisp (  )  const [inline]

Definition at line 35 of file list_iterator.hpp.

References current_lisp.

Referenced by BonusBlock::BonusBlock(), AddonManager::check_online(), worldmap::WorldMap::load(), Level::load(), TileSetParser::parse(), Sector::parse(), Sector::parse_old_format(), TileManager::parse_tileset_definition(), Path::read(), JoystickKeyboardController::read(), and SpriteData::SpriteData().

00036   { return current_lisp; }

const lisp::Lisp* lisp::ListIterator::value (  )  const [inline]

Definition at line 37 of file list_iterator.hpp.

References current_lisp, and lisp::Lisp::get_car().

Referenced by BonusBlock::BonusBlock(), worldmap::WorldMap::load(), Level::load(), Sector::parse(), Path::read(), SpawnPoint::SpawnPoint(), and SpriteData::SpriteData().

00038   { return current_lisp->get_car(); }

bool lisp::ListIterator::next (  ) 

Definition at line 30 of file list_iterator.cpp.

References cur, current_item, current_lisp, lisp::Lisp::get(), lisp::Lisp::get_car(), lisp::Lisp::get_cdr(), lisp::Lisp::get_type(), lisp::Lisp::TYPE_CONS, lisp::Lisp::TYPE_STRING, and lisp::Lisp::TYPE_SYMBOL.

Referenced by BonusBlock::BonusBlock(), AddonManager::check_online(), worldmap::WorldMap::load(), Level::load(), TileSetParser::parse(), Sector::parse(), Sector::parse_old_format(), TileManager::parse_tileset_definition(), Path::read(), JoystickKeyboardController::read(), SpawnPoint::SpawnPoint(), and SpriteData::SpriteData().

00031 {
00032   if(cur == 0)
00033     return false;
00034 
00035   const lisp::Lisp* child = cur->get_car();
00036   if(!child)
00037     throw std::runtime_error("child is 0 in list entry");
00038   if(child->get_type() != lisp::Lisp::TYPE_CONS)
00039     throw std::runtime_error("Expected CONS");
00040   const lisp::Lisp* name = child->get_car();
00041   if(!name || (
00042        name->get_type() != lisp::Lisp::TYPE_SYMBOL
00043        && name->get_type() != lisp::Lisp::TYPE_STRING))
00044     throw std::runtime_error("Expected symbol");
00045   name->get(current_item);
00046   current_lisp = child->get_cdr();
00047 
00048   cur = cur->get_cdr();
00049   return true;
00050 }

ListIterator& lisp::ListIterator::operator= ( const ListIterator  )  [private]


Member Data Documentation

std::string lisp::ListIterator::current_item [private]

Definition at line 42 of file list_iterator.hpp.

Referenced by item(), and next().

const lisp::Lisp* lisp::ListIterator::current_lisp [private]

Definition at line 43 of file list_iterator.hpp.

Referenced by lisp(), next(), and value().

const lisp::Lisp* lisp::ListIterator::cur [private]

Definition at line 44 of file list_iterator.hpp.

Referenced by next().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:38 2014 for SuperTux by  doxygen 1.5.1