task: hiding non-interface methods in the SsocketIO and SIOClient classes, adding SIOClientImpl as friend to access

This commit is contained in:
Chris Hannon 2013-07-12 13:05:15 -04:00
parent 126ebb888c
commit 8791c8119e
1 changed files with 19 additions and 11 deletions

View File

@ -100,16 +100,18 @@ public:
*/ */
static SIOClient* connect(SocketIO::SIODelegate& delegate, const std::string& uri); static SIOClient* connect(SocketIO::SIODelegate& delegate, const std::string& uri);
SIOClientImpl* getSocket(const std::string& uri);
void addSocket(const std::string& uri, SIOClientImpl* socket);
void removeSocket(const std::string& uri);
private: private:
static SocketIO *_inst; static SocketIO *_inst;
Dictionary* _sockets; Dictionary* _sockets;
SIOClientImpl* getSocket(const std::string& uri);
void addSocket(const std::string& uri, SIOClientImpl* socket);
void removeSocket(const std::string& uri);
friend SIOClientImpl;
}; };
//c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind) //c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind)
@ -133,16 +135,23 @@ private:
EventRegistry _eventRegistry; EventRegistry _eventRegistry;
public: void fireEvent(const std::string& eventName, const std::string& data);
SIOClient(const std::string& host, int port, const std::string& path, SIOClientImpl* impl, SocketIO::SIODelegate& delegate);
virtual ~SIOClient(void);
SocketIO::SIODelegate* getDelegate() { return _delegate; };
void onOpen(); void onOpen();
void onConnect(); void onConnect();
void receivedDisconnect(); void receivedDisconnect();
friend SIOClientImpl;
public:
SIOClient(const std::string& host, int port, const std::string& path, SIOClientImpl* impl, SocketIO::SIODelegate& delegate);
virtual ~SIOClient(void);
/**
* @brief Returns the delegate for the client
*/
SocketIO::SIODelegate* getDelegate() { return _delegate; };
/** /**
* @brief Disconnect from the endpoint, onClose will be called on the delegate when comlpete * @brief Disconnect from the endpoint, onClose will be called on the delegate when comlpete
*/ */
@ -160,7 +169,6 @@ public:
* Event argument should be passed using CC_CALLBACK2(&Base::function, this) * Event argument should be passed using CC_CALLBACK2(&Base::function, this)
*/ */
void on(const std::string& eventName, SIOEvent e); void on(const std::string& eventName, SIOEvent e);
void fireEvent(const std::string& eventName, const std::string& data);
inline void setTag(const char* tag) inline void setTag(const char* tag)
{ {