Skip to content

Commit e4d403b

Browse files
committed
auss isn't a submodule anymore
1 parent 6373790 commit e4d403b

File tree

5 files changed

+98
-4
lines changed

5 files changed

+98
-4
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

3rd/auss

Lines changed: 0 additions & 1 deletion
This file was deleted.

3rd/auss/LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org/>

3rd/auss/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# AutoStringStream ![license](https://img.shields.io/npm/l/chas-storage.svg)
2+
3+
Simple header-only wrapper on `std::stringstream` with automatic casting to `std::string`
4+
5+
## Usage
6+
7+
```c++
8+
#include <auss.hpp>
9+
```
10+
```c++
11+
auss_t() << "Hello, " << user_name
12+
```
13+
```c++
14+
throw std::runtime_error(auss_t() << "Something gone wrong, See " << log_path)
15+
```
16+
17+
### Own namespace
18+
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).
19+
20+
Also you can specifiy the name of namespace with `AUSS_OWN_NAMESPACE_NAME`:
21+
```
22+
-DAUSS_OWN_NAMESPACE_NAME="theauss"
23+
```
24+
25+
## License
26+
27+
Licensed under Unlicense. See `LICENSE` file for more info.

3rd/auss/include/auss.hpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#pragma once
2+
3+
#define AUSS_HPP
4+
5+
#include <sstream>
6+
7+
#ifdef AUSS_USE_OWN_NAMESPACE
8+
#ifndef AUSS_OWN_NAMESPACE_NAME
9+
#define AUSS_OWN_NAMESPACE_NAME auss
10+
#endif
11+
namespace AUSS_OWN_NAMESPACE_NAME {
12+
#endif
13+
14+
class AutoStringStream {
15+
public:
16+
AutoStringStream() : m_stream() {}
17+
virtual ~AutoStringStream() {}
18+
19+
template<typename T>
20+
AutoStringStream& operator<<(const T& arg) {
21+
m_stream << arg;
22+
return *this;
23+
}
24+
25+
AutoStringStream& operator<<(const bool arg) {
26+
m_stream << (arg ? "true" : "false");
27+
return *this;
28+
}
29+
30+
operator std::string() const {
31+
return m_stream.str();
32+
}
33+
34+
const std::string to_string() const {
35+
return m_stream.str();
36+
}
37+
private:
38+
std::stringstream m_stream;
39+
};
40+
41+
#ifndef AUSS_CUSTOM_TYPEDEF
42+
typedef AutoStringStream auss_t;
43+
#endif
44+
45+
#ifdef AUSS_USE_OWN_NAMESPACE
46+
}
47+
#endif

0 commit comments

Comments
 (0)