Vocabulary.h

Go to the documentation of this file.
00001 #ifndef VOCABULARY_H
00002 #define VOCABULARY_H
00003 
00004 #include <iterator.h>
00005 #include <qcstring.h>
00006 #include <qdatastream.h>
00007 #include <qdatetime.h>
00008 #include <qmap.h>
00009 #include <qstring.h>
00010 #include <qstringlist.h>
00011 #include "Base.h"
00012 #include "Term.h"
00013 #include "Util.h"
00014 
00015 class Folder;
00016 
00017 class Vocabulary : public Base {
00018 
00019 public:
00020 
00021     static const Q_UINT32 magicNumber( Q_UINT32( 0x22446688 ) );
00022 
00023     typedef QMap<int, Term> TermMap;
00024 
00025     Vocabulary( int id = -1, const QString& title = QString::null );
00026     Vocabulary( const Vocabulary& voc );
00027     virtual ~Vocabulary();
00028    
00029     const char* className() const { return "Vocabulary"; }
00030 
00031     int getId() const;
00032     int getMaxId() const;
00033     bool isMarkedForStudy() const;
00034     void setMarkedForStudy( bool isMarkedForStudy );
00035     bool isMarkedForDeletion() const;
00036     void setMarkedForDeletion( bool isMarkedForDeletion );
00037     const QString getTitle() const;
00038     void setTitle( const QString& title );
00039     const QString getDescription() const;
00040     void setDescription( const QString& desc );
00041     const QString getAuthor() const;
00042     void setAuthor( const QString& author );
00043     const QDateTime getCreationDate() const;
00044     void setCreationDate( const QDateTime& date );
00045     const QDateTime getModificationDate() const;
00046     void setModificationDate( const QDateTime& date );
00047 
00048     void addTerm( const Term& term );
00049     void removeTerm( const int& id );
00050     bool isTermExists( const int& id ) const;
00051     Term& getTerm( const int& id );
00052     const uint getSize() const;
00053     bool isEmpty() const;
00054     void getItemsCount( uint* termCount, uint* checkedTermCount, uint* selectedTermCount, bool isReachableFromRoot, const QString& firstLang = QString::null, const QString& testLang = QString::null ) const;
00055     int getMaxTermId() const;
00056     bool containsTermWithTranslations( const QString& lang1, const QString& lang2 ) const;
00057     QStringList getTranslationLanguages() const;
00058     void removeTranslations( const QStringList& languages );
00059 
00060     TermMap::ConstIterator begin() const;
00061     TermMap::ConstIterator end() const;
00062     TermMap::Iterator begin();
00063     TermMap::Iterator end();
00064 
00065     bool isDirty() const;
00066     void setDirty( bool isDirty );
00067 
00068     Folder* getParent() const;
00069     void setParent( Folder* parent );
00070 
00071     bool load( const QString& filename );
00072     bool save( const QString& filename ) const;
00073 
00074     friend QDataStream& operator<<( QDataStream& out, const Vocabulary& vocab );
00075     friend QDataStream& operator>>( QDataStream& in, Vocabulary& vocab );
00076 
00077 private:
00078 
00079     int         id;
00080     bool        markedForStudy;
00081     bool        markedForDeletion;
00082     QString     title;
00083     QString     description;
00084     QString     author;
00085     QDateTime   creationDate;
00086     QDateTime   modificationDate;
00087     TermMap     terms;
00088 
00089     bool        dirty;
00090 
00091     Folder*     parent;
00092 
00093 };
00094 
00095 QDataStream& operator<<( QDataStream& out, const Vocabulary& vocab );
00096 QDataStream& operator>>( QDataStream& in, Vocabulary& vocab );
00097 
00098 #endif

Generated on Sun Mar 1 17:30:47 2009 for toMOTko by  doxygen 1.5.6