Skip to content

Commit

Permalink
Merge pull request #714 from p12tic/use-std-string-6
Browse files Browse the repository at this point in the history
lib/server: Use std::string directly instead of String typedef
  • Loading branch information
shymega authored May 30, 2020
2 parents dbd1082 + b4c1e4c commit b0f0a6f
Show file tree
Hide file tree
Showing 27 changed files with 334 additions and 415 deletions.
5 changes: 2 additions & 3 deletions src/lib/server/BaseClientProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// BaseClientProxy
//

BaseClientProxy::BaseClientProxy(const String& name) :
BaseClientProxy::BaseClientProxy(const std::string& name) :
m_name(name),
m_x(0),
m_y(0)
Expand All @@ -49,8 +49,7 @@ BaseClientProxy::getJumpCursorPos(SInt32& x, SInt32& y) const
y = m_y;
}

String
BaseClientProxy::getName() const
std::string BaseClientProxy::getName() const
{
return m_name;
}
7 changes: 3 additions & 4 deletions src/lib/server/BaseClientProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include "barrier/IClient.h"
#include "base/String.h"

namespace barrier { class IStream; }

Expand All @@ -29,7 +28,7 @@ class BaseClientProxy : public IClient {
/*!
\c name is the name of the client.
*/
BaseClientProxy(const String& name);
BaseClientProxy(const std::string& name);
~BaseClientProxy();

//! @name manipulators
Expand Down Expand Up @@ -89,11 +88,11 @@ class BaseClientProxy : public IClient {
virtual void sendDragInfo(UInt32 fileCount, const char* info,
size_t size) = 0;
virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize) = 0;
virtual String getName() const;
virtual std::string getName() const;
virtual barrier::IStream*
getStream() const = 0;

private:
String m_name;
std::string m_name;
SInt32 m_x, m_y;
};
2 changes: 1 addition & 1 deletion src/lib/server/ClientProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// ClientProxy
//

