auss isn't a submodule anymore
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "3rd/auss"]
|
||||
path = 3rd/auss
|
||||
url = https://github.com/drmgc/auss.git
|
||||
1
3rd/auss
1
3rd/auss
Submodule 3rd/auss deleted from efc484eebb
24
3rd/auss/LICENSE
Normal file
24
3rd/auss/LICENSE
Normal file
@@ -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 <http://unlicense.org/>
|
||||
27
3rd/auss/README.md
Normal file
27
3rd/auss/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# AutoStringStream 
|
||||
|
||||
Simple header-only wrapper on `std::stringstream` with automatic casting to `std::string`
|
||||
|
||||
## Usage
|
||||
|
||||
```c++
|
||||
#include <auss.hpp>
|
||||
```
|
||||
```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.
|
||||
47
3rd/auss/include/auss.hpp
Normal file
47
3rd/auss/include/auss.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#define AUSS_HPP
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#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<typename T>
|
||||
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
|
||||
Reference in New Issue
Block a user