Skip to content

Commit af2a359

Browse files
committed
Work on RawStorage and StatusCode APIs
1 parent 68fbf51 commit af2a359

File tree

114 files changed

+1186
-484
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1186
-484
lines changed

Doxymain.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,26 @@ We will assume that the data is initially stored in a `std::vector`.
2626

2727
#### Pure STL solution
2828

29-
```
29+
```cpp
3030
template <class Predicate, class Action>
3131
void processActionIf(Predicate predicate, Action action){
32-
std::vector<std::shared_ptr<GuiComponent>> components = GUI.getComponents();
33-
for(GuiComponent& component : components){
32+
for(std::shared_ptr<GuiComponent>& component : GUI.getComponents()){
3433
if(predicate(component))
3534
action(component);
36-
}
35+
} //raw loops :c
3736
}
3837

3938
// OR
4039

4140
template <class Predicate, class Action>
4241
void processActionIf(Predicate predicate, Action action){
4342
std::vector<std::shared_ptr<GuiComponent>> components = GUI.getComponents();
43+
4444
std::vector<std::shared_ptr<GuiComponent>> filtered;
45-
4645
std::copy_if(begin(components), end(components), emplace_back(filtered), predicate);
4746
std::for_each(begin(filtered), end(filtered), action);
47+
48+
//if we had a std::do_if we wouldn't need a second vector
4849
}
4950
```
5051
@@ -56,7 +57,7 @@ In this simple use-case, using a for-loop reduces the amount of unnecessary copi
5657
5758
#### Stream API
5859
59-
```
60+
```cpp
6061
template <class Predicate, class Action>
6162
void processActionIf(Predicate predicate, Action action){
6263
streamFrom(GUI.getComponents())
@@ -117,13 +118,14 @@ You can have a look at `unique` to see how an operator is built on top of anothe
117118

118119
Let's say you have
119120

120-
```
121+
```cpp
121122
std::vector<SpecialElement> v = streamFrom(container)
122123
| map(&Element::getSpecialId)
123124
| unique()
124125
| filter(startsWith("s", Case::INSENSITIVE))
125-
| map(+[](const SpecialId& id){ return SpecialHub::from(id, Checks::NONE); })
126-
| pack::toVector();
126+
| map(+[](const SpecialId& id){
127+
return SpecialHub::from(id, Checks::NONE);
128+
}) | pack::toVector();
127129
```
128130

129131

@@ -132,7 +134,7 @@ std::vector<SpecialElement> v = streamFrom(container)
132134

133135
This is roughly equivalent to
134136

135-
```
137+
```cpp
136138
std::vector<SpecialElement> v;
137139
std::set<SpecialId> tagged;
138140

@@ -173,7 +175,7 @@ The async API is a set of tools that abstract away all the burden of maintaining
173175

174176
Used with `scl::async::with`, an abstraction over resource management (e.g. you could adapt it for the filesystem), it becomes one of the most useful tools to use the Monitor pattern :
175177

176-
```c++
178+
```cpp
177179
#include "Queue.h"
178180
#include <scl/async/async.hpp>
179181
#include <scl/utils/utils.hpp>
@@ -182,7 +184,7 @@ using namespace scl::async;
182184
using namespace scl::utils;
183185

