Skip to content

Commit f6bc402

Browse files
committed
Add percentile reader
Some things want to specify a percent as a percentile in JSON
1 parent 0c8c384 commit f6bc402

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/generic_factory.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,6 +2050,12 @@ class nc_color_reader : public generic_typed_reader<nc_color_reader>
20502050
nc_color get_next( const JsonValue &jv ) const;
20512051
};
20522052

2053+
struct percentile_reader : public generic_typed_reader<percentile_reader> {
2054+
double get_next( const JsonValue &jv ) const {
2055+
return jv.get_float() / 100.0;
2056+
}
2057+
};
2058+
20532059
template<typename T>
20542060
static T bound_check( T low, T high, const JsonValue &jv, T read_value )
20552061
{

0 commit comments

Comments
 (0)