mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:27:46 +00:00
LibCore: Move Stream-based file into the Core
namespace
This commit is contained in:
parent
a96339b72b
commit
606a3982f3
218 changed files with 748 additions and 643 deletions
|
@ -84,7 +84,7 @@ void AbstractThemePreview::set_theme(Core::AnonymousBuffer const& theme_buffer)
|
|||
set_preview_palette(m_preview_palette);
|
||||
}
|
||||
|
||||
ErrorOr<void> AbstractThemePreview::set_theme_from_file(StringView path, NonnullOwnPtr<Core::Stream::File> file)
|
||||
ErrorOr<void> AbstractThemePreview::set_theme_from_file(StringView path, NonnullOwnPtr<Core::File> file)
|
||||
{
|
||||
auto config_file = TRY(Core::ConfigFile::open(path, move(file)));
|
||||
auto theme = TRY(Gfx::load_system_theme(config_file));
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
Gfx::Palette const& preview_palette() const { return m_preview_palette; }
|
||||
void set_preview_palette(Gfx::Palette const&);
|
||||
ErrorOr<void> set_theme_from_file(StringView path, NonnullOwnPtr<Core::Stream::File>);
|
||||
ErrorOr<void> set_theme_from_file(StringView path, NonnullOwnPtr<Core::File>);
|
||||
void set_theme(Core::AnonymousBuffer const&);
|
||||
|
||||
void paint_window(StringView title, Gfx::IntRect const& rect, Gfx::WindowTheme::WindowState, Gfx::Bitmap const& icon, int button_count = 3);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <AK/JsonObject.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibGUI/CommonLocationsProvider.h>
|
||||
|
@ -42,7 +43,7 @@ static void initialize_if_needed()
|
|||
|
||||
ErrorOr<void> CommonLocationsProvider::load_from_json(StringView json_path)
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open(json_path, Core::Stream::OpenMode::Read));
|
||||
auto file = TRY(Core::File::open(json_path, Core::File::OpenMode::Read));
|
||||
auto json = JsonValue::from_string(TRY(file->read_until_eof()));
|
||||
if (json.is_error())
|
||||
return Error::from_string_literal("File is not a valid JSON");
|
||||
|
|
|
@ -1460,12 +1460,12 @@ void TextEditor::timer_event(Core::TimerEvent&)
|
|||
|
||||
ErrorOr<void> TextEditor::write_to_file(StringView path)
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Write | Core::Stream::OpenMode::Truncate));
|
||||
auto file = TRY(Core::File::open(path, Core::File::OpenMode::Write | Core::File::OpenMode::Truncate));
|
||||
TRY(write_to_file(*file));
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> TextEditor::write_to_file(Core::Stream::File& file)
|
||||
ErrorOr<void> TextEditor::write_to_file(Core::File& file)
|
||||
{
|
||||
off_t file_size = 0;
|
||||
if (line_count() == 1 && line(0).is_empty()) {
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
void insert_at_cursor_or_replace_selection(StringView);
|
||||
void replace_all_text_without_resetting_undo_stack(StringView text);
|
||||
ErrorOr<void> write_to_file(StringView path);
|
||||
ErrorOr<void> write_to_file(Core::Stream::File&);
|
||||
ErrorOr<void> write_to_file(Core::File&);
|
||||
bool has_selection() const { return m_selection.is_valid(); }
|
||||
DeprecatedString selected_text() const;
|
||||
size_t number_of_words() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue