Util: Add formatting and type printing capability

Extending the type compatibility is done with an easy to use API.
This commit is contained in:
Riyyi
2022-07-22 01:59:19 +02:00
parent 9b3489676e
commit 835481f4a5
8 changed files with 888 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2022 Riyyi
*
* SPDX-License-Identifier: MIT
*/
#ifndef UTIL_FORMAT_PARSER_H
#define UTIL_FORMAT_PARSER_H
#include <cstddef> // size_t
#include <string_view>
#include "util/genericlexer.h"
namespace Util::Format {
class Builder;
class Parser final : public GenericLexer {
public:
Parser(std::string_view format, size_t parameterCount);
virtual ~Parser();
void checkFormatParameterConsistency();
std::string_view consumeLiteral();
bool consumeSpecifier(std::string_view& specifier);
void applySpecifier(Builder& builder, std::string_view specifier);
private:
size_t m_parameterCount { 0 };
};
} // namespace Util::Format
#endif // UTIL_FORMAT_PARSER_H