ClientProxy::ClientProxy(const String& name, barrier::IStream* stream) :
ClientProxy::ClientProxy(const std::string& name, barrier::IStream* stream) :
BaseClientProxy(name),
m_stream(stream)
{
Expand Down
3 changes: 1 addition & 2 deletions src/lib/server/ClientProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "server/BaseClientProxy.h"
#include "base/Event.h"
#include "base/String.h"
#include "base/EventTypes.h"

namespace barrier { class IStream; }
Expand All @@ -31,7 +30,7 @@ class ClientProxy : public BaseClientProxy {
/*!
\c name is the name of the client.
*/
ClientProxy(const String& name, barrier::IStream* adoptedStream);
ClientProxy(const std::string& name, barrier::IStream* adoptedStream);
~ClientProxy();

//! @name manipulators
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
// ClientProxy1_0
//

ClientProxy1_0::ClientProxy1_0(const String& name, barrier::IStream* stream, IEventQueue* events) :
ClientProxy1_0::ClientProxy1_0(const std::string& name, barrier::IStream* stream,
IEventQueue* events) :
ClientProxy(name, stream),
m_heartbeatTimer(NULL),
m_parser(&ClientProxy1_0::parseHandshakeMessage),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/ClientProxy1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class IEventQueue;
//! Proxy for client implementing protocol version 1.0
class ClientProxy1_0 : public ClientProxy {
public:
ClientProxy1_0(const String& name, barrier::IStream* adoptedStream, IEventQueue* events);
ClientProxy1_0(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events);
~ClientProxy1_0();

// IScreen
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
// ClientProxy1_1
//

ClientProxy1_1::ClientProxy1_1(const String& name, barrier::IStream* stream, IEventQueue* events) :
ClientProxy1_1::ClientProxy1_1(const std::string& name, barrier::IStream* stream,
IEventQueue* events) :
ClientProxy1_0(name, stream, events)
{
// do nothing
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/ClientProxy1_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! Proxy for client implementing protocol version 1.1
class ClientProxy1_1 : public ClientProxy1_0 {
public:
ClientProxy1_1(const String& name, barrier::IStream* adoptedStream, IEventQueue* events);
ClientProxy1_1(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events);
~ClientProxy1_1();

// IClient overrides
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
// ClientProxy1_1
//

ClientProxy1_2::ClientProxy1_2(const String& name, barrier::IStream* stream, IEventQueue* events) :
ClientProxy1_2::ClientProxy1_2(const std::string& name, barrier::IStream* stream,
IEventQueue* events) :
ClientProxy1_1(name, stream, events)
{
// do nothing
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/ClientProxy1_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class IEventQueue;
//! Proxy for client implementing protocol version 1.2
class ClientProxy1_2 : public ClientProxy1_1 {
public:
ClientProxy1_2(const String& name, barrier::IStream* adoptedStream, IEventQueue* events);
ClientProxy1_2(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events);
~ClientProxy1_2();

// IClient overrides
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
// ClientProxy1_3
//

ClientProxy1_3::ClientProxy1_3(const String& name, barrier::IStream* stream, IEventQueue* events) :
ClientProxy1_3::ClientProxy1_3(const std::string& name, barrier::IStream* stream,
IEventQueue* events) :
ClientProxy1_2(name, stream, events),
m_keepAliveRate(kKeepAliveRate),
m_keepAliveTimer(NULL),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/ClientProxy1_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! Proxy for client implementing protocol version 1.3
class ClientProxy1_3 : public ClientProxy1_2 {
public:
ClientProxy1_3(const String& name, barrier::IStream* adoptedStream, IEventQueue* events);
ClientProxy1_3(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events);
~ClientProxy1_3();

// IClient overrides
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
// ClientProxy1_4
//

ClientProxy1_4::ClientProxy1_4(const String& name, barrier::IStream* stream, Server* server, IEventQueue* events) :
ClientProxy1_4::ClientProxy1_4(const std::string& name, barrier::IStream* stream, Server* server,
IEventQueue* events) :
ClientProxy1_3(name, stream, events), m_server(server)
{
assert(m_server != NULL);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Server;
//! Proxy for client implementing protocol version 1.4
class ClientProxy1_4 : public ClientProxy1_3 {
public:
ClientProxy1_4(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events);
ClientProxy1_4(const std::string& name, barrier::IStream* adoptedStream, Server* server,
IEventQueue* events);
~ClientProxy1_4();

//! @name accessors
Expand Down
9 changes: 5 additions & 4 deletions src/lib/server/ClientProxy1_5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
// ClientProxy1_5
//

ClientProxy1_5::ClientProxy1_5(const String& name, barrier::IStream* stream, Server* server, IEventQueue* events) :
ClientProxy1_5::ClientProxy1_5(const std::string& name, barrier::IStream* stream, Server* server,
IEventQueue* events) :
ClientProxy1_4(name, stream, server, events),
m_events(events)
{
Expand All @@ -50,7 +51,7 @@ ClientProxy1_5::~ClientProxy1_5()
void
ClientProxy1_5::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
{
String data(info, size);
std::string data(info, size);

ProtocolUtil::writef(getStream(), kMsgDDragInfo, fileCount, &data);
}
Expand Down Expand Up @@ -92,7 +93,7 @@ ClientProxy1_5::fileChunkReceived()
}
else if (result == kStart) {
if (server->getFakeDragFileList().size() > 0) {
String filename = server->getFakeDragFileList().at(0).getFilename();
std::string filename = server->getFakeDragFileList().at(0).getFilename();
LOG((CLOG_DEBUG "start receiving %s", filename.c_str()));
}
}
Expand All @@ -103,7 +104,7 @@ ClientProxy1_5::dragInfoReceived()
{
// parse
UInt32 fileNum = 0;
String content;
std::string content;
ProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content);

m_server->dragInfoReceived(fileNum, content);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_5.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class IEventQueue;
//! Proxy for client implementing protocol version 1.5
class ClientProxy1_5 : public ClientProxy1_4 {
public:
ClientProxy1_5(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events);
ClientProxy1_5(const std::string& name, barrier::IStream* adoptedStream, Server* server,
IEventQueue* events);
~ClientProxy1_5();

virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size);
Expand Down
7 changes: 4 additions & 3 deletions src/lib/server/ClientProxy1_6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
// ClientProxy1_6
//

ClientProxy1_6::ClientProxy1_6(const String& name, barrier::IStream* stream, Server* server, IEventQueue* events) :
ClientProxy1_6::ClientProxy1_6(const std::string& name, barrier::IStream* stream, Server* server,
IEventQueue* events) :
ClientProxy1_5(name, stream, server, events),
m_events(events)
{
Expand All @@ -52,7 +53,7 @@ ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard* clipboard)
m_clipboard[id].m_dirty = false;
Clipboard::copy(&m_clipboard[id].m_clipboard, clipboard);

String data = m_clipboard[id].m_clipboard.marshall();
std::string data = m_clipboard[id].m_clipboard.marshall();

size_t size = data.size();
LOG((CLOG_DEBUG "sending clipboard %d to \"%s\"", id, getName().c_str()));
Expand All @@ -71,7 +72,7 @@ bool
ClientProxy1_6::recvClipboard()
{
// parse message
static String dataCached;
static std::string dataCached;
ClipboardID id;
UInt32 seq;

Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/ClientProxy1_6.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class IEventQueue;
//! Proxy for client implementing protocol version 1.6
class ClientProxy1_6 : public ClientProxy1_5 {
public:
ClientProxy1_6(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events);
ClientProxy1_6(const std::string& name, barrier::IStream* adoptedStream, Server* server,
IEventQueue* events);
~ClientProxy1_6();

virtual void setClipboard(ClipboardID id, const IClipboard* clipboard);
Expand Down
3 changes: 1 addition & 2 deletions src/lib/server/ClientProxyUnknown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "io/IStream.h"
#include "io/XIO.h"
#include "base/Log.h"
#include "base/String.h"
#include "base/IEventQueue.h"
#include "base/TMethodEventJob.h"

Expand Down Expand Up @@ -176,7 +175,7 @@ ClientProxyUnknown::handleData(const Event&, void*)
{
LOG((CLOG_DEBUG1 "parsing hello reply"));

String name("<unknown>");
std::string name("<unknown>");
try {
// limit the maximum length of the hello
UInt32 n = m_stream->getSize();
Expand Down
Loading

0 comments on commit b0f0a6f

Please sign in to comment.