<gh_stars>1-10
/***************************************************************************
****************************************************************************
****************************   PseudoD    **********************************
***** Creado por <NAME> El 14 de septiembre de 2014. *****
*****                                                                  *****
***** Página oficial de PseudoD en:                                    *****
*****     http://pseudod.sourceforge.net/                              *****
*****                                                                  *****
****************************************************************************
Copyright 2016 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**************************************************************************/

#include "data.hh"

PDCadena eas(PDEntero i)
{
#ifndef MINGW
	return std::to_string(i);
#else
	char buffer[50];
	sprintf(buffer,"%d",i);
	return std::string(buffer);
#endif
}

PDCadena dac(PDDecimal i)
{
#ifndef MINGW
	return std::to_string(i);
#else
	char buffer[50];
	sprintf(buffer,"%a",i);
	return std::string(buffer);
#endif
}

PDEntero cae(PDCadena i)
{
#ifndef MINGW
	return std::stoll(i);
#else
	return atoi(i.c_str());
#endif
}

PDDecimal caf(PDCadena i)
{
#ifndef MINGW
	return std::stold(i);
#else
	return atof(i.c_str());
#endif
}

namespace PDvar
{
	Error::Error(void) noexcept : PseudoDClass("Error"), ErrorMessage("")
	{
	}
	Error::Error(const Error& other) noexcept
	{
		this->PseudoDClass = other.ObtenerClaseEnPseudoD();
		this->ErrorMessage = other.ObtenerErrorElemental();
	}
	Error::Error(PDCadena classname, PDCadena message) noexcept
		: PseudoDClass(classname), ErrorMessage(message)
	{
	}
	Error::~Error(void) noexcept
	{
	}
	Error& Error::operator=(const Error& other) noexcept
	{
		this->PseudoDClass = other.ObtenerClaseEnPseudoD();
		this->ErrorMessage = other.ObtenerErrorElemental();
		return *this;
	}
	const char* Error::what(void) noexcept
	{
		return this->ObtenerErrorElemental().c_str();
	}
	PDCadena Error::ObtenerClaseEnPseudoD(void) const noexcept
	{
		return this->PseudoDClass;
	}
	PDCadena Error::ObtenerErrorElemental(void) const noexcept
	{
		return this->ErrorMessage;
	}
	void Error::FijarClase(PDCadena classname) noexcept
	{
		this->PseudoDClass = classname;
	}
	void Error::FijarMensaje(PDCadena message) noexcept
	{
		this->ErrorMessage = message;
	}
	PDCadena Error::Mensaje(void) const noexcept
	{
		return "(" + this->ObtenerClaseEnPseudoD() + ") " + this->ObtenerErrorElemental();
	}
	ErrorDeSintaxis::ErrorDeSintaxis(void) noexcept : Error("ErrorDeSintaxis","")
	{}
	ErrorDeSintaxis::ErrorDeSintaxis(PDCadena message) noexcept : Error("ErrorDeSintaxis",message)
	{}
	ErrorDeSintaxis::ErrorDeSintaxis(const Error& other) noexcept : Error(other)
	{}
	ErrorDeSintaxis::~ErrorDeSintaxis(void) noexcept
	{}
	ErrorDeSemantica::ErrorDeSemantica(void) noexcept : Error("ErrorDeSemantica","")
	{}
	ErrorDeSemantica::ErrorDeSemantica(PDCadena message) noexcept : Error("ErrorDeSemantica",message)
	{}
	ErrorDeSemantica::ErrorDeSemantica(const Error& other) noexcept : Error(other)
	{}
	ErrorDeSemantica::~ErrorDeSemantica(void) noexcept
	{}
	ErrorDelNucleo::ErrorDelNucleo(void) noexcept : Error("ErrorDelNucleo","")
	{}
	ErrorDelNucleo::ErrorDelNucleo(PDCadena message) noexcept : Error("ErrorDelNucleo",message)
	{}
	ErrorDelNucleo::ErrorDelNucleo(const Error& other) noexcept : Error(other)
	{}
	ErrorDelNucleo::~ErrorDelNucleo(void) noexcept
	{}
}
