6 #ifndef SWIFT_MISC_NETWORK_SERVER_H
7 #define SWIFT_MISC_NETWORK_SERVER_H
24 namespace swift::misc::network
33 IndexName = CPropertyIndexRef::GlobalIndexCServer,
40 IndexIsAcceptingConnections,
42 IndexServerTypeAsString
57 static const QList<int> &allServerTypes();
60 static const QString &serverTypeToString(ServerType server);
66 CServer(
const QString &name,
const QString &description,
const QString &address,
int port,
const CUser &user,
68 bool isAcceptingConnections =
true);
71 CServer(
const QString &address,
int port,
const CUser &user);
83 void setAddress(
const QString &address);
92 const QString &
getName()
const {
return m_name; }
95 bool hasName()
const {
return !m_name.isEmpty(); }
98 void setName(
const QString &name);
101 bool matchesName(
const QString &name)
const;
104 bool matchesAddressPort(
const CServer &server)
const;
107 bool matchesAddress(
const QString &address)
const;
113 void setDescription(
const QString &description);
125 bool setEcosystem(
const CEcosystem &ecosystem);
134 bool isValidForLogin()
const;
137 bool hasAddressAndPort()
const;
148 m_fsdSetup.addSendReceiveDetails(sendReceive);
154 m_fsdSetup.removeSendReceiveDetails(sendReceive);
158 bool isFsdServer()
const;
161 bool setServerType(ServerType serverType);
167 bool hasUnspecifiedServerType()
const;
170 const QString &getServerTypeAsString()
const;
182 bool isConnected()
const;
191 QString getServerSessionId(
bool onlyConnected)
const;
203 QString convertToQString(
bool i18n =
false)
const;
206 static const CServer &fscFsdServer();
209 static const CServer &esTowerView();
213 QString m_description;
218 int m_serverType =
static_cast<int>(Unspecified);
219 bool m_isAcceptingConnections =
true;
Non-owning reference to a CPropertyIndex with a subset of its features.
Status messages, e.g. from Core -> GUI.
Mix of the most commonly used mixin classes.
ColumnIndex
Base class enums.
Ecosystem of server belonging together.
Value object for a FSD setup.
Value object encapsulating information of a server.
void markAsDisconnected()
Mark as diconnected.
QDateTime getConnectedSince() const
Connected since.
const QString & getDescription() const
Get description.
bool hasName() const
Has name?
void addSendReceiveDetails(CFsdSetup::SendReceiveDetails sendReceive)
Add send / receive details.
int getPort() const
Get port.
const QString & getName() const
Get name.
const CFsdSetup & getFsdSetup() const
Get FSD setup.
void setIsAcceptingConnections(bool value)
Set whether server is accepting connections (allows to disable server temporarily or generally)
void setUser(const CUser &user)
Set user.
const QString & getAddress() const
Get address.
void setPort(int port)
Set port.
const CEcosystem & getEcosystem() const
Get the ecosystem.
void removeSendReceiveDetails(CFsdSetup::SendReceiveDetails sendReceive)
Remove send / receive details.
CServer()
Default constructor.
bool isAcceptingConnections() const
Server is accepting connections (allows to disable server temporarily or generally)
const CUser & getUser() const
Get user.
void setConnectedSinceNow()
Mark as connected since now.
ServerType getServerType() const
Get server type.
void setFsdSetup(const CFsdSetup &setup)
Set FSD setup.
Value object encapsulating information of a user.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...