diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-15 00:44:02 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-15 00:58:52 +0100 |
commit | 3866e0d4d4026a58e2577f6651e8796182d16a0e (patch) | |
tree | 8357514b67616888a814fc155a049edbb85baf84 | |
parent | 2a41bff32947f69facccd16278491d9853543e47 (diff) | |
download | serenity-3866e0d4d4026a58e2577f6651e8796182d16a0e.zip |
LibCore: Move LogStream::operator<< overloads into cpp files
-rw-r--r-- | Libraries/LibCore/DateTime.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibCore/DateTime.h | 7 | ||||
-rw-r--r-- | Libraries/LibCore/Makefile | 1 | ||||
-rw-r--r-- | Libraries/LibCore/Object.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibCore/Object.h | 5 | ||||
-rw-r--r-- | Libraries/LibCore/SocketAddress.cpp | 36 | ||||
-rw-r--r-- | Libraries/LibCore/SocketAddress.h | 5 | ||||
-rw-r--r-- | Userland/date.cpp | 1 | ||||
-rw-r--r-- | Userland/stat.cpp | 1 |
9 files changed, 54 insertions, 13 deletions
diff --git a/Libraries/LibCore/DateTime.cpp b/Libraries/LibCore/DateTime.cpp index cb2aadba6a..dac6bbd226 100644 --- a/Libraries/LibCore/DateTime.cpp +++ b/Libraries/LibCore/DateTime.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <AK/String.h> #include <LibCore/DateTime.h> #include <sys/time.h> #include <time.h> @@ -55,4 +56,9 @@ String DateTime::to_string() const return String::format("%04u-%02u-%02u %02u:%02u:%02u", m_year, m_month, m_day, m_hour, m_minute, m_day); } +const LogStream& operator<<(const LogStream& stream, const DateTime& value) +{ + return stream << value.to_string(); +} + } diff --git a/Libraries/LibCore/DateTime.h b/Libraries/LibCore/DateTime.h index 44c9394017..a27a04c2d9 100644 --- a/Libraries/LibCore/DateTime.h +++ b/Libraries/LibCore/DateTime.h @@ -26,7 +26,7 @@ #pragma once -#include <AK/String.h> +#include <AK/Forward.h> #include <time.h> namespace Core { @@ -58,9 +58,6 @@ private: unsigned m_second { 0 }; }; -inline const LogStream& operator<<(const LogStream& stream, const DateTime& value) -{ - return stream << value.to_string(); -} +const LogStream& operator<<(const LogStream&, const DateTime&); } diff --git a/Libraries/LibCore/Makefile b/Libraries/LibCore/Makefile index 4c15f64885..10557fe393 100644 --- a/Libraries/LibCore/Makefile +++ b/Libraries/LibCore/Makefile @@ -3,6 +3,7 @@ OBJS = \ DateTime.o \ IODevice.o \ File.o \ + SocketAddress.o \ Socket.o \ LocalSocket.o \ LocalServer.o \ diff --git a/Libraries/LibCore/Object.cpp b/Libraries/LibCore/Object.cpp index 87b1f7c5d3..b22c2df561 100644 --- a/Libraries/LibCore/Object.cpp +++ b/Libraries/LibCore/Object.cpp @@ -205,4 +205,9 @@ bool Object::is_visible_for_timer_purposes() const return true; } +const LogStream& operator<<(const LogStream& stream, const Object& object) +{ + return stream << object.class_name() << '{' << &object << '}'; +} + } diff --git a/Libraries/LibCore/Object.h b/Libraries/LibCore/Object.h index 60bf0a7628..b76b7ff7cd 100644 --- a/Libraries/LibCore/Object.h +++ b/Libraries/LibCore/Object.h @@ -166,9 +166,6 @@ inline void Object::for_each_child_of_type(Callback callback) }); } -inline const LogStream& operator<<(const LogStream& stream, const Object& object) -{ - return stream << object.class_name() << '{' << &object << '}'; -} +const LogStream& operator<<(const LogStream&, const Object&); } diff --git a/Libraries/LibCore/SocketAddress.cpp b/Libraries/LibCore/SocketAddress.cpp new file mode 100644 index 0000000000..d4d451a150 --- /dev/null +++ b/Libraries/LibCore/SocketAddress.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <LibCore/SocketAddress.h> + +namespace Core { + +const LogStream& operator<<(const LogStream& stream, const SocketAddress& value) +{ + return stream << value.to_string(); +} + +} diff --git a/Libraries/LibCore/SocketAddress.h b/Libraries/LibCore/SocketAddress.h index 3c0bfcf482..7b0868e7d8 100644 --- a/Libraries/LibCore/SocketAddress.h +++ b/Libraries/LibCore/SocketAddress.h @@ -108,9 +108,6 @@ private: String m_local_address; }; -inline const LogStream& operator<<(const LogStream& stream, const SocketAddress& value) -{ - return stream << value.to_string(); -} +const LogStream& operator<<(const LogStream&, const SocketAddress&); } diff --git a/Userland/date.cpp b/Userland/date.cpp index 7122cfa76d..aec24f4ee3 100644 --- a/Userland/date.cpp +++ b/Userland/date.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <AK/String.h> #include <LibCore/DateTime.h> #include <stdio.h> #include <string.h> diff --git a/Userland/stat.cpp b/Userland/stat.cpp index e645ece153..cd5c9085ec 100644 --- a/Userland/stat.cpp +++ b/Userland/stat.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <AK/String.h> #include <LibCore/DateTime.h> #include <grp.h> #include <pwd.h> |