#include "CFGParameterValue.h"

CFGParameterValue::CFGParameterValue():DictionaryInterface(),_parameter(NULL), _value(NULL), _quotedParameter(false), _quotedValue(false)
{

}

CFGParameterValue::CFGParameterValue(const char *parameter, const char *value, boolean quotedParameter, boolean quotedValue):_quotedParameter(quotedParameter), _quotedValue(quotedValue)
{
    _parameter = (char *) malloc((strlen(parameter) * sizeof(char)) + 1); //+1 for the string terminating character
    _value = (char *) malloc((strlen(value) * sizeof(char)) + 1); //+1 for the string terminating character

    strcpy(_parameter, parameter);
    strcpy(_value, value);
}

CFGParameterValue::CFGParameterValue(const char *parameter, const char *value):CFGParameterValue()
{
    _parameter = (char *) malloc((strlen(parameter) * sizeof(char)) + 1); //+1 for the string terminating character
    _value = (char *) malloc((strlen(value) * sizeof(char)) + 1); //+1 for the string terminating character

    strcpy(_parameter, parameter);
    strcpy(_value, value);
}
CFGParameterValue::CFGParameterValue(const CFGParameterValue &Object)
{
    _parameter = (char *) malloc((strlen(Object._parameter) * sizeof(char)) + 1); //+1 for the string terminating character
    _value = (char *) malloc((strlen(Object._value) * sizeof(char)) + 1); //+1 for the string terminating character

    strcpy(_parameter, Object._parameter);
    strcpy(_value, Object._value);

    _quotedParameter = Object._quotedParameter;
    _quotedValue = Object._quotedValue;
}
CFGParameterValue::~CFGParameterValue()
{
    free(_parameter);
    _parameter = NULL;
    free(_value);
    _value = NULL;
}
