File: qdltoptmanager.h

package info (click to toggle)
dlt-viewer 2.28.1-dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,524 kB
  • sloc: cpp: 31,907; ansic: 4,231; xml: 492; sh: 244; makefile: 81
file content (113 lines) | stat: -rw-r--r-- 2,686 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
 * @licence app begin@
 * Copyright (C) 2011-2012  BMW AG
 *
 * This file is part of COVESA Project Dlt Viewer.
 *
 * Contributions are licensed to the COVESA Alliance under one or more
 * Contribution License Agreements.
 *
 * \copyright
 * This Source Code Form is subject to the terms of the
 * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with
 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * \file optmanager.h
 * For further information see http://www.covesa.global/.
 * @licence end@
 */

#ifndef QDLTOPTMANAGER_H
#define QDLTOPTMANAGER_H

#include <QStringList>
#include <QCommandLineParser>

#include "export_rules.h"

enum e_convertionmode
{
    e_ASCI = 0,
    e_UTF8 = 1,
    e_DLT  = 2,
    e_CSV  = 3,
    e_DDLT = 4,
};

enum class e_inputmode
{
    DLT    = 0,
    STREAM = 1,
    SERIAL = 2,
};

class QDLT_EXPORT QDltOptManager
{
public:
    static QDltOptManager* getInstance();
    void printUsage(const QString& helpText);
    void printVersion(QString appname);
    void parse(const QStringList& opt);
    void freeWindowsConsole();

    bool isProjectFile();
    bool isTerminate();
    bool isConvertUTF8();
    bool issilentMode();
    bool isCommandlineMode();

    e_convertionmode get_convertionmode();
    e_inputmode get_inputmode();

    QString getProjectFile();
    QStringList getLogFiles();
    QStringList getFilterFiles();
    QString getConvertDestFile();
    QString getPluginName();
    QString getCommandName();
    QStringList getCommandParams();
    QString getWorkingDirectory() const;
    const QStringList &getPrePluginCommands() const;
    const QStringList &getPostPluginCommands() const;
    const QStringList &getPcapFiles() const;
    const QStringList &getMf4Files() const;
    char getDelimiter();
    QString getSignature();

    QString getHelpText() const;

    // only testing relevant
    void reset();

private:
    QDltOptManager();

private:
    bool project{false};
    bool terminate{false};
    bool silent_mode{false};
    bool commandline_mode{false};
    e_convertionmode convertionmode{e_ASCI};
    e_inputmode inputmode{e_inputmode::DLT};

    QString projectFile;
    QStringList logFiles;
    QStringList pcapFiles;
    QStringList mf4Files;
    QStringList filterFiles;
    QString convertDestFile;
    QString pluginName;
    QString commandName;
    QStringList commandParams;

    QStringList prePluginCommands; // command before loading log file
    QStringList postPluginCommands; // command after loading log file

    QString  workingDirectory;
    char delimiter;
    QString signature;

    QCommandLineParser m_parser;
};

#endif //QDLTOPTMANAGER_H