Horizon Official Technical Documentation
Tokenizer.hpp
Go to the documentation of this file.
1/***************************************************
2 * _ _ _ *
3 * | | | | (_) *
4 * | |_| | ___ _ __ _ _______ _ __ *
5 * | _ |/ _ \| '__| |_ / _ \| '_ \ *
6 * | | | | (_) | | | |/ / (_) | | | | *
7 * \_| |_/\___/|_| |_/___\___/|_| |_| *
8 ***************************************************
9 * This file is part of Horizon (c).
10 *
11 * Copyright (c) 2019 Sagun K. (sagunxp@gmail.com).
12 * Copyright (c) 2019 Horizon Dev Team.
13 *
14 * Base Author - Sagun K. (sagunxp@gmail.com)
15 *
16 * This library is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this library. If not, see <http://www.gnu.org/licenses/>.
28 **************************************************/
29
30#ifndef HORIZON_TOKENIZER_H
31#define HORIZON_TOKENIZER_H
32
34{
35 public:
36 typedef std::vector<char const *> StorageType;
37
38 typedef StorageType::size_type size_type;
39
40 typedef StorageType::const_iterator const_iterator;
41 typedef StorageType::reference reference;
42 typedef StorageType::const_reference const_reference;
43
44 public:
45 Tokenizer(const std::string &src, char const sep, uint32_t vectorReserve = 0, bool keepEmptyStrings = true);
46 ~Tokenizer() { delete[] m_str; }
47
48 const_iterator begin() const { return m_storage.begin(); }
49 const_iterator end() const { return m_storage.end(); }
50
51 size_type size() const { return m_storage.size(); }
52
55
56 private:
57 char* m_str;
59};
60
61#endif //HORIZON_TOKENIZER_H
Definition: Tokenizer.hpp:34
StorageType m_storage
Definition: Tokenizer.hpp:58
char * m_str
Definition: Tokenizer.hpp:57
~Tokenizer()
Definition: Tokenizer.hpp:46
Tokenizer(const std::string &src, char const sep, uint32_t vectorReserve=0, bool keepEmptyStrings=true)
Definition: Tokenizer.cpp:32
StorageType::reference reference
Definition: Tokenizer.hpp:41
size_type size() const
Definition: Tokenizer.hpp:51
StorageType::size_type size_type
Definition: Tokenizer.hpp:38
StorageType::const_iterator const_iterator
Definition: Tokenizer.hpp:40
StorageType::const_reference const_reference
Definition: Tokenizer.hpp:42
reference operator[](size_type i)
Definition: Tokenizer.hpp:53
const_iterator end() const
Definition: Tokenizer.hpp:49
const_iterator begin() const
Definition: Tokenizer.hpp:48
std::vector< char const * > StorageType
Definition: Tokenizer.hpp:36