Crossfire Server, Trunk
MessageFile.h
Go to the documentation of this file.
1 #ifndef _MESSAGEFILE_H
2 #define _MESSAGEFILE_H
3 
4 #include <QObject>
5 #include <QStringList>
6 #include "assets/AssetWrapper.h"
7 
9 
13 class MessageRule : public QObject
14 {
15  Q_OBJECT
16 
17  public:
18  MessageRule();
19  MessageRule(const MessageRule& original);
20  virtual ~MessageRule();
21 
22  const QString& comment() const;
23  void setComment(const QString& comment);
24  const QStringList& match() const;
25  QStringList& match();
26  void setMatch(const QStringList& match);
27  const QList<QStringList>& preconditions() const;
28  void setPreconditions(const QList<QStringList>& preconditions);
29  const QList<QStringList>& postconditions() const;
30  void setPostconditions(const QList<QStringList>& postconditions);
31  const QStringList& messages() const;
32  void setMessages(const QStringList& messages);
33  const QStringList& include() const;
34  void setInclude(const QStringList& include);
35  const QList<QStringList>& replies() const;
36  void setReplies(const QList<QStringList>& replies);
37 
38  bool isModified() const;
39  void setModified(bool modified = true);
40 
41  private:
43  QString myComment;
44  QStringList myMatch;
45  QList<QStringList> myPreconditions;
46  QList<QStringList> myPostconditions;
47  QStringList myMessages;
48  QStringList myInclude;
49  QList<QStringList> myReplies;
50 };
51 
56 class MessageFile : public AssetWrapper {
57  Q_OBJECT
58 
59 public:
65  MessageFile(AssetWrapper *parent, const QString& path);
66  virtual ~MessageFile();
67 
68  virtual QString displayName() const override { return myPath; }
69  virtual void displayFillPanel(QWidget *panel) override {
70  CRETPanel<MessageFile> *p = static_cast<CRETPanel<MessageFile> *>(panel);
71  p->setItem(this);
72  }
73  virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override;
74 
75  MessageFile* duplicate() const;
76  void copy(const MessageFile* other);
77 
82  bool parseFile();
83 
84  const QString& path() const;
85  void setPath(const QString& path);
86 
87  const QString& location() const;
88  void setLocation(const QString& location);
89 
90  QList<MessageRule*>& rules();
91  QList<CREMapInformation*>& maps();
92 
93  void save();
94 
95  bool isModified() const;
96  void setModified(bool modified = true);
97 
98 private:
100  QString myPath;
101  QString myLocation;
102  QList<MessageRule*> myRules;
103  QList<CREMapInformation*> myMaps;
104 };
105 
106 #endif /* _MESSAGEFILE_H */
CRETPanel< MessageFile >
MessageFile::displayFillPanel
virtual void displayFillPanel(QWidget *panel) override
Definition: MessageFile.h:69
MessageFile::copy
void copy(const MessageFile *other)
Definition: MessageFile.cpp:137
MessageRule::~MessageRule
virtual ~MessageRule()
Definition: MessageFile.cpp:28
AssetWrapper.h
MessageFile::path
const QString & path() const
Definition: MessageFile.cpp:153
MessageFile::~MessageFile
virtual ~MessageFile()
Definition: MessageFile.cpp:122
MessageRule::setPostconditions
void setPostconditions(const QList< QStringList > &postconditions)
Definition: MessageFile.cpp:72
MessageFile::maps
QList< CREMapInformation * > & maps()
Definition: MessageFile.cpp:261
MessageFile::duplicate
MessageFile * duplicate() const
Definition: MessageFile.cpp:127
MessageFile::isModified
bool isModified() const
Definition: MessageFile.cpp:379
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:14
MessageRule::myComment
QString myComment
Definition: MessageFile.h:43
MessageFile::myLocation
QString myLocation
Definition: MessageFile.h:101
MessageFile::save
void save()
Definition: MessageFile.cpp:339
MessageRule::myPostconditions
QList< QStringList > myPostconditions
Definition: MessageFile.h:46
MessageFile
Definition: MessageFile.h:56
MessageFile::myIsModified
bool myIsModified
Definition: MessageFile.h:99
MessageRule::messages
const QStringList & messages() const
Definition: MessageFile.cpp:77
MessageRule::setInclude
void setInclude(const QStringList &include)
Definition: MessageFile.cpp:92
MessageRule::setMatch
void setMatch(const QStringList &match)
Definition: MessageFile.cpp:52
CREMapInformation
Definition: CREMapInformation.h:16
MessageFile::displayName
virtual QString displayName() const override
Definition: MessageFile.h:68
MessageFile::MessageFile
MessageFile(AssetWrapper *parent, const QString &path)
Definition: MessageFile.cpp:117
MessageRule::include
const QStringList & include() const
Definition: MessageFile.cpp:87
MessageFile::setLocation
void setLocation(const QString &location)
Definition: MessageFile.cpp:167
AssetWrapper
Definition: AssetWrapper.h:11
MessageRule::MessageRule
MessageRule()
Definition: MessageFile.cpp:13
MessageRule::myPreconditions
QList< QStringList > myPreconditions
Definition: MessageFile.h:45
MessageRule::setModified
void setModified(bool modified=true)
Definition: MessageFile.cpp:112
MessageFile::setPath
void setPath(const QString &path)
Definition: MessageFile.cpp:158
MessageRule::myInclude
QStringList myInclude
Definition: MessageFile.h:48
MessageRule::myMessages
QStringList myMessages
Definition: MessageFile.h:47
MessageRule::setPreconditions
void setPreconditions(const QList< QStringList > &preconditions)
Definition: MessageFile.cpp:62
MessageFile::setModified
void setModified(bool modified=true)
Definition: MessageFile.cpp:384
AssetWrapper::modified
void modified()
CRETPanel::setItem
virtual void setItem(T *item)=0
MessageFile::rules
QList< MessageRule * > & rules()
Definition: MessageFile.cpp:256
MessageRule::myMatch
QStringList myMatch
Definition: MessageFile.h:44
MessageRule::replies
const QList< QStringList > & replies() const
Definition: MessageFile.cpp:97
MessageFile::location
const QString & location() const
Definition: MessageFile.cpp:148
MessageRule::setReplies
void setReplies(const QList< QStringList > &replies)
Definition: MessageFile.cpp:102
MessageRule::myReplies
QList< QStringList > myReplies
Definition: MessageFile.h:49
MessageFile::myRules
QList< MessageRule * > myRules
Definition: MessageFile.h:102
MessageFile::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: MessageFile.cpp:389
MessageFile::parseFile
bool parseFile()
Definition: MessageFile.cpp:193
MessageRule::match
const QStringList & match() const
Definition: MessageFile.cpp:42
MessageRule::preconditions
const QList< QStringList > & preconditions() const
Definition: MessageFile.cpp:57
MessageFile::myPath
QString myPath
Definition: MessageFile.h:100
MessageRule::myIsModified
bool myIsModified
Definition: MessageFile.h:42
MessageRule::postconditions
const QList< QStringList > & postconditions() const
Definition: MessageFile.cpp:67
MessageRule::isModified
bool isModified() const
Definition: MessageFile.cpp:107
MessageRule::setComment
void setComment(const QString &comment)
Definition: MessageFile.cpp:37
MessageFile::myMaps
QList< CREMapInformation * > myMaps
Definition: MessageFile.h:103
MessageRule
Definition: MessageFile.h:13
MessageRule::setMessages
void setMessages(const QStringList &messages)
Definition: MessageFile.cpp:82
MessageRule::comment
const QString & comment() const
Definition: MessageFile.cpp:32