diff options
Diffstat (limited to 'src/config/Param.cxx')
-rw-r--r-- | src/config/Param.cxx | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/src/config/Param.cxx b/src/config/Param.cxx index 376f50ee7..bfd9743d2 100644 --- a/src/config/Param.cxx +++ b/src/config/Param.cxx @@ -19,12 +19,6 @@ #include "config.h" #include "Param.hxx" -#include "ConfigPath.hxx" -#include "util/Error.hxx" -#include "fs/AllocatedPath.hxx" - -#include <assert.h> -#include <stdlib.h> config_param::config_param(const char *_value, int _line) :next(nullptr), value(_value), line(_line), used(false) {} @@ -33,91 +27,3 @@ config_param::~config_param() { delete next; } - -const BlockParam * -config_param::GetBlockParam(const char *name) const -{ - for (const auto &i : block_params) { - if (i.name == name) { - i.used = true; - return &i; - } - } - - return nullptr; -} - -const char * -config_param::GetBlockValue(const char *name, const char *default_value) const -{ - const BlockParam *bp = GetBlockParam(name); - if (bp == nullptr) - return default_value; - - return bp->value.c_str(); -} - -AllocatedPath -config_param::GetBlockPath(const char *name, const char *default_value, - Error &error) const -{ - assert(!error.IsDefined()); - - int line2 = line; - const char *s; - - const BlockParam *bp = GetBlockParam(name); - if (bp != nullptr) { - line2 = bp->line; - s = bp->value.c_str(); - } else { - if (default_value == nullptr) - return AllocatedPath::Null(); - - s = default_value; - } - - AllocatedPath path = ParsePath(s, error); - if (gcc_unlikely(path.IsNull())) - error.FormatPrefix("Invalid path in \"%s\" at line %i: ", - name, line2); - - return path; -} - -AllocatedPath -config_param::GetBlockPath(const char *name, Error &error) const -{ - return GetBlockPath(name, nullptr, error); -} - -int -config_param::GetBlockValue(const char *name, int default_value) const -{ - const BlockParam *bp = GetBlockParam(name); - if (bp == nullptr) - return default_value; - - return bp->GetIntValue(); -} - -unsigned -config_param::GetBlockValue(const char *name, unsigned default_value) const -{ - const BlockParam *bp = GetBlockParam(name); - if (bp == nullptr) - return default_value; - - return bp->GetUnsignedValue(); -} - -gcc_pure -bool -config_param::GetBlockValue(const char *name, bool default_value) const -{ - const BlockParam *bp = GetBlockParam(name); - if (bp == nullptr) - return default_value; - - return bp->GetBoolValue(); -} |