]> SALOME platform Git repositories - modules/gui.git/blob - src/LightApp/LightApp_Msg.h
Salome HOME
[bos #42871] Clipping plane remains applied after being deleted
[modules/gui.git] / src / LightApp / LightApp_Msg.h
1 #include <QTextStream>
2 #include <QBuffer>
3 #include <QString>
4 #include <QXmlStreamReader>
5 #include <QDebug>
6 #include <QTranslator>
7 #include <QFile>
8 #include <QCoreApplication>
9 #include <QProcess>
10 #include <QDir>
11 #include <memory>
12
13 namespace LightApp_Msg
14 {
15
16 class Message
17 {
18     public:
19         Message(const QString& src, const QString& trl):source(src),translation(trl){};
20         QString GetSource() const { return source ;}
21         QString GetTranslation() const { return translation ;}
22         void Set_Source(const QString& str) { source = str; }
23         void Set_Translation(const QString& str) { translation = str; }
24     private:
25         QString source;
26         QString translation;
27 };
28
29 class Context
30 {
31     public:
32         Context(const QString& name):Context_name(name){};
33         QString GetContext_name(){return Context_name;}
34         void AddMsg(Message& msg) {Message_list.append(msg);}
35         void AddMsg(const QString& src, const QString& trl) {Message_list.append(Message(src,trl));}
36         Message* GetMessagebySrc(const QString&);
37         QList<Message>& GetMessageList(){return Message_list;}
38         QString ExportContext();
39     private:
40         QString Context_name;
41         QList<Message> Message_list;
42 };
43
44 class LightApp_Msg_handling
45 {
46 public:
47     LightApp_Msg_handling(std::unique_ptr<QList<Context>> Context_list):
48                                             Context_list(std::move(Context_list)){};
49     void read(QIODevice *device);
50     QString write();
51     Context* GetContextbyName(const QString &name);
52     bool HaveContext(const QString &name);
53 private:
54     QXmlStreamReader xmlReader;
55     std::unique_ptr<QList<Context>> Context_list;
56     QString header;
57
58     void readContext();
59     void readMessage();
60     void readSrc(Message& msg);
61     void readTranslation(Message& msg);
62 };
63
64 }