diff --git a/src/core/common/qttools/nonqthelper/nonqthelper.cpp b/src/core/common/qttools/nonqthelper/nonqthelper.cpp new file mode 100644 index 00000000..2acfeeb4 --- /dev/null +++ b/src/core/common/qttools/nonqthelper/nonqthelper.cpp @@ -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 . * + * * + * * + * 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 +#include + +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()); +} diff --git a/src/core/common/qttools/nonqthelper/nonqthelper.h b/src/core/common/qttools/nonqthelper/nonqthelper.h new file mode 100644 index 00000000..8232a9c6 --- /dev/null +++ b/src/core/common/qttools/nonqthelper/nonqthelper.h @@ -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 . * + * * + * * + * 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 + +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 diff --git a/src/core/common/qttools/nonqttoolswrapper.cpp b/src/core/common/qttools/nonqttoolswrapper.cpp new file mode 100644 index 00000000..6b4edfc2 --- /dev/null +++ b/src/core/common/qttools/nonqttoolswrapper.cpp @@ -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 . * + * * + * * + * 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 + + +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); +} + diff --git a/src/core/common/qttools/nonqttoolswrapper.h b/src/core/common/qttools/nonqttoolswrapper.h new file mode 100644 index 00000000..8852706e --- /dev/null +++ b/src/core/common/qttools/nonqttoolswrapper.h @@ -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 . * + * * + * * + * 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 + +#include + +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 diff --git a/src/qttools/nonqthelper/nonqthelper.cpp b/src/qttools/nonqthelper/nonqthelper.cpp new file mode 100644 index 00000000..2acfeeb4 --- /dev/null +++ b/src/qttools/nonqthelper/nonqthelper.cpp @@ -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 . * + * * + * * + * 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 +#include + +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()); +} diff --git a/src/qttools/nonqthelper/nonqthelper.h b/src/qttools/nonqthelper/nonqthelper.h new file mode 100644 index 00000000..8232a9c6 --- /dev/null +++ b/src/qttools/nonqthelper/nonqthelper.h @@ -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 . * + * * + * * + * 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 + +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 diff --git a/src/qttools/nonqttoolswrapper.cpp b/src/qttools/nonqttoolswrapper.cpp new file mode 100644 index 00000000..6b4edfc2 --- /dev/null +++ b/src/qttools/nonqttoolswrapper.cpp @@ -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 . * + * * + * * + * 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 + + +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); +} + diff --git a/src/qttools/nonqttoolswrapper.h b/src/qttools/nonqttoolswrapper.h new file mode 100644 index 00000000..8852706e --- /dev/null +++ b/src/qttools/nonqttoolswrapper.h @@ -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 . * + * * + * * + * 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 + +#include + +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