From e4d403b58fa0fd10740fa3088c6c993b3ec69f66 Mon Sep 17 00:00:00 2001 From: Sergey Naumov Date: Sun, 4 Sep 2016 17:55:10 +0300 Subject: [PATCH] auss isn't a submodule anymore --- .gitmodules | 3 --- 3rd/auss | 1 - 3rd/auss/LICENSE | 24 ++++++++++++++++++++ 3rd/auss/README.md | 27 ++++++++++++++++++++++ 3rd/auss/include/auss.hpp | 47 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 4 deletions(-) delete mode 100644 .gitmodules delete mode 160000 3rd/auss create mode 100644 3rd/auss/LICENSE create mode 100644 3rd/auss/README.md create mode 100644 3rd/auss/include/auss.hpp diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index b1171d0..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "3rd/auss"] - path = 3rd/auss - url = https://github.com/drmgc/auss.git diff --git a/3rd/auss b/3rd/auss deleted file mode 160000 index efc484e..0000000 --- a/3rd/auss +++ /dev/null @@ -1 +0,0 @@ -Subproject commit efc484eebb1a972ca334b1a70e047579323f1421 diff --git a/3rd/auss/LICENSE b/3rd/auss/LICENSE new file mode 100644 index 0000000..00d2e13 --- /dev/null +++ b/3rd/auss/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to \ No newline at end of file diff --git a/3rd/auss/README.md b/3rd/auss/README.md new file mode 100644 index 0000000..1cfbe43 --- /dev/null +++ b/3rd/auss/README.md @@ -0,0 +1,27 @@ +# AutoStringStream ![license](https://img.shields.io/npm/l/chas-storage.svg) + +Simple header-only wrapper on `std::stringstream` with automatic casting to `std::string` + +## Usage + +```c++ +#include +``` +```c++ +auss_t() << "Hello, " << user_name +``` +```c++ +throw std::runtime_error(auss_t() << "Something gone wrong, See " << log_path) +``` + +### Own namespace +If you wouldn't pollute global namespace just define `AUSS_USE_OWN_NAMESPACE`. Either before `#include` or in compiler flags (`-DAUSS_USE_OWN_NAMESPACE` for GCC). + +Also you can specifiy the name of namespace with `AUSS_OWN_NAMESPACE_NAME`: +``` +-DAUSS_OWN_NAMESPACE_NAME="theauss" +``` + +## License + +Licensed under Unlicense. See `LICENSE` file for more info. diff --git a/3rd/auss/include/auss.hpp b/3rd/auss/include/auss.hpp new file mode 100644 index 0000000..9f38d3a --- /dev/null +++ b/3rd/auss/include/auss.hpp @@ -0,0 +1,47 @@ +#pragma once + +#define AUSS_HPP + +#include + +#ifdef AUSS_USE_OWN_NAMESPACE + #ifndef AUSS_OWN_NAMESPACE_NAME + #define AUSS_OWN_NAMESPACE_NAME auss + #endif +namespace AUSS_OWN_NAMESPACE_NAME { +#endif + +class AutoStringStream { +public: + AutoStringStream() : m_stream() {} + virtual ~AutoStringStream() {} + + template + AutoStringStream& operator<<(const T& arg) { + m_stream << arg; + return *this; + } + + AutoStringStream& operator<<(const bool arg) { + m_stream << (arg ? "true" : "false"); + return *this; + } + + operator std::string() const { + return m_stream.str(); + } + + const std::string to_string() const { + return m_stream.str(); + } +private: + std::stringstream m_stream; +}; + +#ifndef AUSS_CUSTOM_TYPEDEF +typedef AutoStringStream auss_t; +#endif + +#ifdef AUSS_USE_OWN_NAMESPACE +} +#endif