184186
template <class T>
185-
class AsyncQueue{
187+
class AsyncQueue{ //kind of a Monitor
186188
protected:
187189
Mutexed<Queue<T>> queue = {};
188190

@@ -222,7 +224,7 @@ Why the use of functions instead of wrapping in a block? It's nicer to read and
222224
223225
* you need to remember to put the block of code around the exact portion of code that should be mutually exclusive
224226
* you need to have a ready to go RAII lock or a way to emulate it (e.g. `lock` and `unlock`)
225-
* the syntax is quite ugly
227+
* the syntax is quite ugly (blocks everywhere)
226228
227229
228230

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Support Class Library
2+
***<u>WARNING:</u> This is currently a Work In Progress***
3+
4+
5+
26
The SCL is a set of tools providing classes and utility functions that aim to ease the development of your applications.
37

48

@@ -31,6 +35,7 @@ Here is the namespace hierarchy:
3135
* [operators](./include/scl/stream/operators/operators.hpp) - Grouping intermediate stream operation functions
3236
* [terminators](./include/scl/stream/terminators/terminators.hpp) - Grouping end of stream operation functions
3337
* [async](./async/async.hpp) - The asynchronous programming API
38+
* [http]( ./http/http.hpp ) - The HTTP API
3439

3540

3641

@@ -42,6 +47,7 @@ Here are some [macros](./include/scl/macros.h) and their meaning:
4247
* `assert_concept` - Compile time assertions of concepts outside of a block of code (must be simple concepts, not aggregates (e.g. `Copyable ` vs `Invocable`))
4348
* `static_require` - Require concepts without giving an additional error message
4449
* `META` - The fully qualified namespace path to the `meta` namespace (actually is `scl::tools::meta`)
50+
* `asString` - The function that converts a variable to `std::string` using its `ToString` specialization
4551
* Flags
4652
* `SCL_CPP14` - Define this flag to use the C++14 add-ons (e.g. `is_final_t`)
4753
* `SCL_CPP17` - Define this flag to use the C++17 add-ons (e.g. `is_swappable_t`)

doc/html/_doxymain_8md_source.html

+1-1
Large diffs are not rendered by default.

doc/html/_either_8h_source.html

+5-5
Large diffs are not rendered by default.

doc/html/_raw_storage_8h_source.html

+12-11
Large diffs are not rendered by default.

doc/html/_status_code_8h_source.html

+4-4
Large diffs are not rendered by default.

doc/html/annotated.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,10 @@
207207
<tr id="row_0_6_4_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_none.html" target="_self">None</a></td><td class="desc">An empty class serving as the type of an empty Optional&lt;T&gt; </td></tr>
208208
<tr id="row_0_6_5_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classscl_1_1utils_1_1_optional.html" target="_self">Optional</a></td><td class="desc">A class that allows the use of optional types (might be there) </td></tr>
209209
<tr id="row_0_6_6_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_placeholder.html" target="_self">Placeholder</a></td><td class="desc">Class representing parameter/return argument placholders </td></tr>
210-
<tr id="row_0_6_7_"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span id="arr_0_6_7_" class="arrow" onclick="toggleFolder('0_6_7_')">&#9658;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classscl_1_1utils_1_1_raw_storage.html" target="_self">RawStorage</a></td><td class="desc">Class that handles raw storage (and manual memory management) for a variable type </td></tr>
211-
<tr id="row_0_6_7_0_" class="even" style="display:none;"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="unionscl_1_1utils_1_1_raw_storage_1_1storage__type.html" target="_self">storage_type</a></td><td class="desc">Union that stores the data type uninitialized </td></tr>
210+
<tr id="row_0_6_7_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classscl_1_1utils_1_1_raw_storage.html" target="_self">RawStorage</a></td><td class="desc">Class that handles raw storage (and manual memory management) for a variable type </td></tr>
212211
<tr id="row_0_6_8_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_to_string.html" target="_self">ToString</a></td><td class="desc"></td></tr>
213212
<tr id="row_0_6_9_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_to_string_3_01_none_01_4.html" target="_self">ToString&lt; None &gt;</a></td><td class="desc">A specialization of <a class="el" href="structscl_1_1utils_1_1_to_string.html">ToString</a> for <a class="el" href="structscl_1_1utils_1_1_none.html" title="An empty class serving as the type of an empty Optional&lt;T&gt; ">None</a> type </td></tr>
214-
<tr id="row_0_6_10_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_to_string_3_01scl_1_1http_1_1_status_code_00_01void_01_4.html" target="_self">ToString&lt; scl::http::StatusCode, void &gt;</a></td><td class="desc"></td></tr>
213+
<tr id="row_0_6_10_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_to_string_3_01scl_1_1http_1_1_status_code_01_4.html" target="_self">ToString&lt; scl::http::StatusCode &gt;</a></td><td class="desc"></td></tr>
215214
<tr id="row_0_6_11_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_to_string_3_01scl_1_1http_1_1_version_00_01void_01_4.html" target="_self">ToString&lt; scl::http::Version, void &gt;</a></td><td class="desc"></td></tr>
216215
<tr id="row_0_6_12_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_to_string_3_01_t_00_01scl_1_1tools_1_1meta_01_1_1enable__if__t_3_01scl_1_ab318f07506cea75df6fc972952f6e8a.html" target="_self">ToString&lt; T, scl::tools::meta ::enable_if_t&lt; scl::tools::meta ::is_base_of&lt; scl::exceptions::Throwable, T &gt;() &gt; &gt;</a></td><td class="desc">Specialization of <a class="el" href="structscl_1_1utils_1_1_to_string.html">ToString</a> for Throwable types </td></tr>
217216
<tr id="row_0_6_13_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structscl_1_1utils_1_1_to_string_3_01_t_00_01scl_1_1tools_1_1meta_01_1_1void__t_3_01scl_1_1tools514ea4627300a8dd6ff0eeaaa38c785b.html" target="_self">ToString&lt; T, scl::tools::meta ::void_t&lt; scl::tools::meta ::enable_if_t&lt; scl::tools::meta ::is_same&lt; T, char &gt;()||scl::tools::meta ::is_same&lt; T, const char * &gt;()||scl::tools::meta ::is_same&lt; T, std::string &gt;() &gt; &gt; &gt;</a></td><td class="desc">Specialization for types convertible to string </td></tr>

0 commit comments

Comments
 (0)