Prepare 1.0 alpha3 release.
[tagua/yd.git] / src / variants.h
blobe2f15758a22267173d3570e080a9a8c6bc74b73e
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
12 #ifndef VARIANTS_H
13 #define VARIANTS_H
15 #include <QString>
16 #include <map>
17 #include "tagua.h"
18 #include "fwd.h"
20 class Variants {
21 class case_comparer {
22 public:
23 bool operator()(const QString& a, const QString& b) const {
24 return a.compare(b, Qt::CaseInsensitive) < 0;
28 typedef std::map<QString, VariantFactory*, case_comparer> Factories;
29 Factories m_factories;
31 Variants();
32 public:
33 VariantPtr get(const QString& name) const;
34 VariantFactory* getFactory(const QString& name) const;
36 void addFactory(VariantFactory* factory);
38 /**
39 * \return a list of all non-hidden variants.
41 QStringList all() const;
43 static Variants& instance();
46 #endif // VARIANTS_H