add qttools to core directory - the current directory will be deleted later

This commit is contained in:
Felix Hammer
2015-08-13 15:34:39 +02:00
parent 731f5f05f5
commit 959d48f83d
8 changed files with 520 additions and 0 deletions
@@ -0,0 +1,71 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#include "nonqthelper.h"
#include <core/convhelper.h>
#include <boost/filesystem.hpp>
NonQtHelper::NonQtHelper()
{
}
NonQtHelper::~NonQtHelper()
{
}
std::string
NonQtHelper::stringToUtf8(const std::string &myString)
{
return ConvHelper::NativeToUtf8(myString);
}
std::string
NonQtHelper::stringFromUtf8(const std::string &myString)
{
return ConvHelper::Utf8ToNative(myString);
}
std::string
NonQtHelper::getDefaultLanguage()
{
return "en";
}
std::string
NonQtHelper::getDataPathStdString(const char *argv0)
{
boost::filesystem::path startPath(argv0);
startPath = startPath.remove_leaf();
startPath /= "data";
return stringToUtf8(startPath.directory_string());
}
@@ -0,0 +1,57 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#ifndef NONQTHELPER_H
#define NONQTHELPER_H
#ifndef POKERTH_DEDICATED_SERVER
#error This file is only for the server.
#endif
#include <string>
class NonQtHelper
{
public:
NonQtHelper();
~NonQtHelper();
std::string stringToUtf8(const std::string &);
std::string stringFromUtf8(const std::string &);
std::string getDefaultLanguage();
std::string getDataPathStdString(const char *argv0);
};
#endif
@@ -0,0 +1,74 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#include "nonqttoolswrapper.h"
#include <nonqthelper/nonqthelper.h>
using namespace std;
QtToolsInterface *CreateQtToolsWrapper()
{
return new NonQtToolsWrapper;
}
NonQtToolsWrapper::NonQtToolsWrapper() : myQtHelper(0)
{
myQtHelper = new NonQtHelper();
}
NonQtToolsWrapper::~NonQtToolsWrapper()
{
delete myQtHelper;
myQtHelper = 0;
}
std::string NonQtToolsWrapper::stringToUtf8(const std::string &myString)
{
return myQtHelper->stringToUtf8(myString);
}
std::string NonQtToolsWrapper::stringFromUtf8(const std::string &myString)
{
return myQtHelper->stringFromUtf8(myString);
}
std::string NonQtToolsWrapper::getDefaultLanguage()
{
return myQtHelper->getDefaultLanguage();
}
std::string NonQtToolsWrapper::getDataPathStdString(const char * argv0)
{
return myQtHelper->getDataPathStdString(argv0);
}
@@ -0,0 +1,58 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#ifndef NONQTTOOLSWRAPPER_H
#define NONQTTOOLSWRAPPER_H
#include <qttoolsinterface.h>
#include <string>
class NonQtHelper;
class NonQtToolsWrapper : public QtToolsInterface
{
public:
NonQtToolsWrapper();
~NonQtToolsWrapper();
std::string stringToUtf8(const std::string &myString);
std::string stringFromUtf8(const std::string &myString);
std::string getDefaultLanguage();
std::string getDataPathStdString(const char *argv0);
private:
NonQtHelper *myQtHelper;
};
#endif
+71
View File
@@ -0,0 +1,71 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#include "nonqthelper.h"
#include <core/convhelper.h>
#include <boost/filesystem.hpp>
NonQtHelper::NonQtHelper()
{
}
NonQtHelper::~NonQtHelper()
{
}
std::string
NonQtHelper::stringToUtf8(const std::string &myString)
{
return ConvHelper::NativeToUtf8(myString);
}
std::string
NonQtHelper::stringFromUtf8(const std::string &myString)
{
return ConvHelper::Utf8ToNative(myString);
}
std::string
NonQtHelper::getDefaultLanguage()
{
return "en";
}
std::string
NonQtHelper::getDataPathStdString(const char *argv0)
{
boost::filesystem::path startPath(argv0);
startPath = startPath.remove_leaf();
startPath /= "data";
return stringToUtf8(startPath.directory_string());
}
+57
View File
@@ -0,0 +1,57 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#ifndef NONQTHELPER_H
#define NONQTHELPER_H
#ifndef POKERTH_DEDICATED_SERVER
#error This file is only for the server.
#endif
#include <string>
class NonQtHelper
{
public:
NonQtHelper();
~NonQtHelper();
std::string stringToUtf8(const std::string &);
std::string stringFromUtf8(const std::string &);
std::string getDefaultLanguage();
std::string getDataPathStdString(const char *argv0);
};
#endif
+74
View File
@@ -0,0 +1,74 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#include "nonqttoolswrapper.h"
#include <nonqthelper/nonqthelper.h>
using namespace std;
QtToolsInterface *CreateQtToolsWrapper()
{
return new NonQtToolsWrapper;
}
NonQtToolsWrapper::NonQtToolsWrapper() : myQtHelper(0)
{
myQtHelper = new NonQtHelper();
}
NonQtToolsWrapper::~NonQtToolsWrapper()
{
delete myQtHelper;
myQtHelper = 0;
}
std::string NonQtToolsWrapper::stringToUtf8(const std::string &myString)
{
return myQtHelper->stringToUtf8(myString);
}
std::string NonQtToolsWrapper::stringFromUtf8(const std::string &myString)
{
return myQtHelper->stringFromUtf8(myString);
}
std::string NonQtToolsWrapper::getDefaultLanguage()
{
return myQtHelper->getDefaultLanguage();
}
std::string NonQtToolsWrapper::getDataPathStdString(const char * argv0)
{
return myQtHelper->getDataPathStdString(argv0);
}
+58
View File
@@ -0,0 +1,58 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#ifndef NONQTTOOLSWRAPPER_H
#define NONQTTOOLSWRAPPER_H
#include <qttoolsinterface.h>
#include <string>
class NonQtHelper;
class NonQtToolsWrapper : public QtToolsInterface
{
public:
NonQtToolsWrapper();
~NonQtToolsWrapper();
std::string stringToUtf8(const std::string &myString);
std::string stringFromUtf8(const std::string &myString);
std::string getDefaultLanguage();
std::string getDataPathStdString(const char *argv0);
private:
NonQtHelper *myQtHelper;
};
#endif