ConfigData: rename struct block_param to BlockParam

This commit is contained in:
Max Kellermann 2015-01-21 21:12:54 +01:00
parent bf0ab2d44c
commit 76b7882f33
5 changed files with 14 additions and 14 deletions

View File

@ -25,7 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
int int
block_param::GetIntValue() const BlockParam::GetIntValue() const
{ {
char *endptr; char *endptr;
long value2 = strtol(value.c_str(), &endptr, 0); long value2 = strtol(value.c_str(), &endptr, 0);
@ -36,7 +36,7 @@ block_param::GetIntValue() const
} }
unsigned unsigned
block_param::GetUnsignedValue() const BlockParam::GetUnsignedValue() const
{ {
char *endptr; char *endptr;
unsigned long value2 = strtoul(value.c_str(), &endptr, 0); unsigned long value2 = strtoul(value.c_str(), &endptr, 0);
@ -47,7 +47,7 @@ block_param::GetUnsignedValue() const
} }
bool bool
block_param::GetBoolValue() const BlockParam::GetBoolValue() const
{ {
bool value2; bool value2;
if (!get_bool(value.c_str(), &value2)) if (!get_bool(value.c_str(), &value2))

View File

@ -25,7 +25,7 @@
#include <string> #include <string>
struct block_param { struct BlockParam {
std::string name; std::string name;
std::string value; std::string value;
int line; int line;
@ -37,7 +37,7 @@ struct block_param {
mutable bool used; mutable bool used;
gcc_nonnull_all gcc_nonnull_all
block_param(const char *_name, const char *_value, int _line=-1) BlockParam(const char *_name, const char *_value, int _line=-1)
:name(_name), value(_value), line(_line), used(false) {} :name(_name), value(_value), line(_line), used(false) {}
gcc_pure gcc_pure

View File

@ -34,7 +34,7 @@ config_param::~config_param()
delete next; delete next;
} }
const block_param * const BlockParam *
config_param::GetBlockParam(const char *name) const config_param::GetBlockParam(const char *name) const
{ {
for (const auto &i : block_params) { for (const auto &i : block_params) {
@ -50,7 +50,7 @@ config_param::GetBlockParam(const char *name) const
const char * const char *
config_param::GetBlockValue(const char *name, const char *default_value) const config_param::GetBlockValue(const char *name, const char *default_value) const
{ {
const block_param *bp = GetBlockParam(name); const BlockParam *bp = GetBlockParam(name);
if (bp == nullptr) if (bp == nullptr)
return default_value; return default_value;
@ -66,7 +66,7 @@ config_param::GetBlockPath(const char *name, const char *default_value,
int line2 = line; int line2 = line;
const char *s; const char *s;
const block_param *bp = GetBlockParam(name); const BlockParam *bp = GetBlockParam(name);
if (bp != nullptr) { if (bp != nullptr) {
line2 = bp->line; line2 = bp->line;
s = bp->value.c_str(); s = bp->value.c_str();
@ -94,7 +94,7 @@ config_param::GetBlockPath(const char *name, Error &error) const
int int
config_param::GetBlockValue(const char *name, int default_value) const config_param::GetBlockValue(const char *name, int default_value) const
{ {
const block_param *bp = GetBlockParam(name); const BlockParam *bp = GetBlockParam(name);
if (bp == nullptr) if (bp == nullptr)
return default_value; return default_value;
@ -104,7 +104,7 @@ config_param::GetBlockValue(const char *name, int default_value) const
unsigned unsigned
config_param::GetBlockValue(const char *name, unsigned default_value) const config_param::GetBlockValue(const char *name, unsigned default_value) const
{ {
const block_param *bp = GetBlockParam(name); const BlockParam *bp = GetBlockParam(name);
if (bp == nullptr) if (bp == nullptr)
return default_value; return default_value;
@ -115,7 +115,7 @@ gcc_pure
bool bool
config_param::GetBlockValue(const char *name, bool default_value) const config_param::GetBlockValue(const char *name, bool default_value) const
{ {
const block_param *bp = GetBlockParam(name); const BlockParam *bp = GetBlockParam(name);
if (bp == nullptr) if (bp == nullptr)
return default_value; return default_value;

View File

@ -42,7 +42,7 @@ struct config_param {
unsigned int line; unsigned int line;
std::vector<block_param> block_params; std::vector<BlockParam> block_params;
/** /**
* This flag is false when nobody has queried the value of * This flag is false when nobody has queried the value of
@ -78,7 +78,7 @@ struct config_param {
} }
gcc_nonnull_all gcc_pure gcc_nonnull_all gcc_pure
const block_param *GetBlockParam(const char *_name) const; const BlockParam *GetBlockParam(const char *_name) const;
gcc_pure gcc_pure
const char *GetBlockValue(const char *name, const char *GetBlockValue(const char *name,

View File

@ -67,7 +67,7 @@ config_read_name_value(struct config_param *param, char *input, unsigned line,
return false; return false;
} }
const struct block_param *bp = param->GetBlockParam(name); const BlockParam *bp = param->GetBlockParam(name);
if (bp != nullptr) { if (bp != nullptr) {
error.Format(config_file_domain, error.Format(config_file_domain,
"\"%s\" is duplicate, first defined on line %i", "\"%s\" is duplicate, first defined on line %i",