Home

Awesome

Win Linux Osx

cTools :

a two files helper im using from more than 10 years, in all my project. Contain usefull templated things for c++ like vec2, vec3, vec4, variant, actionTime and more. need a bit of refactoring btw :) use the namespace ct

and other string conversion / extraction etc..

Logger :

Log method for check/write in auto in a log file

FileHelper

this singleton is usefull for manipulate files / directory fully tested on win/LINUX/MACOS

dependency : ctools, dirent/h, glfw if you want to use clipboard

ConfigAbstract

ConfigAbstract let you load/save a config file easily from class using lib tinyxml2

Usage :

class toto : public conf::ConfigAbstract
{
public:
	toto()
	{
		LoadConfigFile("config.xml");
	}

	~toto()
	{
		SaveConfigFile("config.xml");
	}

	std::string getXml(const std::string& vOffset);
	void setFromXml(tinyxml2::XMLElement* vElem, tinyxml2::XMLElement* vParent);
};


std::string toto::getXml(const std::string& vOffset)
{
	std::string str;

	str += vOffset + "\t<tata value=\"" + "true" + "\"/>\n";
	
	return str;
}

bool toto::setFromXml(tinyxml2::XMLElement* vElem, tinyxml2::XMLElement* vParent)
{
	// The value of this child identifies the name of this element
	std::string strName = "";
	std::string strValue = "";
	std::string strParentName = "";

	strName = vElem->Value();
	if (vElem->GetText())
		strValue = vElem->GetText();
	if (vParent != 0)
		strParentName = vParent->Value();

	auto att = vElem->FirstAttribute();
	if (att && std::string(att->Name()) == "value")
	{
		strValue = att->Value();
		if (strName == "tata")
			youvar = strValue;
	}
	
	return true; // parsing continue if childs or stop
}