Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Level Class Reference

This class represents a sokoban level (which is a map plus some other properties). More...

#include <level.h>

List of all members.

Public Methods

 Level (Map const &map, QStringList const &authors, QStringList const &emails, QString const &homepage, QString const &copyright, QString const &name, QString const &info, int difficulty)
 Level (QStringList &lines, QStringList const &authors, QStringList const &emails, QString const &homepage, QString const &copyright, QString const &info, int difficulty)
 Level (QDataStream &stream, int version)
Map const & map () const
void setMap (Map const &map)
CompressedMap const & compressedMap () const
QStringList const & authors () const
QString authorLine () const
QString authorEmailLine () const
void setAuthors (QStringList const &authors)
void setAuthorEmailLine (QString author_email_line)
QStringList const & emails () const
void setEmails (QStringList const &emails)
QString const & homepage () const
void setHomepage (QString const &homepage)
QString const & copyright () const
void setCopyright (QString const &copyright)
QString const & name () const
void setName (QString const &name)
QString const & info () const
void setInfo (QString const &info)
int difficulty () const
void setDifficulty (int difficulty)
void writeToStream (QDataStream &stream) const
QString toText (QStringList const &authors, QStringList const &emails, QString const &homepage, QString const &copyright, QString const &info, int difficulty) const

Static Private Methods

void getInfo (QStringList &lines, QStringList &authors, QStringList &emails, QString &homepage, QString &copyright, QString &name, QString &info, int &difficulty)
void parseAuthorEmailLine (QString const &author_email_line, QStringList &authors, QStringList &emails)
QString createAuthorEmailLine (QStringList const &authors, QStringList const &emails)

Private Attributes

CompressedMap m_compressed_map
Map m_map
QStringList m_authors
QStringList m_emails
QString m_homepage
QString m_copyright
QString m_name
QString m_info
int m_difficulty

Friends

class Collection


Detailed Description

This class represents a sokoban level (which is a map plus some other properties).

Author:
Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
Version:
0.1


Constructor & Destructor Documentation

Level::Level Map const & map,
QStringList const & authors,
QStringList const & emails,
QString const & homepage,
QString const & copyright,
QString const & name,
QString const & info,
int difficulty
 

Creates the level.

Parameters:
map   The map to use.
authors   The author(s) the of the level.
email   The email addresses of the authors (must be of the same size as authors).
homepage   The homepage of the author.
copyright   The copyright of the level.
name   The name of the level.
info   Additional info for this level.
difficulty   The difficulty of the level in the range[-1:10], with 0 being trivially easy. -1 means an unknown difficulty.

Level::Level QStringList & lines,
QStringList const & authors,
QStringList const & emails,
QString const & homepage,
QString const & copyright,
QString const & info,
int difficulty
 

Constructs the map from a list of lines in xsb format.

The constructor removes all lines in the string list, which were before the actual map and the lines of the actual map itself and all lines up to another map (in these lines we also look for additional info like author etc.). Be sure to call map.isValid() afterwards.

Note that you have to supply default values for all author etc, which will only be overwritten, if there exist other information for the level.

Parameters:
lines   The list with the lines.
authors   The author(s) the of the level.
emails   The email addresses of the authors.
homepage   The homepage of the author.
copyright   The copyright of the level.
info   The additional information of the level.
difficulty   The difficulty of the level in the range[-1:10], with 0 being trivially easy. -1 means an unknown difficulty.

Level::Level QDataStream & stream,
int version
 

Creates a level from a QDataStream.

Parameters:
stream   The stream to use.
version   The version to use.


Member Function Documentation

QString Level::authorEmailLine const
 

Returns the authors and emails in one line, separated by ", ".

QString Level::authorLine const
 

Returns the authors in one line, separated by ", ".

QStringList const& Level::authors const
 

Returns the authors of the level.

CompressedMap const& Level::compressedMap const
 

Returns the compressed map of the level.

QString const& Level::copyright const
 

Returns the copyright the the level.

