Use in-class member initializers
This commit is contained in:
parent
77dcd712fb
commit
50d86e4755
@ -232,14 +232,6 @@ public:
|
||||
ConnectionFailed = 1001 //!< Connection with server failed
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// Constructs an empty response.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the value of a field
|
||||
///
|
||||
@ -336,9 +328,9 @@ public:
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
FieldTable m_fields; //!< Fields of the header
|
||||
Status m_status; //!< Status code
|
||||
unsigned int m_majorVersion; //!< Major HTTP version
|
||||
unsigned int m_minorVersion; //!< Minor HTTP version
|
||||
Status m_status{Status::ConnectionFailed}; //!< Status code
|
||||
unsigned int m_majorVersion{0}; //!< Major HTTP version
|
||||
unsigned int m_minorVersion{0}; //!< Minor HTTP version
|
||||
std::string m_body; //!< Body of the response
|
||||
};
|
||||
|
||||
@ -420,7 +412,7 @@ private:
|
||||
TcpSocket m_connection; //!< Connection to the host
|
||||
std::optional<IpAddress> m_host; //!< Web host address
|
||||
std::string m_hostName; //!< Web host name
|
||||
unsigned short m_port; //!< Port used for connection with host
|
||||
unsigned short m_port{0}; //!< Port used for connection with host
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -433,9 +433,9 @@ private:
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::vector<char> m_data; //!< Data stored in the packet
|
||||
std::size_t m_readPos; //!< Current reading position in the packet
|
||||
std::size_t m_sendPos; //!< Current send position in the packet (for handling partial sends)
|
||||
bool m_isValid; //!< Reading state of the packet
|
||||
std::size_t m_readPos{0}; //!< Current reading position in the packet
|
||||
std::size_t m_sendPos{0}; //!< Current send position in the packet (for handling partial sends)
|
||||
bool m_isValid{true}; //!< Reading state of the packet
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -184,7 +184,7 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
Type m_type; //!< Type of the socket (TCP or UDP)
|
||||
SocketHandle m_socket; //!< Socket descriptor
|
||||
bool m_isBlocking; //!< Current blocking mode of the socket
|
||||
bool m_isBlocking{true}; //!< Current blocking mode of the socket
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -219,10 +219,8 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
struct PendingPacket
|
||||
{
|
||||
PendingPacket();
|
||||
|
||||
std::uint32_t Size; //!< Data of packet size
|
||||
std::size_t SizeReceived; //!< Number of size bytes received so far
|
||||
std::uint32_t Size{0}; //!< Data of packet size
|
||||
std::size_t SizeReceived{0}; //!< Number of size bytes received so far
|
||||
std::vector<char> Data; //!< Data of the packet
|
||||
};
|
||||
|
||||
|
@ -199,7 +199,7 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::vector<char> m_buffer; //!< Temporary buffer holding the received data in Receive(Packet)
|
||||
std::vector<char> m_buffer{std::vector<char>(MaxDatagramSize)}; //!< Temporary buffer holding the received data in Receive(Packet)
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -140,12 +140,6 @@ bool Http::Request::hasField(const std::string& field) const
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Http::Response::Response() : m_status(Status::ConnectionFailed), m_majorVersion(0), m_minorVersion(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
const std::string& Http::Response::getField(const std::string& field) const
|
||||
{
|
||||
@ -292,9 +286,7 @@ void Http::Response::parseFields(std::istream& in)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Http::Http() : m_host(), m_port(0)
|
||||
{
|
||||
}
|
||||
Http::Http() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -36,9 +36,7 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet::Packet() : m_readPos(0), m_sendPos(0), m_isValid(true)
|
||||
{
|
||||
}
|
||||
Packet::Packet() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -35,7 +35,7 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Socket(Type type) : m_type(type), m_socket(priv::SocketImpl::invalidSocket()), m_isBlocking(true)
|
||||
Socket::Socket(Type type) : m_type(type), m_socket(priv::SocketImpl::invalidSocket())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -425,10 +425,4 @@ Socket::Status TcpSocket::receive(Packet& packet)
|
||||
return Status::Done;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
TcpSocket::PendingPacket::PendingPacket() : Size(0), SizeReceived(0), Data()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace sf
|
||||
|
@ -38,7 +38,7 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
UdpSocket::UdpSocket() : Socket(Type::Udp), m_buffer(MaxDatagramSize)
|
||||
UdpSocket::UdpSocket() : Socket(Type::Udp)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user