solinject
1.0.0
C++17 Dependency Injection header-only library
Shortcuts.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
26
#pragma once
27
#include <iostream>
28
#include <array>
29
#include "
Configuration.hpp
"
30
#include "
ConfigurationParser.hpp
"
31
32
namespace
sol::di
33
{
34
static
std::string
operator>>(
std::string
input, Configuration& config)
35
{
36
config = ConfigurationParser().Parse(input);
37
return
input;
38
}
39
40
static
std::istream
& operator>>(
std::istream
& stream, Configuration& config)
41
{
42
std::array<char, 4096>
buffer;
43
std::string
input;
44
45
while
(!stream.
eof
())
46
{
47
stream.
read
(buffer.
data
(), buffer.
size
());
48
input.
append
(buffer.
data
(), stream.
gcount
());
49
}
50
51
input >> config;
52
return
stream;
53
}
54
}
std::string
std::array::size
T size(T... args)
std::istream::gcount
T gcount(T... args)
std::istream::read
T read(T... args)
std::array
std::string::append
T append(T... args)
Configuration.hpp
ConfigurationParser.hpp
std::istream
std::array::data
T data(T... args)
std::istream::eof
T eof(T... args)
include
solinject
Shortcuts.hpp
Generated by
1.8.17