summaryrefslogtreecommitdiffstats
path: root/noatun/modules/kjofol-skin/parser.h
blob: 3f691253918b3ebed3043ca9053bdeb7f242ca1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef PARSER_H
#define PARSER_H

// system includes
#include <tqstringlist.h>
#include <tqpixmap.h>
#include <tqimage.h>
#include <tqdict.h>

class Parser : public TQDict<TQStringList>
{
	class ImagePixmap
	{
	public:
		ImagePixmap() : mImage(0), mPixmap(0) {}
		~ImagePixmap() {}
		TQImage mImage;
		TQPixmap mPixmap;
	};

	public:
		Parser();

		void conserveMemory();
		void open(const TQString &file);

		TQString dir() const;
		TQPixmap pixmap(const TQString &pixmap) const
			{ return getPair(pixmap)->mPixmap; }
		TQImage image(const TQString &image) const
			{ return getPair(image)->mImage; }
		TQString about() const { return mSkinAbout; };

		TQString fileItem(const TQString &file) const;

		bool exist(const TQString &i) const;

	public:
		TQStringList& operator[](const TQString &l) { return *find(l);}

	private:
		ImagePixmap *getPair(const TQString &i) const;

	private:
		mutable TQDict<ImagePixmap> mImageCache;
		TQString mDir;
		TQString mSkinAbout;
};
#endif // PARSER_H