mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
Tidy up some stuff
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5753 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
b456e8ec67
commit
91f17cace8
@ -45,56 +45,15 @@ class ValueItem
|
|||||||
{
|
{
|
||||||
std::string v;
|
std::string v;
|
||||||
public:
|
public:
|
||||||
ValueItem(int value)
|
ValueItem(int value);
|
||||||
{
|
ValueItem(bool value);
|
||||||
std::stringstream n;
|
ValueItem(char* value);
|
||||||
n << value;
|
void Set(char* value);
|
||||||
v = n.str();
|
void Set(const char* val);
|
||||||
}
|
void Set(int value);
|
||||||
|
int GetInteger();
|
||||||
ValueItem(bool value)
|
char* GetString();
|
||||||
{
|
bool GetBool();
|
||||||
std::stringstream n;
|
|
||||||
n << value;
|
|
||||||
v = n.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueItem(char* value)
|
|
||||||
{
|
|
||||||
v = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Set(char* value)
|
|
||||||
{
|
|
||||||
v = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Set(const char* value)
|
|
||||||
{
|
|
||||||
v = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Set(int value)
|
|
||||||
{
|
|
||||||
std::stringstream n;
|
|
||||||
n << value;
|
|
||||||
v = n.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetInteger()
|
|
||||||
{
|
|
||||||
return atoi(v.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
char* GetString()
|
|
||||||
{
|
|
||||||
return (char*)v.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetBool()
|
|
||||||
{
|
|
||||||
return (GetInteger() || v == "yes" || v == "true");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The base class of the container 'ValueContainer'
|
/** The base class of the container 'ValueContainer'
|
||||||
@ -103,13 +62,8 @@ class ValueItem
|
|||||||
class ValueContainerBase
|
class ValueContainerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ValueContainerBase()
|
ValueContainerBase() { }
|
||||||
{
|
virtual ~ValueContainerBase() { }
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~ValueContainerBase()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ValueContainer is used to contain pointers to different
|
/** ValueContainer is used to contain pointers to different
|
||||||
|
@ -1465,3 +1465,55 @@ InspIRCd* ServerConfig::GetInstance()
|
|||||||
return ServerInstance;
|
return ServerInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ValueItem::ValueItem(int value)
|
||||||
|
{
|
||||||
|
std::stringstream n;
|
||||||
|
n << value;
|
||||||
|
v = n.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
ValueItem::ValueItem(bool value)
|
||||||
|
{
|
||||||
|
std::stringstream n;
|
||||||
|
n << value;
|
||||||
|
v = n.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
ValueItem::ValueItem(char* value)
|
||||||
|
{
|
||||||
|
v = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValueItem::Set(char* value)
|
||||||
|
{
|
||||||
|
v = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValueItem::Set(const char* value)
|
||||||
|
{
|
||||||
|
v = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValueItem::Set(int value)
|
||||||
|
{
|
||||||
|
std::stringstream n;
|
||||||
|
n << value;
|
||||||
|
v = n.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ValueItem::GetInteger()
|
||||||
|
{
|
||||||
|
return atoi(v.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
char* ValueItem::GetString()
|
||||||
|
{
|
||||||
|
return (char*)v.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ValueItem::GetBool()
|
||||||
|
{
|
||||||
|
return (GetInteger() || v == "yes" || v == "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user