UTILLib 2.0
Common C++ library with utilities.
Loading...
Searching...
No Matches
stringparser.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Ingemar Hedvall
3 * SPDX-License-Identifier: MIT
4 */
10#pragma once
11
12#include <string>
13#include <vector>
14namespace util::string {
15
22 public:
23 explicit StringParser(const std::string& expression);
24 bool Parse(const std::string& text);
25
26 [[nodiscard]] bool ExistTag(
27 const std::string& tag) const;
28 [[nodiscard]] std::string GetTagValue(
29 const std::string& tag) const;
30
31 private:
32 struct ParserElement {
33 bool is_tag = false;
34 std::string name;
35 std::string value;
36 };
37 std::vector<ParserElement> element_list_;
38};
39
40} // namespace util::string
std::string GetTagValue(const std::string &tag) const
Returns the tag value.
StringParser(const std::string &expression)
Constructor.
bool ExistTag(const std::string &tag) const
Test if a tag exist.
bool Parse(const std::string &text)
Parses the string.
The string namespace is used for string manipulation functions.
Definition stringparser.h:14