ladybird/Userland/Libraries/LibDiff/Format.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

23 lines
548 B
C++

/*
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "Format.h"
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/Vector.h>
namespace Diff {
String generate_only_additions(const String& text)
{
auto lines = text.split('\n', true); // Keep empty
StringBuilder builder;
builder.appendf("@@ -0,0 +1,%zu @@\n", lines.size());
for (const auto& line : lines) {
builder.appendf("+%s\n", line.characters());
}
return builder.to_string();
}
};