solinject  1.0.0
C++17 Dependency Injection header-only library
ConfigurationParserToken.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2 
3 /*
4  * solinject - C++ Dependency Injection header-only library
5  * Copyright (C) 2022 SemperSolus0x3d
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
22 
23 #pragma once
24 #include <string>
25 
26 namespace sol::di::impl
27 {
29  enum class TokenType
30  {
31  Key,
32  OpeningCurlyBracket,
33  ClosingCurlyBracket,
34  Self,
35  Singleton,
36  Transient,
37  Shared,
38  Scoped,
39  None
40  };
41 
44  {
45  public:
50  m_Type(type), m_Content(content)
51  {
52  }
53 
56  m_Type(other.m_Type),
57  m_Content(other.m_Content)
58  {
59  }
60 
63  {
64  swap(*this, other);
65  }
66 
69  {
70  swap(*this, other);
71  return *this;
72  }
73 
76  {
77  using std::swap;
78 
79  swap(a.m_Type, b.m_Type);
80  swap(a.m_Content, b.m_Content);
81  }
82 
85  TokenType Type() const { return m_Type; }
86 
90  const std::string& Content() const { return m_Content; }
91  private:
93  TokenType m_Type;
94 
96  std::string m_Content;
97  }; // class ConfigurationParserToken
98 } // sol::di::impl
sol::di::impl::ConfigurationParserToken::swap
friend void swap(ConfigurationParserToken &a, ConfigurationParserToken &b)
Swaps two ConfigurationParserToken instances.
Definition: ConfigurationParserToken.hpp:75
std::string
sol::di::impl::ConfigurationParserToken::ConfigurationParserToken
ConfigurationParserToken(ConfigurationParserToken &&other) noexcept
Move constructor.
Definition: ConfigurationParserToken.hpp:62
sol::di::impl::ConfigurationParserToken::Content
const std::string & Content() const
Token content property.
Definition: ConfigurationParserToken.hpp:90
sol::di::impl::TokenType
TokenType
sol::di::impl::ConfigurationParserToken type
Definition: ConfigurationParserToken.hpp:29
sol::di::impl::ConfigurationParserToken::ConfigurationParserToken
ConfigurationParserToken(const ConfigurationParserToken &other)
Copy constructor.
Definition: ConfigurationParserToken.hpp:55
sol::di::impl::ConfigurationParserToken::Type
TokenType Type() const
Token type property.
Definition: ConfigurationParserToken.hpp:85
sol::di::impl::ConfigurationParserToken
ConfigurationParser token
Definition: ConfigurationParserToken.hpp:43
std::swap
T swap(T... args)
sol::di::impl::ConfigurationParserToken::operator=
ConfigurationParserToken & operator=(ConfigurationParserToken other)
Copy-assignment operator.
Definition: ConfigurationParserToken.hpp:68
sol::di::impl::ConfigurationParserToken::ConfigurationParserToken
ConfigurationParserToken(TokenType type, std::string content)
Constructor.
Definition: ConfigurationParserToken.hpp:49