]> Shamusworld >> Repos - architektonas/blob - src/base/patternlist.h
Bugfixes related to removing Snapper class.
[architektonas] / src / base / patternlist.h
1 #ifndef __PATTERNLIST_H__
2 #define __PATTERNLIST_H__
3
4 #include <QtCore>
5 #include "pattern.h"
6 #include "entity.h"
7
8 #define PATTERNLIST PatternList::instance()
9
10 /**
11  * The global list of patterns. This is implemented as a singleton.
12  * Use PatternList::instance() to get a pointer to the object.
13  *
14  * @author James Hammons
15  * @author Andrew Mustun
16  */
17 class PatternList
18 {
19         protected:
20                 PatternList();
21
22         public:
23                 virtual ~PatternList();
24
25                 static PatternList * instance();
26                 void init();
27                 void clearPatterns();
28                 int countPatterns();
29                 virtual void removePattern(Pattern * pattern);
30                 Pattern * requestPattern(const QString & name);
31                 Pattern * firstPattern();
32                 Pattern * nextPattern();
33                 bool contains(const QString & name);
34
35                 friend std::ostream & operator<<(std::ostream & os, PatternList & l);
36
37         protected:
38                 static PatternList * uniqueInstance;
39
40         private:
41                 //! patterns in the graphic
42                 QList<Pattern *> patterns;
43                 QListIterator<Pattern *> patternIterator;
44 };
45
46 #endif  // __PATTERNLIST_H__