12 class Species :
public std::map<std::string, std::string> {
23 if(&rhs ==
this)
return *
this;
24 std::map<std::string, std::string>::operator=(rhs);
51 bool load(
const char* filename);
60 dword getSelectionID(
int dir=0,
bool wrap=
true);
62 {
return loadSelection(fname, m_Selection); }
64 {
return writeSelection(fname, m_Selection); }
65 static dword loadSelection(
const std::string& fname,std::list<dword>& sel);
66 static dword writeSelection(
const std::string& fname,
67 const std::list<dword>& sel);
82 : m_DB(db), m_CSel(m_Selectors.begin())
86 bool load(
const char* filename);
92 std::map<dword,Species>::iterator n = m_DB.find(
93 m_DB.getSelectionID());
94 if(n != m_DB.end())
return n->second;
95 else return m_CSpecies;
101 bool nextSelection(
int dir=1,
bool wrap=
true);
106 bool nextSelector(
int walkdir=1,
bool wrap=
true,
dword mincount=1);
DBSelector(SpeciesDB &db, const char *filename)
dword readFlagString(const std::string &flags)
DBSelector(SpeciesDB &db)
const std::string & getDirectory() const
std::list< Species > m_Selectors
bool hasFlag(dword flag) const
dword writeSelection(const std::string &fname) const
SpeciesDB(const char *filename)
static const char * SFIELDS[]
dword setFlag(dword flag)
const std::string & getFilename() const
Species & operator=(const Species &rhs)
friend ParseFile & operator>>(ParseFile &is, Species &sp)
dword loadSelection(const std::string &fname)
std::list< dword > m_Selection
std::list< Species >::iterator m_CSel
static const char s_SPFLAGS[]
bool select(const Species &sp, enum SpCompare how=Species::CMP_CONTAINS) const
std::string getFlagString() const
dword unsetFlag(dword flag)
Species(dword _id=0, dword _flags=0)
Species & getCurSpecies()
Returns a handle to the currently selected species in the data base.
std::list< dword >::iterator m_CSel
friend std::ostream & operator<<(std::ostream &os, const Species &sp)