From 310a2c101b32a5e71a616027b6a1b788a341bc02 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 5 Mar 2013 17:39:48 +0100 Subject: initial GPLv2 release --- tsserver.cpp | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 tsserver.cpp (limited to 'tsserver.cpp') diff --git a/tsserver.cpp b/tsserver.cpp new file mode 100644 index 0000000..a0275d6 --- /dev/null +++ b/tsserver.cpp @@ -0,0 +1,168 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Manuel Mausz (manuel@mausz.at) + * Christian Raschko (c.raschko@netcore.at) + */ + +// Header +#include "tsserver.h" + +//Libraries +#include + +IMPLEMENT_CLASS(TSServer, wxObject) + +//------------------------------------------------------------------------------ +//Default CTor, Initializes the object. +TSServer::TSServer() +{ + m_Id = 0; + m_Type = 0; + m_Port = 0; + m_HostAddress = _T("localhost"); +} + +//------------------------------------------------------------------------------ +//Default DTor. +TSServer::~TSServer() +{ +} + +//------------------------------------------------------------------------------ +// Sets the server message. +bool TSServer::SetServerMessage(wxString const &str) +{ + if(str.Length() == 0) + { + SetLastError(_T("empty string")); + return false; + } + m_ServerMessage = str; + return true; +} + +//------------------------------------------------------------------------------ +// Sets the welcome message. +bool TSServer::SetWelcomeMessage(wxString const &str) +{ + if(str.Length() == 0) + { + SetLastError(_T("empty string")); + return false; + } + m_WelcomeMessage = str; + return true; +} + +//------------------------------------------------------------------------------ +// Sets the server message. +bool TSServer::SetVersionNumber(wxString const &str) +{ + if(str.Length() == 0) + { + SetLastError(_T("empty string")); + return false; + } + m_VersionNumber = str; + return true; +} + +//------------------------------------------------------------------------------ +// Sets the host address, bindes the client to an address. +bool TSServer::SetHostAddress(wxString const &str) +{ + if(str.Length() == 0) + { + SetLastError(_T("empty string")); + return false; + } + m_HostAddress = str; + return true; +} + +//------------------------------------------------------------------------------ +// Sets the server address. +bool TSServer::SetServerAddress(wxString const &str) +{ + if(str.Length() == 0) + { + SetLastError(_T("empty string")); + return false; + } + m_ServerAddress = str; + return true; +} +//------------------------------------------------------------------------------ +// Sets the server Id. +bool TSServer::SetId(wxUint32 const &id) +{ + m_Id = id; + return true; +} + +//------------------------------------------------------------------------------ +// Sets the connection port. +bool TSServer::SetPort(wxUint16 const &port) +{ + if(port == 0) + { + SetLastError(_T("empty port")); + return false; + } + m_Port = port; + return true; +} + +//------------------------------------------------------------------------------ +// Sets the server type. +bool TSServer::SetServerType(wxUint16 const &type) +{ + m_ServerType = type; + return true; +} + +//------------------------------------------------------------------------------ +// Sets the platform string. +bool TSServer::SetPlatform(wxString const &str) +{ + if(str.Length() == 0) + { + SetLastError(_T("empty string")); + return false; + } + m_Platform = str; + return true; +} + +//------------------------------------------------------------------------------ +// Dumps object. +void TSServer::Dump(wxOutputStream &ostrm) const +{ + wxTextOutputStream out(ostrm); + out << _T("Object: TSServer (") << wxString::Format(_T("0x%X"), this) << _T(")") << endl; + out << _T("-wxUint32 m_Id: ") << wxString::Format(_T("0x%X"), m_Id) << endl; + out << _T("-wxString m_VersionNumber: ") << m_VersionNumber << endl; + out << _T("-wxString m_WelcomeMessage: ") << m_WelcomeMessage << endl; + out << _T("-wxString m_ServerMessage: ") << m_ServerMessage << endl; + out << _T("-wxString m_Platform: ") << m_Platform << endl; + out << _T("-wxUint32 m_Type: ") << wxString::Format(_T("0x%X"), m_Type) << endl; + out << _T("-wxString m_ISPLinkURL: ") << m_ISPLinkURL << endl; + out << _T("-wxString m_ServerAddress: ") << m_ServerAddress << endl; + out << _T("-wxString m_HostAddress: ") << m_HostAddress << endl; + out << _T("-wxUint16 m_Port: ") << wxString::Format(_T("0x%X"), m_Port) << endl; + out << _T("-wxUint16 m_ServerType: ") << wxString::Format(_T("0x%X"), m_ServerType) << endl; + out << _T("-wxString m_LastError: ") << m_LastError << endl; +} + -- cgit v1.2.3