summaryrefslogtreecommitdiffstats
path: root/tsserver.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-03-05 17:39:48 +0100
committermanuel <manuel@mausz.at>2013-03-05 17:39:48 +0100
commit310a2c101b32a5e71a616027b6a1b788a341bc02 (patch)
treea871e1dda8b1de141ae1400ba666fe3b1de96361 /tsserver.cpp
downloadtsclient-master.tar.gz
tsclient-master.tar.bz2
tsclient-master.zip
initial GPLv2 releaseHEADmaster
Diffstat (limited to 'tsserver.cpp')
-rw-r--r--tsserver.cpp168
1 files changed, 168 insertions, 0 deletions
diff --git a/tsserver.cpp b/tsserver.cpp
new file mode 100644
index 0000000..a0275d6
--- /dev/null
+++ b/tsserver.cpp
@@ -0,0 +1,168 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14 *
15 * Authors: Manuel Mausz (manuel@mausz.at)
16 * Christian Raschko (c.raschko@netcore.at)
17 */
18
19// Header
20#include "tsserver.h"
21
22//Libraries
23#include <wx/txtstrm.h>
24
25IMPLEMENT_CLASS(TSServer, wxObject)
26
27//------------------------------------------------------------------------------
28//Default CTor, Initializes the object.
29TSServer::TSServer()
30{
31 m_Id = 0;
32 m_Type = 0;
33 m_Port = 0;
34 m_HostAddress = _T("localhost");
35}
36
37//------------------------------------------------------------------------------
38//Default DTor.
39TSServer::~TSServer()
40{
41}
42
43//------------------------------------------------------------------------------
44// Sets the server message.
45bool TSServer::SetServerMessage(wxString const &str)
46{
47 if(str.Length() == 0)
48 {
49 SetLastError(_T("empty string"));
50 return false;
51 }
52 m_ServerMessage = str;
53 return true;
54}
55
56//------------------------------------------------------------------------------
57// Sets the welcome message.
58bool TSServer::SetWelcomeMessage(wxString const &str)
59{
60 if(str.Length() == 0)
61 {
62 SetLastError(_T("empty string"));
63 return false;
64 }
65 m_WelcomeMessage = str;
66 return true;
67}
68
69//------------------------------------------------------------------------------
70// Sets the server message.
71bool TSServer::SetVersionNumber(wxString const &str)
72{
73 if(str.Length() == 0)
74 {
75 SetLastError(_T("empty string"));
76 return false;
77 }
78 m_VersionNumber = str;
79 return true;
80}
81
82//------------------------------------------------------------------------------
83// Sets the host address, bindes the client to an address.
84bool TSServer::SetHostAddress(wxString const &str)
85{
86 if(str.Length() == 0)
87 {
88 SetLastError(_T("empty string"));
89 return false;
90 }
91 m_HostAddress = str;
92 return true;
93}
94
95//------------------------------------------------------------------------------
96// Sets the server address.
97bool TSServer::SetServerAddress(wxString const &str)
98{
99 if(str.Length() == 0)
100 {
101 SetLastError(_T("empty string"));
102 return false;
103 }
104 m_ServerAddress = str;
105 return true;
106}
107//------------------------------------------------------------------------------
108// Sets the server Id.
109bool TSServer::SetId(wxUint32 const &id)
110{
111 m_Id = id;
112 return true;
113}
114
115//------------------------------------------------------------------------------
116// Sets the connection port.
117bool TSServer::SetPort(wxUint16 const &port)
118{
119 if(port == 0)
120 {
121 SetLastError(_T("empty port"));
122 return false;
123 }
124 m_Port = port;
125 return true;
126}
127
128//------------------------------------------------------------------------------
129// Sets the server type.
130bool TSServer::SetServerType(wxUint16 const &type)
131{
132 m_ServerType = type;
133 return true;
134}
135
136//------------------------------------------------------------------------------
137// Sets the platform string.
138bool TSServer::SetPlatform(wxString const &str)
139{
140 if(str.Length() == 0)
141 {
142 SetLastError(_T("empty string"));
143 return false;
144 }
145 m_Platform = str;
146 return true;
147}
148
149//------------------------------------------------------------------------------
150// Dumps object.
151void TSServer::Dump(wxOutputStream &ostrm) const
152{
153 wxTextOutputStream out(ostrm);
154 out << _T("Object: TSServer (") << wxString::Format(_T("0x%X"), this) << _T(")") << endl;
155 out << _T("-wxUint32 m_Id: ") << wxString::Format(_T("0x%X"), m_Id) << endl;
156 out << _T("-wxString m_VersionNumber: ") << m_VersionNumber << endl;
157 out << _T("-wxString m_WelcomeMessage: ") << m_WelcomeMessage << endl;
158 out << _T("-wxString m_ServerMessage: ") << m_ServerMessage << endl;
159 out << _T("-wxString m_Platform: ") << m_Platform << endl;
160 out << _T("-wxUint32 m_Type: ") << wxString::Format(_T("0x%X"), m_Type) << endl;
161 out << _T("-wxString m_ISPLinkURL: ") << m_ISPLinkURL << endl;
162 out << _T("-wxString m_ServerAddress: ") << m_ServerAddress << endl;
163 out << _T("-wxString m_HostAddress: ") << m_HostAddress << endl;
164 out << _T("-wxUint16 m_Port: ") << wxString::Format(_T("0x%X"), m_Port) << endl;
165 out << _T("-wxUint16 m_ServerType: ") << wxString::Format(_T("0x%X"), m_ServerType) << endl;
166 out << _T("-wxString m_LastError: ") << m_LastError << endl;
167}
168