mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCore: Move LogStream::operator<< overloads into cpp files
This commit is contained in:
parent
2a41bff329
commit
3866e0d4d4
Notes:
sideshowbarker
2024-07-19 09:19:48 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3866e0d4d40
9 changed files with 54 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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&);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ OBJS = \
|
|||
DateTime.o \
|
||||
IODevice.o \
|
||||
File.o \
|
||||
SocketAddress.o \
|
||||
Socket.o \
|
||||
LocalSocket.o \
|
||||
LocalServer.o \
|
||||
|
|
|
@ -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 << '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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&);
|
||||
|
||||
}
|
||||
|
|
36
Libraries/LibCore/SocketAddress.cpp
Normal file
36
Libraries/LibCore/SocketAddress.cpp
Normal file
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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&);
|
||||
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue