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
29
namespace
nasal
30
{
31
class
Hash;
// forward declaration
32
};
33
34
namespace
flightgear
35
{
36
37
namespace
addons
38
{
39
40
enum class
ContactType
{
41
author
,
42
maintainer
43
};
44
45
// Class used to store info about an author or maintainer (possibly also a
46
// mailing-list, things like that)
47
class
Contact
:
public
SGReferenced
48
{
49
public
:
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
68
private
:
69
const
ContactType
_type;
70
std::string _name;
71
std::string _email;
72
std::string _url;
73
};
74
75
class
Author
:
public
Contact
76
{
77
public
:
78
Author
(std::string
name
, std::string email =
""
, std::string url =
""
);
79
80
static
void
setupGhost
(nasal::Hash& addonsModule);
81
};
82
83
class
Maintainer
:
public
Contact
84
{
85
public
:
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
95
template
<
typename
T>
96
struct
contact_traits
;
97
98
template
<>
99
struct
contact_traits
<
Author
>
100
{
101
using
contact_type
=
Author
;
102
using
strong_ref
=
AuthorRef
;
103
104
static
std::string
xmlNodeName
()
105
{
106
return
"author"
;
107
}
108
};
109
110
template
<>
111
struct
contact_traits
<
Maintainer
>
112
{
113
using
contact_type
=
Maintainer
;
114
using
strong_ref
=
MaintainerRef
;
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
addon_fwd.hxx
flightgear::addons::Author
Definition
contacts.hxx:76
flightgear::addons::Author::setupGhost
static void setupGhost(nasal::Hash &addonsModule)
Definition
contacts.cxx:104
flightgear::addons::Author::Author
Author(std::string name, std::string email="", std::string url="")
Definition
contacts.cxx:99
flightgear::addons::Contact::setName
void setName(const std::string &name)
Definition
contacts.cxx:71
flightgear::addons::Contact::getName
std::string getName() const
Definition
contacts.cxx:68
flightgear::addons::Contact::setUrl
void setUrl(const std::string &url)
Definition
contacts.cxx:83
flightgear::addons::Contact::getEmail
std::string getEmail() const
Definition
contacts.cxx:74
flightgear::addons::Contact::~Contact
virtual ~Contact()=default
flightgear::addons::Contact::Contact
Contact(ContactType type, std::string name, std::string email="", std::string url="")
Definition
contacts.cxx:44
flightgear::addons::Contact::getTypeString
std::string getTypeString() const
Definition
contacts.cxx:54
flightgear::addons::Contact::setEmail
void setEmail(const std::string &email)
Definition
contacts.cxx:77
flightgear::addons::Contact::getUrl
std::string getUrl() const
Definition
contacts.cxx:80
flightgear::addons::Contact::setupGhost
static void setupGhost(nasal::Hash &addonsModule)
Definition
contacts.cxx:87
flightgear::addons::Contact::getType
ContactType getType() const
Definition
contacts.cxx:51
flightgear::addons::Maintainer
Definition
contacts.hxx:84
flightgear::addons::Maintainer::setupGhost
static void setupGhost(nasal::Hash &addonsModule)
Definition
contacts.cxx:119
flightgear::addons::Maintainer::Maintainer
Maintainer(std::string name, std::string email="", std::string url="")
Definition
contacts.cxx:114
flightgear::addons::AuthorRef
SGSharedPtr< Author > AuthorRef
Definition
addon_fwd.hxx:49
flightgear::addons::ContactType
ContactType
Definition
contacts.hxx:40
flightgear::addons::UrlType::author
@ author
Definition
Addon.hxx:46
flightgear::addons::UrlType::maintainer
@ maintainer
Definition
Addon.hxx:47
flightgear::addons::MaintainerRef
SGSharedPtr< Maintainer > MaintainerRef
Definition
addon_fwd.hxx:50
flightgear
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition
Addon.cxx:53
flightgear::name
const char * name
Definition
subsystemFactory.cxx:307
nasal
Definition
contacts.hxx:30
flightgear::addons::contact_traits< Author >::contact_type
Author contact_type
Definition
contacts.hxx:101
flightgear::addons::contact_traits< Author >::xmlNodeName
static std::string xmlNodeName()
Definition
contacts.hxx:104
flightgear::addons::contact_traits< Author >::strong_ref
AuthorRef strong_ref
Definition
contacts.hxx:102
flightgear::addons::contact_traits< Maintainer >::strong_ref
MaintainerRef strong_ref
Definition
contacts.hxx:114
flightgear::addons::contact_traits< Maintainer >::contact_type
Maintainer contact_type
Definition
contacts.hxx:113
flightgear::addons::contact_traits< Maintainer >::xmlNodeName
static std::string xmlNodeName()
Definition
contacts.hxx:116
flightgear::addons::contact_traits
Definition
contacts.hxx:96
src
Add-ons
contacts.hxx
Generated on Tue Jun 3 2025 12:58:36 for FlightGear by
1.13.2