mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:17:44 +00:00
GameOfLife: Replace DeprecatedString with String
This commit is contained in:
parent
e3cd789ea8
commit
9cd3477763
3 changed files with 99 additions and 100 deletions
|
@ -6,15 +6,14 @@
|
|||
*/
|
||||
|
||||
#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)
|
||||
Pattern::Pattern(Vector<String>&& pattern)
|
||||
: m_pattern(move(pattern))
|
||||
{
|
||||
m_pattern = move(pattern);
|
||||
}
|
||||
|
||||
void Pattern::set_action(GUI::Action* action)
|
||||
|
@ -24,13 +23,13 @@ void Pattern::set_action(GUI::Action* action)
|
|||
|
||||
void Pattern::rotate_clockwise()
|
||||
{
|
||||
Vector<DeprecatedString> rotated;
|
||||
for (size_t i = 0; i < m_pattern.first().length(); i++) {
|
||||
Vector<String> rotated;
|
||||
for (size_t i = 0; i < m_pattern.first().bytes_as_string_view().length(); i++) {
|
||||
StringBuilder builder;
|
||||
for (int j = m_pattern.size() - 1; j >= 0; j--) {
|
||||
builder.append(m_pattern.at(j).substring(i, 1));
|
||||
builder.append(m_pattern.at(j).bytes_as_string_view().substring_view(i, 1));
|
||||
}
|
||||
rotated.append(builder.to_deprecated_string());
|
||||
rotated.append(MUST(builder.to_string()));
|
||||
}
|
||||
m_pattern = move(rotated);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue