softwarecontainer  0.18.0-739e8d7 2017-05-04
commandlineconfigsource.cpp
1 
2 /*
3  * Copyright (C) 2016-2017 Pelagicore AB
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
12  * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
13  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
14  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
15  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
16  * SOFTWARE.
17  *
18  * For further information see LICENSE
19  */
20 
21 #include "softwarecontainer-common.h"
22 #include "commandlineconfigsource.h"
23 
24 
25 namespace softwarecontainer {
26 
27 CommandlineConfigSource::CommandlineConfigSource(std::vector<StringConfig> &stringConfigs,
28  std::vector<IntConfig> &intConfigs,
29  std::vector<BoolConfig> &boolConfigs):
30  m_stringConfigs(stringConfigs),
31  m_intConfigs(intConfigs),
32  m_boolConfigs(boolConfigs)
33 {
34  for (auto &config : m_stringConfigs) {
35  config.setSource(ConfigSourceType::Commandline);
36  }
37 
38  for (auto &config : m_intConfigs) {
39  config.setSource(ConfigSourceType::Commandline);
40  }
41 
42  for (auto &config : m_boolConfigs) {
43  config.setSource(ConfigSourceType::Commandline);
44  }
45 }
46 
47 std::vector<StringConfig> CommandlineConfigSource::stringConfigs()
48 {
49  return m_stringConfigs;
50 }
51 
52 std::vector<IntConfig> CommandlineConfigSource::intConfigs()
53 {
54  return m_intConfigs;
55 }
56 
57 std::vector<BoolConfig> CommandlineConfigSource::boolConfigs()
58 {
59  return m_boolConfigs;
60 }
61 
62 } // namespace softwarecontainer
Developers guide to adding a config item: