mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 04:15:23 +03:00
57dc179b1f
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
37 lines
862 B
C++
37 lines
862 B
C++
/*
|
|
* Copyright (c) 2021, Ryan Wilson <ryan@rdwilson.xyz>
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include "Pattern.h"
|
|
#include <AK/DeprecatedString.h>
|
|
#include <AK/StringBuilder.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibGUI/Action.h>
|
|
#include <stdio.h>
|
|
|
|
Pattern::Pattern(Vector<DeprecatedString> pattern)
|
|
{
|
|
m_pattern = move(pattern);
|
|
}
|
|
|
|
void Pattern::set_action(GUI::Action* action)
|
|
{
|
|
m_action = action;
|
|
}
|
|
|
|
void Pattern::rotate_clockwise()
|
|
{
|
|
Vector<DeprecatedString> rotated;
|
|
for (size_t i = 0; i < m_pattern.first().length(); i++) {
|
|
StringBuilder builder;
|
|
for (int j = m_pattern.size() - 1; j >= 0; j--) {
|
|
builder.append(m_pattern.at(j).substring(i, 1));
|
|
}
|
|
rotated.append(builder.to_deprecated_string());
|
|
}
|
|
m_pattern = move(rotated);
|
|
}
|