mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 15:57:36 +00:00
AK+Everywhere: Stop including Vector.h from StringView.h
Preparation for using Error.h from Vector.h. This required moving some things out of line.
This commit is contained in:
parent
e52f987020
commit
5f7d008791
27 changed files with 88 additions and 51 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "Format.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace Diff {
|
||||
String generate_only_additions(const String& text)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Size.h>
|
||||
|
||||
|
|
|
@ -311,6 +311,30 @@ Optional<Color> Color::from_string(StringView const& string)
|
|||
return Color(r.value(), g.value(), b.value(), a.value());
|
||||
}
|
||||
|
||||
Vector<Color> Color::shades(u32 steps, float max) const
|
||||
{
|
||||
float shade = 1.f;
|
||||
float step = max / steps;
|
||||
Vector<Color> shades;
|
||||
for (u32 i = 0; i < steps; i++) {
|
||||
shade -= step;
|
||||
shades.append(this->darkened(shade));
|
||||
}
|
||||
return shades;
|
||||
}
|
||||
|
||||
Vector<Color> Color::tints(u32 steps, float max) const
|
||||
{
|
||||
float shade = 1.f;
|
||||
float step = max / steps;
|
||||
Vector<Color> tints;
|
||||
for (u32 i = 0; i < steps; i++) {
|
||||
shade += step;
|
||||
tints.append(this->lightened(shade));
|
||||
}
|
||||
return tints;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool IPC::encode(IPC::Encoder& encoder, Color const& color)
|
||||
|
|
|
@ -242,29 +242,8 @@ public:
|
|||
return Color(min(255, (int)((float)red() * amount)), min(255, (int)((float)green() * amount)), min(255, (int)((float)blue() * amount)), alpha());
|
||||
}
|
||||
|
||||
Vector<Color> shades(u32 steps, float max = 1.f) const
|
||||
{
|
||||
float shade = 1.f;
|
||||
float step = max / steps;
|
||||
Vector<Color> shades;
|
||||
for (u32 i = 0; i < steps; i++) {
|
||||
shade -= step;
|
||||
shades.append(this->darkened(shade));
|
||||
}
|
||||
return shades;
|
||||
}
|
||||
|
||||
Vector<Color> tints(u32 steps, float max = 1.f) const
|
||||
{
|
||||
float shade = 1.f;
|
||||
float step = max / steps;
|
||||
Vector<Color> tints;
|
||||
for (u32 i = 0; i < steps; i++) {
|
||||
shade += step;
|
||||
tints.append(this->lightened(shade));
|
||||
}
|
||||
return tints;
|
||||
}
|
||||
Vector<Color> shades(u32 steps, float max = 1.f) const;
|
||||
Vector<Color> tints(u32 steps, float max = 1.f) const;
|
||||
|
||||
constexpr Color inverted() const
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Filters/FastBoxBlurFilter.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
|
||||
namespace JS {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "ParsedCookie.h"
|
||||
#include <AK/Function.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibIPC/Decoder.h>
|
||||
|
@ -280,12 +281,12 @@ Optional<Core::DateTime> parse_date_time(StringView date_string)
|
|||
return to_uint(token, year);
|
||||
};
|
||||
|
||||
auto is_delimeter = [](char ch) {
|
||||
Function<bool(char)> is_delimiter = [](char ch) {
|
||||
return ch == 0x09 || (ch >= 0x20 && ch <= 0x2f) || (ch >= 0x3b && ch <= 0x40) || (ch >= 0x5b && ch <= 0x60) || (ch >= 0x7b && ch <= 0x7e);
|
||||
};
|
||||
|
||||
// 1. Using the grammar below, divide the cookie-date into date-tokens.
|
||||
Vector<StringView> date_tokens = date_string.split_view_if(is_delimeter);
|
||||
Vector<StringView> date_tokens = date_string.split_view_if(is_delimiter);
|
||||
|
||||
// 2. Process each date-token sequentially in the order the date-tokens appear in the cookie-date.
|
||||
bool found_time = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue