serenity/AK/FormatParser.h
kleines Filmröllchen 606963bfa2 AK: Move FormatParser to a new header
Since it was intentionally removed from Format.h to untangle
dependencies, this is a new small header that can be included by anyone
needing custom format parsing.
2024-07-04 22:17:11 +02:00

28 lines
557 B
C++

/*
* Copyright (c) 2024, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/GenericLexer.h>
namespace AK {
class FormatParser : public GenericLexer {
public:
struct FormatSpecifier {
StringView flags;
size_t index;
};
explicit FormatParser(StringView input);
StringView consume_literal();
bool consume_number(size_t& value);
bool consume_specifier(FormatSpecifier& specifier);
bool consume_replacement_field(size_t& index);
};
}