/src/serenity/Userland/Libraries/LibWeb/EntriesAPI/FileSystemEntry.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/Bindings/PlatformObject.h> |
10 | | |
11 | | namespace Web::EntriesAPI { |
12 | | |
13 | | enum class EntryType { |
14 | | File, |
15 | | Directory, |
16 | | }; |
17 | | |
18 | | class FileSystemEntry final : public Bindings::PlatformObject { |
19 | | WEB_PLATFORM_OBJECT(FileSystemEntry, Bindings::PlatformObject); |
20 | | JS_DECLARE_ALLOCATOR(FileSystemEntry); |
21 | | |
22 | | public: |
23 | | static JS::NonnullGCPtr<FileSystemEntry> create(JS::Realm&, EntryType entry_type, ByteString name); |
24 | 0 | virtual ~FileSystemEntry() override = default; |
25 | | |
26 | | bool is_file() const; |
27 | | bool is_directory() const; |
28 | | ByteString name() const; |
29 | | |
30 | | private: |
31 | | FileSystemEntry(JS::Realm&, EntryType entry_type, ByteString name); |
32 | | |
33 | | virtual void initialize(JS::Realm&) override; |
34 | | |
35 | | EntryType m_entry_type; |
36 | | ByteString m_name; |
37 | | }; |
38 | | |
39 | | } |