Skip to content

Commit

Permalink
Reordered initialization of fields in Setting class.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcphillips committed Nov 22, 2017
1 parent 16f9b8c commit d7e6807
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/yw-config/setting.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "setting.h"
#include "yw_text.h"
#include <algorithm>
#include <iomanip>

namespace yw {
Expand All @@ -19,8 +20,11 @@ namespace yw {
Visibility visibility
) : key(yw::tolower(key)),
valueText((allowed.size() > 0 && valueText.hasValue())? yw::toupper(valueText.getValue()) : valueText),
source(source), resource(resource), valueVector(values),
description(description), allowedValues(allowedValues), visibility(visibility)
source(source),
resource(resource),
valueVector(values),
description(description),
visibility(visibility)
{
if (valueText.hasValue() && values.size() == 0) {
valueVector = std::vector<std::string>{ valueText.getValue() };
Expand Down
2 changes: 1 addition & 1 deletion src/yw-config/setting.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace yw {
const nullable_string valueText;
const SettingSource source;
const std::string resource;
std::vector<std::string> valueVector;
const std::string description;
const Visibility visibility;

Expand Down Expand Up @@ -71,7 +72,6 @@ namespace yw {
private:

std::vector<std::string> allowedValues;
std::vector<std::string> valueVector;
size_t defaultIndex{ std::numeric_limits<size_t>::max() };
};
}
Expand Down
2 changes: 1 addition & 1 deletion test/yw-config-tests/configuration_file_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "yw_config_tests.h"
#include <map>
#include "yw_config_tests.h"

using namespace yw;
using namespace yw::config;
Expand Down
1 change: 1 addition & 0 deletions test/yw-config-tests/yw_config_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <iostream>
#include <sstream>
#include <algorithm>

#include "configuration.h"
#include "yw_io.h"
Expand Down

0 comments on commit d7e6807

Please sign in to comment.