mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:07:44 +00:00
LibWeb: Move is_basic_latin() to Blob.{cpp,h}
This method needs to be accessible from both Blob and File.
This commit is contained in:
parent
ad060befad
commit
73aec263b1
3 changed files with 10 additions and 9 deletions
|
@ -96,6 +96,15 @@ ErrorOr<ByteBuffer> process_blob_parts(Vector<BlobPart> const& blob_parts, Optio
|
|||
return bytes;
|
||||
}
|
||||
|
||||
bool is_basic_latin(StringView view)
|
||||
{
|
||||
for (auto code_point : view) {
|
||||
if (code_point < 0x0020 || code_point > 0x007E)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Blob::Blob(ByteBuffer byte_buffer, String type)
|
||||
: m_byte_buffer(move(byte_buffer))
|
||||
, m_type(move(type))
|
||||
|
|
|
@ -28,6 +28,7 @@ struct BlobPropertyBag {
|
|||
|
||||
[[nodiscard]] ErrorOr<String> convert_line_endings_to_native(String const& string);
|
||||
[[nodiscard]] ErrorOr<ByteBuffer> process_blob_parts(Vector<BlobPart> const& blob_parts, Optional<BlobPropertyBag> const& options = {});
|
||||
[[nodiscard]] bool is_basic_latin(StringView view);
|
||||
|
||||
class Blob
|
||||
: public RefCounted<Blob>
|
||||
|
|
|
@ -8,15 +8,6 @@
|
|||
|
||||
namespace Web::FileAPI {
|
||||
|
||||
static bool is_basic_latin(StringView view)
|
||||
{
|
||||
for (auto code_point : view) {
|
||||
if (code_point < 0x0020 || code_point > 0x007E)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
File::File(ByteBuffer byte_buffer, String file_name, String type, i64 last_modified)
|
||||
: Blob(move(byte_buffer), move(type))
|
||||
, m_name(move(file_name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue