PLCnext API Documentation 25.0.2.69
IpAddress.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8
9namespace Arp { namespace System { namespace Commons { namespace Net
10{
11
14{
15public: // usings
18
19public: // construction/destruction
21 IpAddress(void) = default;
22 IpAddress(uint32 ip4address);
24 IpAddress(const IpAddress& arg) = default;
26 IpAddress& operator=(const IpAddress& arg) = default;
28 ~IpAddress(void) = default;
29
30public: // operators
31 void operator=(Arp::uint32 ip4Address);
32
33public: // static properties
34 static IpAddress Empty;
35
36public: // static operations
37 static IpAddress Parse(const String& input);
38 static bool TryParse(const String& input, IpAddress& result);
39
40public: // setter/getter operations
41 bool IsEmpty(void)const;
42 IpV4Value GetHostValue(void)const;
43 IpV4Value GetNetworkValue(void)const;
44
45public: // operations
46 String ToString(void)const;
47
48public: // deprecated operations
49 ARP_DEPRECATED("Use IpAddress::GetNetworkValue() instead.")
50 IpV4Value GetIpv4Value(void)const;
51
52private: // static methods
53 static bool IsLocalhostString(const String& input);
54
55private: // fields
56 IpV4Value ipV4Value = 0;
57
58private: // static fields
59 static const char* localhostString1;
60 static const char* localhostString2;
61 static const char* localhostString3;
62 static const char* localhostAddress;
63};
64
65std::ostream& operator<<(std::ostream& os, const IpAddress& ipAddress);
66std::istream& operator>>(std::istream& is, IpAddress& ipAddress);
67
68}}}} // end of namespace Arp::System::Commons::Net
69
70template<> struct fmt::formatter<Arp::System::Commons::Net::IpAddress>: public fmt::ostream_formatter {};
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
Unified representation for ip address schemes.
Definition: IpAddress.hpp:14
IpAddress & operator=(const IpAddress &arg)=default
Assignment operator.
~IpAddress(void)=default
Destructs this instance and frees all resources.
static bool TryParse(const String &input, IpAddress &result)
Tries to parse an address from string based representation.
Definition: IpAddress.cpp:110
static IpAddress Parse(const String &input)
Parses an ip address from string bases representation, e.g. "127.0.0.1".
Definition: IpAddress.cpp:95
IpV4Value GetIpv4Value(void) const
Returns the ip address in IPv4 address scheme.
Definition: IpAddress.cpp:40
IpV4Value GetNetworkValue(void) const
Gets the IP value in network endianess (big endian).
Definition: IpAddress.cpp:63
IpAddress(void)=default
Constructs an IpAddress instance.
IpAddress(const IpAddress &arg)=default
Copy constructor.
uint32 IpV4Value
Value-type-definition for ip addresses using version 4 scheme.
Definition: IpAddress.hpp:17
bool IsEmpty(void) const
Determines if this instance is empty, e.g. the address value is zero.
Definition: IpAddress.cpp:32
IpV4Value GetHostValue(void) const
Gets the IP value in host endianess.
Definition: IpAddress.cpp:48
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38
Namespace of fmtlib.
Definition: BasicFormatter.hxx:107
Namespace of the C++ standard library