Refactoring into separate .hpp and .cpp files.

This commit is contained in:
David Baird
2013-04-05 11:38:51 -06:00
parent ad0f214fa9
commit af6d38638d
4 changed files with 320 additions and 329 deletions
+2 -7
View File
@@ -1,17 +1,12 @@
#define EASYWSCLIENT_COMPILATION_UNIT
#include "easywsclient.hpp"
#include "easywsclient.cpp" // <-- include only if you don't want compile separately
#include <assert.h>
#include <stdio.h>
#include <string>
// N.B. A real application should abuse a global variable like this...
// (gets messy if threads are involved)
std::string message;
void handle_message(const std::string & message)
{
printf(">>> %s\n", message.c_str());
::message = message;
}
int main()
@@ -21,7 +16,7 @@ int main()
assert(ws);
ws->send("goodbye");
ws->send("hello");
while (message != "world") {
while (true) {
ws->poll();
ws->dispatch(handle_message);
}