mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Previously, the LibWeb bindings generator would output multiple per interface files like Prototype/Constructor/Namespace/GlobalMixin depending on the contents of that IDL file. This complicates the build system as it means that it does not know what files will be generated without knowledge of the contents of that IDL file. Instead, for each IDL file only generate a single Bindings/<IDLFile>.h and Bindings/<IDLFile>.cpp.
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/FileSystemEntry.h>
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/EntriesAPI/FileSystemEntry.h>
|
|
#include <LibWeb/HTML/Window.h>
|
|
|
|
namespace Web::EntriesAPI {
|
|
|
|
GC_DEFINE_ALLOCATOR(FileSystemEntry);
|
|
|
|
GC::Ref<FileSystemEntry> FileSystemEntry::create(JS::Realm& realm, EntryType entry_type, ByteString name)
|
|
{
|
|
return realm.create<FileSystemEntry>(realm, entry_type, name);
|
|
}
|
|
|
|
FileSystemEntry::FileSystemEntry(JS::Realm& realm, EntryType entry_type, ByteString name)
|
|
: PlatformObject(realm)
|
|
, m_entry_type(entry_type)
|
|
, m_name(name)
|
|
{
|
|
}
|
|
|
|
void FileSystemEntry::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(FileSystemEntry);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
// https://wicg.github.io/entries-api/#dom-filesystementry-isfile
|
|
bool FileSystemEntry::is_file() const
|
|
{
|
|
// The isFile getter steps are to return true if this is a file entry and false otherwise.
|
|
return m_entry_type == EntryType::File;
|
|
}
|
|
|
|
// https://wicg.github.io/entries-api/#dom-filesystementry-isdirectory
|
|
bool FileSystemEntry::is_directory() const
|
|
{
|
|
// The isDirectory getter steps are to return true if this is a directory entry and false otherwise.
|
|
return m_entry_type == EntryType::Directory;
|
|
}
|
|
|
|
// https://wicg.github.io/entries-api/#dom-filesystementry-name
|
|
ByteString FileSystemEntry::name() const
|
|
{
|
|
// The name getter steps are to return this's name.
|
|
return m_name;
|
|
}
|
|
|
|
}
|