openPilotLog
UserInput.h
1 #ifndef __USERINPUT_H__
2 #define __USERINPUT_H__
3 
4 #include <QPair>
5 #include <QString>
6 #include <QBitArray>
7 #include <QMap>
8 #include <QStringList>
9 #include <algorithm>
10 
11 namespace experimental {
12 
13 using EntryData = QMap<QString, QString>;
14 
25 class UserInput {
26 private:
27  const EntryData data;
28 public:
29  const enum class MetaTag {Pilot, Flight, Aircraft} meta_tag;
30 
31 public:
32  UserInput() = delete;
33  explicit
34  UserInput(EntryData new_data, MetaTag tag)
35  : data(new_data), meta_tag(tag) {}
36 
37  QString only(QString data_type) const { return data.value(data_type); }
38  const EntryData& all() const { return data; }
39 };
40 
41 UserInput newPilotInput(EntryData ed) { return UserInput(ed, UserInput::MetaTag::Pilot); }
42 UserInput newFlightInput(EntryData ed) { return UserInput(ed, UserInput::MetaTag::Flight); }
43 UserInput newAircraftInput(EntryData ed) { return UserInput(ed, UserInput::MetaTag::Aircraft); }
44 
45 }
46 
47 #endif
Flight
Definition: flight.h:28
experimental
Temporary namespace for experimental features. Will be removed in later versions.
Definition: aaircraftentry.cpp:20
experimental::UserInput
The EntryData struct. Contains ALL possible data. However depending on who is constructing it,...
Definition: UserInput.h:25
Aircraft
The aircraft class.
Definition: aircraft.h:28
Pilot
Definition: pilot.h:24