/* * Copyright (C) 2022 Riyyi * * SPDX-License-Identifier: MIT */ #pragma once #include // size_t #include #include #include "util/genericlexer.h" namespace Util::Format { class Builder; class Parser final : public GenericLexer { public: enum class ArgumentIndexingMode { Automatic, // {} ,{} Manual, // {0},{1} }; Parser(std::string_view format, size_t parameterCount); virtual ~Parser(); void checkFormatParameterConsistency(); std::string_view consumeLiteral(); std::optional consumeIndex(); size_t stringToNumber(std::string_view value); private: ArgumentIndexingMode m_mode { ArgumentIndexingMode::Automatic }; size_t m_parameterCount { 0 }; }; } // namespace Util::Format