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
+3 -6
View File
@@ -1,7 +1,7 @@
// Compile with:
// g++ -std=gnu++0x example-client-cpp11.cpp -o example-client-cpp11
#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>
@@ -14,13 +14,10 @@ int main()
ws->send("goodbye");
ws->send("hello");
while (true) {
std::string message;
ws->poll();
ws->dispatch([&message](const std::string & message_) {
printf(">>> %s\n", message_.c_str());
message = message_;
ws->dispatch([](const std::string & message) {
printf(">>> %s\n", message.c_str());
});
if (message == "world") { break; }
}
return 0;
}