mirror of
https://github.com/red0124/ssp.git
synced 2025-12-14 21:59:55 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b928de086 | ||
| 6edce88d79 | |||
|
|
6196f7796b | ||
| 5672aa635e | |||
| 3eefac93b1 | |||
| 774f452689 |
21
README.md
21
README.md
@@ -53,20 +53,20 @@ Brian S. Wolfe 40 1.9
|
|||||||
Bill (Heath) Gates 65 3.3
|
Bill (Heath) Gates 65 3.3
|
||||||
```
|
```
|
||||||
# Features
|
# Features
|
||||||
* [Works on any type](#Custom-conversions)
|
* [Works on any type](#custom-conversions)
|
||||||
* Easy to use
|
* Easy to use
|
||||||
* No exceptions
|
* No exceptions
|
||||||
* [Works with headers](#Headers)
|
* [Works with headers](#headers)
|
||||||
* [Works with quotes, escapes and spacings](#Setup)
|
* [Works with quotes, escapes and spacings](#setup)
|
||||||
* [Works with values containing new lines](#Multiline)
|
* [Works with values containing new lines](#multiline)
|
||||||
* [Columns and rows can be ignored](#Special-types)
|
* [Columns and rows can be ignored](#special-types)
|
||||||
* Works with any type of delimiter
|
* Works with any type of delimiter
|
||||||
* Can return whole objects composed of converted values
|
* Can return whole objects composed of converted values
|
||||||
* [Descriptive error handling can be enabled](#Error-handling)
|
* [Descriptive error handling can be enabled](#error-handling)
|
||||||
* [Restrictions can be added for each column](#Restrictions)
|
* [Restrictions can be added for each column](#restrictions)
|
||||||
* [Works with `std::optional` and `std::variant`](#Special-types)
|
* [Works with `std::optional` and `std::variant`](#special-types)
|
||||||
* Works with **`CRLF`** and **`LF`**
|
* Works with **`CRLF`** and **`LF`**
|
||||||
* [Conversions can be chained if invalid](#Substitute-conversions)
|
* [Conversions can be chained if invalid](#substitute-conversions)
|
||||||
* Fast
|
* Fast
|
||||||
|
|
||||||
# Single header
|
# Single header
|
||||||
@@ -378,7 +378,7 @@ if(std::holds_alternative<float>(grade)) {
|
|||||||
```
|
```
|
||||||
## Restrictions
|
## Restrictions
|
||||||
|
|
||||||
Custom **`restrictions`** can be used to narrow down the conversions of unwanted values. **`ss::ir`** (in range) and **`ss::ne`** (none empty) are one of those:
|
Custom **`restrictions`** can be used to narrow down the conversions of unwanted values. **`ss::ir`** (in range) and **`ss::ne`** (none empty) are some of those:
|
||||||
```cpp
|
```cpp
|
||||||
// ss::ne makes sure that the name is not empty
|
// ss::ne makes sure that the name is not empty
|
||||||
// ss::ir makes sure that the grade will be in range [0, 10]
|
// ss::ir makes sure that the grade will be in range [0, 10]
|
||||||
@@ -472,7 +472,6 @@ The delimiter is " ", and the number of columns varies depending on which shape
|
|||||||
```cpp
|
```cpp
|
||||||
ss::parser p{"shapes.txt", " "};
|
ss::parser p{"shapes.txt", " "};
|
||||||
if (!p.valid()) {
|
if (!p.valid()) {
|
||||||
std::cout << p.error_msg() << std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ private:
|
|||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
const split_data& resplit(line_ptr_type new_line, ssize_t new_size,
|
const split_data& resplit(line_ptr_type new_line, ssize_t new_size,
|
||||||
const std::string& delim = default_delimiter) {
|
const std::string& delim) {
|
||||||
return splitter_.resplit(new_line, new_size, delim);
|
return splitter_.resplit(new_line, new_size, delim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
struct iterable {
|
struct iterable {
|
||||||
struct iterator {
|
struct iterator {
|
||||||
using value = std::conditional_t<get_object, T,
|
using value = std::conditional_t<get_object, T,
|
||||||
no_void_validator_tup_t<T, Ts...>>;
|
no_void_validator_tup_t<T, Ts...>>;
|
||||||
|
|
||||||
iterator() : parser_{nullptr} {
|
iterator() : parser_{nullptr} {
|
||||||
}
|
}
|
||||||
@@ -623,7 +623,8 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
next_line_converter_.resplit(next_line_buffer_, size);
|
next_line_converter_.resplit(next_line_buffer_, size,
|
||||||
|
delim_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
ssp.hpp
2
ssp.hpp
@@ -775,7 +775,7 @@ struct get_matcher<Matcher, T, Ts...> {
|
|||||||
struct is_matcher : is_instance_of_matcher<U, Matcher> {};
|
struct is_matcher : is_instance_of_matcher<U, Matcher> {};
|
||||||
|
|
||||||
static_assert(count_v<is_matcher, T, Ts...> <= 1,
|
static_assert(count_v<is_matcher, T, Ts...> <= 1,
|
||||||
"the same matcher is cannot"
|
"the same matcher cannot"
|
||||||
"be defined multiple times");
|
"be defined multiple times");
|
||||||
using type = std::conditional_t<is_matcher<T>::value, T,
|
using type = std::conditional_t<is_matcher<T>::value, T,
|
||||||
typename get_matcher<Matcher, Ts...>::type>;
|
typename get_matcher<Matcher, Ts...>::type>;
|
||||||
|
|||||||
Reference in New Issue
Block a user