aboutsummaryrefslogtreecommitdiff
path: root/lib/mstch/src/template_type.hpp
blob: 3c5bf91e6debccd3bf017dc6caed1701ccbc9427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include <string>
#include <vector>

#include "token.hpp"
#include "utils.hpp"

namespace mstch {

class template_type {
 public:
  template_type() = default;
  template_type(const std::string& str);
  template_type(const std::string& str, const delim_type& delims);
  std::vector<token>::const_iterator begin() const { return m_tokens.begin(); }
  std::vector<token>::const_iterator end() const { return m_tokens.end(); }
  void operator<<(const token& token) { m_tokens.push_back(token); }

 private:
  std::vector<token> m_tokens;
  std::string m_open;
  std::string m_close;
  void strip_whitespace();
  void process_text(citer beg, citer end);
  void tokenize(const std::string& tmp);
  void store_prefixes(std::vector<token>::iterator beg);
};

}