You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
745 B

#include "clock_settings.h"
#include "string_helper.h"
#include <stdlib.h>
#include <limits.h>
ClockSettings::ClockSettings():
m_server(nullptr)
{
}
ClockSettings::~ClockSettings()
{
delete[] m_server;
}
void ClockSettings::add_info(char const* key, char const* val)
{
if(string_equals(key, "server"))
{
if(m_server != nullptr)
delete[] m_server;
m_server = val;
}
else if(string_equals(key, "val"))
{
long const v = atoi(val);
delete[] val;
if(v < 1)
m_cooldown = 1;
else if(v > UINT_MAX)
m_cooldown = UINT_MAX;
else
m_cooldown = (unsigned int) v;
}
else
delete[] val;
delete[] key;
}