From 797ce35c5a5c1a6e4a7dd117f1fd737ad08fd535 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sun, 2 Mar 2014 19:14:59 -0600 Subject: [PATCH] more renaming and adding license notes --- tutorials/utility_client/step1.cpp | 56 +++++++++++++ tutorials/utility_client/step2.cpp | 61 ++++++++++++++ tutorials/utility_client/step3.cpp | 81 +++++++++++++++++++ .../step4.cpp | 30 +++++++ .../step5.cpp | 30 +++++++ .../utility_client.md | 0 tutorials/utility_client_tutorial/step1.cpp | 26 ------ tutorials/utility_client_tutorial/step2.cpp | 31 ------- tutorials/utility_client_tutorial/step3.cpp | 51 ------------ 9 files changed, 258 insertions(+), 108 deletions(-) create mode 100644 tutorials/utility_client/step1.cpp create mode 100644 tutorials/utility_client/step2.cpp create mode 100644 tutorials/utility_client/step3.cpp rename tutorials/{utility_client_tutorial => utility_client}/step4.cpp (76%) rename tutorials/{utility_client_tutorial => utility_client}/step5.cpp (82%) rename tutorials/{utility_client_tutorial => utility_client}/utility_client.md (100%) delete mode 100644 tutorials/utility_client_tutorial/step1.cpp delete mode 100644 tutorials/utility_client_tutorial/step2.cpp delete mode 100644 tutorials/utility_client_tutorial/step3.cpp diff --git a/tutorials/utility_client/step1.cpp b/tutorials/utility_client/step1.cpp new file mode 100644 index 0000000000..9c8fad9eb3 --- /dev/null +++ b/tutorials/utility_client/step1.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2014, Peter Thorson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the WebSocket++ Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// **NOTE:** This file is a snapshot of the WebSocket++ utility client tutorial. +// Additional related material can be found in the tutorials/utility_client +// directory of the WebSocket++ repository. + +#include +#include + +int main() { + bool done = false; + std::string input; + + while (!done) { + std::cout << "Enter Command: "; + std::getline(std::cin, input); + + if (input == "quit") { + done = true; + } else if (input == "help") { + std::cout + << "\nCommand List:\n" + << "help: Display this help text\n" + << "quit: Exit the program\n" + << std::endl; + } else { + std::cout << "Unrecognized Command" << std::endl; + } + } + + return 0; +} diff --git a/tutorials/utility_client/step2.cpp b/tutorials/utility_client/step2.cpp new file mode 100644 index 0000000000..a1e5796636 --- /dev/null +++ b/tutorials/utility_client/step2.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2014, Peter Thorson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the WebSocket++ Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// **NOTE:** This file is a snapshot of the WebSocket++ utility client tutorial. +// Additional related material can be found in the tutorials/utility_client +// directory of the WebSocket++ repository. + +#include +#include + +#include +#include + +typedef websocketpp::client client; + +int main() { + bool done = false; + std::string input; + + while (!done) { + std::cout << "Enter Command: "; + std::getline(std::cin, input); + + if (input == "quit") { + done = true; + } else if (input == "help") { + std::cout + << "\nCommand List:\n" + << "help: Display this help text\n" + << "quit: Exit the program\n" + << std::endl; + } else { + std::cout << "Unrecognized Command" << std::endl; + } + } + + return 0; +} diff --git a/tutorials/utility_client/step3.cpp b/tutorials/utility_client/step3.cpp new file mode 100644 index 0000000000..42441f2234 --- /dev/null +++ b/tutorials/utility_client/step3.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2014, Peter Thorson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the WebSocket++ Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// **NOTE:** This file is a snapshot of the WebSocket++ utility client tutorial. +// Additional related material can be found in the tutorials/utility_client +// directory of the WebSocket++ repository. + +#include +#include + +#include +#include + +#include +#include + +typedef websocketpp::client client; + +class websocket_endpoint { +public: + websocket_endpoint () { + m_endpoint.clear_access_channels(websocketpp::log::alevel::all); + m_endpoint.clear_error_channels(websocketpp::log::elevel::all); + + m_endpoint.init_asio(); + m_endpoint.start_perpetual(); + + m_thread.reset(new websocketpp::lib::thread(&client::run, &m_endpoint)); + } +private: + client m_endpoint; + websocketpp::lib::shared_ptr m_thread; +}; + +int main() { + bool done = false; + std::string input; + websocket_endpoint endpoint; + + while (!done) { + std::cout << "Enter Command: "; + std::getline(std::cin, input); + + if (input == "quit") { + done = true; + } else if (input == "help") { + std::cout + << "\nCommand List:\n" + << "help: Display this help text\n" + << "quit: Exit the program\n" + << std::endl; + } else { + std::cout << "Unrecognized Command" << std::endl; + } + } + + return 0; +} diff --git a/tutorials/utility_client_tutorial/step4.cpp b/tutorials/utility_client/step4.cpp similarity index 76% rename from tutorials/utility_client_tutorial/step4.cpp rename to tutorials/utility_client/step4.cpp index 0675845cf4..9c2a00bb52 100644 --- a/tutorials/utility_client_tutorial/step4.cpp +++ b/tutorials/utility_client/step4.cpp @@ -1,3 +1,33 @@ +/* + * Copyright (c) 2014, Peter Thorson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the WebSocket++ Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// **NOTE:** This file is a snapshot of the WebSocket++ utility client tutorial. +// Additional related material can be found in the tutorials/utility_client +// directory of the WebSocket++ repository. + #include #include diff --git a/tutorials/utility_client_tutorial/step5.cpp b/tutorials/utility_client/step5.cpp similarity index 82% rename from tutorials/utility_client_tutorial/step5.cpp rename to tutorials/utility_client/step5.cpp index cf40add46c..130c608d6a 100644 --- a/tutorials/utility_client_tutorial/step5.cpp +++ b/tutorials/utility_client/step5.cpp @@ -1,3 +1,33 @@ +/* + * Copyright (c) 2014, Peter Thorson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the WebSocket++ Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// **NOTE:** This file is a snapshot of the WebSocket++ utility client tutorial. +// Additional related material can be found in the tutorials/utility_client +// directory of the WebSocket++ repository. + #include #include diff --git a/tutorials/utility_client_tutorial/utility_client.md b/tutorials/utility_client/utility_client.md similarity index 100% rename from tutorials/utility_client_tutorial/utility_client.md rename to tutorials/utility_client/utility_client.md diff --git a/tutorials/utility_client_tutorial/step1.cpp b/tutorials/utility_client_tutorial/step1.cpp deleted file mode 100644 index 5bcabb3fc4..0000000000 --- a/tutorials/utility_client_tutorial/step1.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -int main() { - bool done = false; - std::string input; - - while (!done) { - std::cout << "Enter Command: "; - std::getline(std::cin, input); - - if (input == "quit") { - done = true; - } else if (input == "help") { - std::cout - << "\nCommand List:\n" - << "help: Display this help text\n" - << "quit: Exit the program\n" - << std::endl; - } else { - std::cout << "Unrecognized Command" << std::endl; - } - } - - return 0; -} diff --git a/tutorials/utility_client_tutorial/step2.cpp b/tutorials/utility_client_tutorial/step2.cpp deleted file mode 100644 index 697888252c..0000000000 --- a/tutorials/utility_client_tutorial/step2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -#include -#include - -typedef websocketpp::client client; - -int main() { - bool done = false; - std::string input; - - while (!done) { - std::cout << "Enter Command: "; - std::getline(std::cin, input); - - if (input == "quit") { - done = true; - } else if (input == "help") { - std::cout - << "\nCommand List:\n" - << "help: Display this help text\n" - << "quit: Exit the program\n" - << std::endl; - } else { - std::cout << "Unrecognized Command" << std::endl; - } - } - - return 0; -} diff --git a/tutorials/utility_client_tutorial/step3.cpp b/tutorials/utility_client_tutorial/step3.cpp deleted file mode 100644 index f938ac447f..0000000000 --- a/tutorials/utility_client_tutorial/step3.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include - -#include -#include - -#include -#include - -typedef websocketpp::client client; - -class websocket_endpoint { -public: - websocket_endpoint () { - m_endpoint.clear_access_channels(websocketpp::log::alevel::all); - m_endpoint.clear_error_channels(websocketpp::log::elevel::all); - - m_endpoint.init_asio(); - m_endpoint.start_perpetual(); - - m_thread.reset(new websocketpp::lib::thread(&client::run, &m_endpoint)); - } -private: - client m_endpoint; - websocketpp::lib::shared_ptr m_thread; -}; - -int main() { - bool done = false; - std::string input; - websocket_endpoint endpoint; - - while (!done) { - std::cout << "Enter Command: "; - std::getline(std::cin, input); - - if (input == "quit") { - done = true; - } else if (input == "help") { - std::cout - << "\nCommand List:\n" - << "help: Display this help text\n" - << "quit: Exit the program\n" - << std::endl; - } else { - std::cout << "Unrecognized Command" << std::endl; - } - } - - return 0; -}