FlightGear next
contacts.hxx
Go to the documentation of this file.
1// -*- coding: utf-8 -*-
2//
3// contacts.hxx --- FlightGear classes holding add-on contact metadata
4// Copyright (C) 2018 Florent Rougon
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 along
17// with this program; if not, write to the Free Software Foundation, Inc.,
18// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20#ifndef FG_ADDON_CONTACTS_HXX
21#define FG_ADDON_CONTACTS_HXX
22
23#include <string>
24
25#include <simgear/structure/SGReferenced.hxx>
26
27#include "addon_fwd.hxx"
28
29namespace nasal
30{
31 class Hash; // forward declaration
32};
33
34namespace flightgear
35{
36
37namespace addons
38{
39
44
45// Class used to store info about an author or maintainer (possibly also a
46// mailing-list, things like that)
47class Contact : public SGReferenced
48{
49public:
50 Contact(ContactType type, std::string name, std::string email = "",
51 std::string url = "");
52 virtual ~Contact() = default;
53
54 ContactType getType() const;
55 std::string getTypeString() const;
56
57 std::string getName() const;
58 void setName(const std::string& name);
59
60 std::string getEmail() const;
61 void setEmail(const std::string& email);
62
63 std::string getUrl() const;
64 void setUrl(const std::string& url);
65
66 static void setupGhost(nasal::Hash& addonsModule);
67
68private:
69 const ContactType _type;
70 std::string _name;
71 std::string _email;
72 std::string _url;
73};
74
75class Author : public Contact
76{
77public:
78 Author(std::string name, std::string email = "", std::string url = "");
79
80 static void setupGhost(nasal::Hash& addonsModule);
81};
82
83class Maintainer : public Contact
84{
85public:
86 Maintainer(std::string name, std::string email = "", std::string url = "");
87
88 static void setupGhost(nasal::Hash& addonsModule);
89};
90
91// ***************************************************************************
92// * contact_traits *
93// ***************************************************************************
94
95template <typename T>
97
98template<>
100{
103
104 static std::string xmlNodeName()
105 {
106 return "author";
107 }
108};
109
110template<>
112{
115
116 static std::string xmlNodeName()
117 {
118 return "maintainer";
119 }
120};
121
122} // of namespace addons
123
124} // of namespace flightgear
125
126#endif // of FG_ADDON_CONTACTS_HXX
static void setupGhost(nasal::Hash &addonsModule)
Definition contacts.cxx:104
Author(std::string name, std::string email="", std::string url="")
Definition contacts.cxx:99
void setName(const std::string &name)
Definition contacts.cxx:71
std::string getName() const
Definition contacts.cxx:68
void setUrl(const std::string &url)
Definition contacts.cxx:83
std::string getEmail() const
Definition contacts.cxx:74
virtual ~Contact()=default
Contact(ContactType type, std::string name, std::string email="", std::string url="")
Definition contacts.cxx:44
std::string getTypeString() const
Definition contacts.cxx:54
void setEmail(const std::string &email)
Definition contacts.cxx:77
std::string getUrl() const
Definition contacts.cxx:80
static void setupGhost(nasal::Hash &addonsModule)
Definition contacts.cxx:87
ContactType getType() const
Definition contacts.cxx:51
static void setupGhost(nasal::Hash &addonsModule)
Definition contacts.cxx:119
Maintainer(std::string name, std::string email="", std::string url="")
Definition contacts.cxx:114
SGSharedPtr< Author > AuthorRef
Definition addon_fwd.hxx:49
SGSharedPtr< Maintainer > MaintainerRef
Definition addon_fwd.hxx:50
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53
const char * name