filealias.h
1 //------------------------------------------------------------------------------
2 // filealias.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2014 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef id8E04D971_DF78_4DB4_97E84A8D859F3694
24 #define id8E04D971_DF78_4DB4_97E84A8D859F3694
25 
26 #include <QList>
27 #include <QString>
28 #include <QStringList>
29 #include <QVariant>
30 
31 class FileAlias
32 {
33  public:
34  static FileAlias freeDoom1Aliases();
35  static QList<FileAlias> freeDoom2Aliases();
39  static QList<FileAlias> standardWadAliases();
40 
41  FileAlias();
42  FileAlias(const QString &name);
43 
47  void addAlias(const QString &val);
51  void addAliases(const QStringList &val);
52 
53  const QStringList &aliases() const;
54  void setAliases(const QStringList &val);
55 
56  static FileAlias deserializeQVariant(const QVariant &var);
57  QVariant serializeQVariant() const;
58 
63  bool isSameName(const QString &otherName) const;
64 
68  bool isValid() const;
69 
70  const QString &name() const;
71  void setName(const QString &val);
72 
73  private:
74  class PrivData
75  {
76  public:
77  QStringList aliases;
78  QString name;
79  };
80 
81  PrivData d;
82 };
83 
85 {
86  public:
87  static QList<FileAlias> mergeDuplicates(const QList<FileAlias> &input);
88 };
89 
90 #endif // header
bool isValid() const
Valid FileAlias has a name and at least one alias.
Definition: filealias.cpp:112
void addAliases(const QStringList &val)
Will ensure unique values.
Definition: filealias.cpp:42
static QList< FileAlias > standardWadAliases()
Standard/default aliases for configuration init.
Definition: filealias.cpp:127
bool isSameName(const QString &otherName) const
Compares passed string to local name and checks if they&#39;re same.
Definition: filealias.cpp:107
void addAlias(const QString &val)
Will ensure unique values.
Definition: filealias.cpp:34