From 6163f607c0fc1e417e42461c1bdd8a807338fccf Mon Sep 17 00:00:00 2001 From: stelar7 Date: Mon, 3 Apr 2023 18:50:11 +0200 Subject: [PATCH] AK: Add to_string() for IPv4Address --- AK/IPv4Address.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/AK/IPv4Address.h b/AK/IPv4Address.h index 066900c0c09..32b76e217df 100644 --- a/AK/IPv4Address.h +++ b/AK/IPv4Address.h @@ -17,6 +17,7 @@ # include #else # include +# include #endif namespace AK { @@ -82,6 +83,15 @@ public: octet(SubnetClass::B), octet(SubnetClass::A)); } + + ErrorOr to_string() const + { + return String::formatted("{}.{}.{}.{}", + octet(SubnetClass::A), + octet(SubnetClass::B), + octet(SubnetClass::C), + octet(SubnetClass::D)); + } #endif static Optional from_string(StringView string)