1 /*
2     Functions to manage the FormatSpecificData chain
3 
4     Copyright (C) 2005 Ron Parker and Robert Lipe.
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 
20  */
21 #ifndef FORMSPEC_H_INCLUDED_
22 #define FORMSPEC_H_INCLUDED_
23 
24 #include <QtCore/QList>  // for QList
25 
26 enum FsType {
27   kFsUnknown = 0L,
28   kFsGpx = 0x67707800L,
29   kFsAn1W = 0x616e3177L,
30   kFsAn1L = 0x616e316cL,
31   kFsAn1V = 0x616e3176L,
32   kFsOzi = 0x6f7a6900L,
33   kFsGmsd = 0x474d5344L,	/* GMSD = Garmin specific data */
34   kFsQstarzBl1000 = 0x5173747aL,
35   kFsLowranceusr4 = 0x615f234cL
36 };
37 
38 struct FormatSpecificData {
39   FormatSpecificData() = default;
FormatSpecificDataFormatSpecificData40   explicit FormatSpecificData(FsType type) : fs_type(type) {}
41   FormatSpecificData(const FormatSpecificData&) = default;
42   FormatSpecificData& operator=(const FormatSpecificData&) = default;
43   FormatSpecificData(FormatSpecificData&&) = delete;
44   FormatSpecificData& operator=(FormatSpecificData&&) = delete;
45   virtual ~FormatSpecificData() = default;
46 
47   virtual FormatSpecificData* clone() const = 0;
48 
49   FsType fs_type{kFsUnknown};
50 };
51 
52 class FormatSpecificDataList : private QList<FormatSpecificData*>
53 {
54 public:
55   FormatSpecificDataList FsChainCopy() const;
56   void FsChainDestroy();
57   FormatSpecificData* FsChainFind(FsType type) const;
58   void FsChainAdd(FormatSpecificData* data);
59 };
60 
61 #endif // FORMSPEC_H_INCLUDED_
62