DAW JSON Link
daw_json_parse_digit.h
Go to the documentation of this file.
1 // Copyright (c) Darrell Wright
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5 //
6 // Official repository: https://github.com/beached/daw_json_link
7 //
8 
9 #pragma once
10 
11 #include "version.h"
12 
13 #include <daw/daw_attributes.h>
14 
15 namespace daw::json {
16  inline namespace DAW_JSON_VER {
17  namespace json_details {
18  DAW_ATTRIB_FLATINLINE [[nodiscard]] static inline constexpr unsigned
19  parse_digit( char c ) {
20  return static_cast<unsigned>(
21  static_cast<unsigned char>( static_cast<unsigned char>( c ) -
22  static_cast<unsigned char>( '0' ) ) );
23  }
24 
25  namespace parsed_constants {
26  static inline constexpr unsigned decimal_char = parse_digit( '.' );
27  static inline constexpr unsigned e_char = parse_digit( 'e' );
28  static inline constexpr unsigned E_char = parse_digit( 'E' );
29  static inline constexpr unsigned plus_char = parse_digit( '+' );
30  static inline constexpr unsigned minus_char = parse_digit( '-' );
31  } // namespace parsed_constants
32  } // namespace json_details
33  } // namespace DAW_JSON_VER
34 } // namespace daw::json
Customization point traits.
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.
Definition: version.h:25