From 9c5815e87eeafdb3cb250d1c27ccb689293e18bd Mon Sep 17 00:00:00 2001 From: Martin Pfeiffer Date: Thu, 20 Oct 2005 22:14:50 +0000 Subject: [PATCH] adding API documentation svn path=/trunk/KDE/kdeedu/kwordquiz/src/leitnersystem.cpp; revision=472496 --- kwordquiz/leitnersystem.cpp | 10 +++--- kwordquiz/leitnersystem.h | 68 ++++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/kwordquiz/leitnersystem.cpp b/kwordquiz/leitnersystem.cpp index 8095520..f7d6627 100644 --- a/kwordquiz/leitnersystem.cpp +++ b/kwordquiz/leitnersystem.cpp @@ -50,7 +50,7 @@ LeitnerBox* LeitnerSystem::boxWithNumber( int number ) return &m_boxes[ number ]; } -LeitnerBox* LeitnerSystem::boxWithName( const QString& name ) +LeitnerBox* LeitnerSystem::boxWithName( const QString& name ) const { foreach( LeitnerBox box, m_boxes ) { @@ -61,7 +61,7 @@ LeitnerBox* LeitnerSystem::boxWithName( const QString& name ) return 0; } -QString& LeitnerSystem::systemName() +QString& LeitnerSystem::systemName() { return m_systemName; } @@ -145,7 +145,7 @@ void LeitnerSystem::setSystemName( const QString& name ) m_systemName = name; } -int LeitnerSystem::number( LeitnerBox* box ) +int LeitnerSystem::number( LeitnerBox* box ) const { if( box == 0 ) return -1; @@ -199,9 +199,9 @@ void LeitnerSystem::setWrongBox( const QString& box, const QString& wrongWordBox boxWithName( box )->setWrongWordBox( boxWithName( wrongWordBox ) ); } -const QString& LeitnerSystem::box( int i ) +const QString& LeitnerSystem::box( int i ) const { - return boxWithNumber( i )->boxName(); + return m_boxes[ i ].boxName(); } void LeitnerSystem::setBoxVocabCount( QString& box, int vocabCount ) diff --git a/kwordquiz/leitnersystem.h b/kwordquiz/leitnersystem.h index d3eede2..c7ed882 100644 --- a/kwordquiz/leitnersystem.h +++ b/kwordquiz/leitnersystem.h @@ -25,23 +25,67 @@ class LeitnerSystem { public: + /**Constructor without arguments*/ LeitnerSystem(); + + /**Constructor with arguments + * @param boxes reference to a QList of LeitnerBox + * @param name the new LeitnerSystems name + */ LeitnerSystem( QList& boxes, QString name ); + /**Destructor*/ ~LeitnerSystem(); - int getNumberOfBoxes() const; //returns the number of boxes in the system - QStringList getBoxNameList(); //returns a list with the boxes names - - QString& systemName(); //returns the systems name - void setSystemName( const QString& name ); //sets the systems name - - LeitnerBox* boxWithNumber( int number ); //returns box by number - LeitnerBox* boxWithName( const QString& name ); //returns box by name - int number( LeitnerBox* box ); - const QString& box( int i ); - - const QString& nextBox( QString& previousBox ); //returns the next box for the next question + /**Returns the number of LeitnerBoxes contained by this LeitnerSystem + * @return the number of LeitnerBoxes as integer + */ + int getNumberOfBoxes() const; + + /**Returns a QStringList with all the LeitnerBoxes' names + * @return a QStringList with all names + */ + QStringList getBoxNameList(); + + /**Returns the LeitnerSystem's name + * @return the LeitnerSystem's name as reference to QString + */ + QString& systemName(); + + /**Sets the LeitnerSystem's name + * @param the new name as QString + */ + void setSystemName( const QString& name ); + + /**Returns a LeitnerBox by number + * @param the number of the LeitnerBox to be returned + * @return a pointer to the LeitnerBox with the number + */ + LeitnerBox* boxWithNumber( int number ); + + /**Returns a LeitnerBox by name + * @param the name of the LeitnerBox to be returned + * @return a pointer to the LeitnerBox with the name + */ + LeitnerBox* boxWithName( const QString& name ) const; + + /**Returns the number of the given LeitnerBox + * @param a pointer to the LeitnerBox + * @return the number of the given LeitnerBox + */ + int number( LeitnerBox* box ) const; + + /**Returns the name of the LeitnerBox with number @param i + * @param the LeitnerBox's number + * @return the name of the LeitnerBox with number @param i + */ + const QString& box( int i ) const; + + /**Returns the LeitnerBox following @param previousBox + * @param the name of the LeitnerBox + * @return the name of the LeitnerBox following previousBox + */ + const QString& nextBox( QString& previousBox ); const QString& correctBox( int box ); //returns the correct word box of "int box" const QString& wrongBox( int box ); //returns the wrong word box of "int box" -- 2.47.3