Reaktoro
A unified framework for modeling chemically reactive systems
StringList.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2018 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // C++ includes
21 #include <string>
22 #include <vector>
23 
24 namespace Reaktoro {
25 
28 {
29 public:
31  StringList();
32 
38  StringList(const char* str);
39 
46  StringList(const char* str, char token);
47 
53  StringList(std::string str);
54 
61  StringList(std::string str, char token);
62 
64  StringList(const std::vector<std::string>& strings);
65 
67  StringList(std::initializer_list<std::string> strings);
68 
70  virtual ~StringList();
71 
73  auto strings() const -> const std::vector<std::string>&;
74 
75  operator const std::vector<std::string>&() const;
76 
77 private:
78  std::vector<std::string> _strings;
79 };
80 
82 inline auto begin(const StringList& strings) -> decltype(strings.strings().begin())
83 {
84  return strings.strings().begin();
85 }
86 
88 inline auto begin(StringList& strings) -> decltype(strings.strings().begin())
89 {
90  return strings.strings().begin();
91 }
92 
94 inline auto end(const StringList& strings) -> decltype(strings.strings().end())
95 {
96  return strings.strings().end();
97 }
98 
100 inline auto end(StringList& strings) -> decltype(strings.strings().end())
101 {
102  return strings.strings().end();
103 }
104 
105 } // namespace Reaktoro
A class for representing a list of strings with special constructors.
Definition: StringList.hpp:28
auto strings() const -> const std::vector< std::string > &
Return a vector of strings.
Definition: StringList.cpp:118
auto begin(const Reaktoro::ReactionEquation &equation) -> decltype(equation.equation().begin())
Return begin const iterator of a ReactionEquation instance.
Definition: ReactionEquation.hpp:86
auto end(const Reaktoro::ReactionEquation &equation) -> decltype(equation.equation().end())
Return end const iterator of a ReactionEquation instance.
Definition: ReactionEquation.hpp:98
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
virtual ~StringList()
Destroy this StringList instance.
Definition: StringList.cpp:115
StringList()
Construct a default StringList instance.
Definition: StringList.cpp:88