QString Level::createAuthorEmailLine QStringList const & authors,
QStringList const & emails
[static, private]
 

Creates the author-email-line.

Parameters:
authors   The authors.
emails   The emails.

int Level::difficulty const
 

Returns the difficulty of the level.

QStringList const& Level::emails const
 

Returns the email adresses of the authors.

void Level::getInfo QStringList & lines,
QStringList & authors,
QStringList & emails,
QString & homepage,
QString & copyright,
QString & name,
QString & info,
int & difficulty
[static, private]
 

Read author etc.

information of a list of lines, unitl a sokoban map is found.

The constructor removes all lines in the string list, which were before the actual map.

Note that you have to supply default values for all author etc, which will only be overwritten, if there exist other information.

Parameters:
lines   The list with the lines.
authors   The authors the of the level.
emails   The the email adresses of the authors the of the level.
homepage   The homepage of the author.
copyright   The copyright of the level.
name   The name of the level.
difficulty   The difficulty of the level.

QString const& Level::homepage const
 

Returns the homepage of the level.

QString const& Level::info const
 

Returns the additional info for this level.

Map const& Level::map const
 

Returns the map of the level.

QString const& Level::name const
 

Returns the name of the level.

void Level::parseAuthorEmailLine QString const & author_email_line,
QStringList & authors,
QStringList & emails
[static, private]
 

Creates authors and emails from an author-email-line.

Parameters:
author_email_line   The author-email-line.
authors   Here we store the authors.
email   Here we store the email addresses.

void Level::setAuthorEmailLine QString author_email_line
 

Sets the authors and emails created from the line.

Parameters:
author_email_line   The line containing (separated by ',') the authors and emails.

void Level::setAuthors QStringList const & authors
 

Sets the authors of the level.

Parameters:
authors   The new authosr.

void Level::setCopyright QString const & copyright
 

Sets the copyright of the level.

Parameters:
copyright   The new copyright.

void Level::setDifficulty int difficulty
 

Sets the difficulty of the level.

Parameters:
difficulty   The new difficulty.

void Level::setEmails QStringList const & emails
 

Sets the email adddresses of the authors.

Parameters:
emails   The email adddresses of the authors.

void Level::setHomepage QString const & homepage
 

Sets the homepage of the level.

Parameters:
homepage   The new homepage.

void Level::setInfo QString const & info
 

Sets the info of the level.

Parameters:
info   The new info.

void Level::setMap Map const & map
 

Sets the map of the level.

Parameters:
map   The new map.

void Level::setName QString const & name
 

Sets the name of the level.

Parameters:
name   The new name.

QString Level::toText QStringList const & authors,
QStringList const & emails,
QString const & homepage,
QString const & copyright,
QString const & info,
int difficulty
const
 

Returns the map of the level collection plus additional info in xsb format.

Note that only these informations are added, which differ from the ones in the collection.

Parameters:
authors   The authors of the collection.
emails   The email addresses of the authors of the collection.
homepage   The homepage of the collection.
copyright   The copyright of the collection.
info   The info of the collection.
difficulty   The difficulty of the collection.

void Level::writeToStream QDataStream & stream const
 

Writes the level to a QDataStream.

Parameters:
stream   The stream to use.


Friends And Related Function Documentation

friend class Collection [friend]
 

To let collection use the information routines (maybe this should be refactored).


Member Data Documentation

QStringList Level::m_authors [private]
 

The authors.

CompressedMap Level::m_compressed_map [private]
 

The compressed map.

QString Level::m_copyright [private]
 

The copyright.

int Level::m_difficulty [private]
 

The difficulty.

QStringList Level::m_emails [private]
 

The email adresses of the authors.

QString Level::m_homepage [private]
 

The homepage.

QString Level::m_info [private]
 

The additional level info.

Map Level::m_map [private]
 

The map.

QString Level::m_name [private]
 

The name.


The documentation for this class was generated from the following file:
Generated at Sun Jan 6 18:49:11 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001