Changed my email in the copyright statements.
[tagua/yd.git] / src / variants.h
blob6225051d95f46c5dd1b5a0e9ed36f19fae733fe8
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 void addFactory(const QString& name, VariantFactory* factory);
35 QStringList all() const;
37 static Variants& instance();
40 #endif // VARIANTS_H