libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_string_view.hpp File Reference

Go to the source code of this file.

Data Structures

struct  gbl::StringView
 
struct  std::hash< gbl::StringView >
 

Macros

#define GBL_STRING_VIEW_TO_VALUE_(type, postfix)
 

Functions

template<typename T >
std::optional< T > gbl::string_view_to_value (const StringView &view)
 
template<>
std::optional< bool > gbl::string_view_to_value< bool > (const StringView &view)
 
template<>
std::optional< char > gbl::string_view_to_value< char > (const StringView &view)
 
template<>
std::optional< uint8_t > gbl::string_view_to_value< uint8_t > (const StringView &view)
 
template<>
std::optional< uint16_t > gbl::string_view_to_value< uint16_t > (const StringView &view)
 
template<>
std::optional< int16_t > gbl::string_view_to_value< int16_t > (const StringView &view)
 
template<>
std::optional< uint32_t > gbl::string_view_to_value< uint32_t > (const StringView &view)
 
template<>
std::optional< int32_t > gbl::string_view_to_value< int32_t > (const StringView &view)
 
template<>
std::optional< uint64_t > gbl::string_view_to_value< uint64_t > (const StringView &view)
 
template<>
std::optional< int64_t > gbl::string_view_to_value< int64_t > (const StringView &view)
 
template<>
std::optional< float > gbl::string_view_to_value< float > (const StringView &view)
 
template<>
std::optional< double > gbl::string_view_to_value< double > (const StringView &view)
 
template<>
std::optional< void * > gbl::string_view_to_value< void * > (const StringView &view)
 
consteval StringView gbl::operator""_strv (const char *pString, std::size_t size) noexcept
 

Detailed Description

StringView C++ bindings for GblStringView.

This file contains the gbl::StringView C++ bindings around the GblStringView structure and C API. Along with fully supporting both the C and C++ APIs, gbl::StringView is type-compatible with std::string and std::string_view.

Todo:
  • return iterators from searches
  • implement forward/reverse iteration
Author
2023 Falco Girgis

Definition in file gimbal_string_view.hpp.

Macro Definition Documentation

◆ GBL_STRING_VIEW_TO_VALUE_

#define GBL_STRING_VIEW_TO_VALUE_ (   type,
  postfix 
)

Definition at line 284 of file gimbal_string_view.hpp.

286 { \
287 GblBool ok; \
288 type value = GblStringView_##postfix(view, &ok); \
289 return ok? std::optional{value} : std::nullopt; \
290 }
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)

Function Documentation

◆ string_view_to_value()

template<typename T >
std::optional< T > gbl::string_view_to_value ( const StringView view)

Definition at line 36 of file gimbal_string_view.hpp.

36 {
37 return std::nullopt;
38}

◆ string_view_to_value< bool >()

template<>
std::optional< bool > gbl::string_view_to_value< bool > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< char >()

template<>
std::optional< char > gbl::string_view_to_value< char > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< uint8_t >()

template<>
std::optional< uint8_t > gbl::string_view_to_value< uint8_t > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< uint16_t >()

template<>
std::optional< uint16_t > gbl::string_view_to_value< uint16_t > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< int16_t >()

template<>
std::optional< int16_t > gbl::string_view_to_value< int16_t > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< uint32_t >()

template<>
std::optional< uint32_t > gbl::string_view_to_value< uint32_t > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< int32_t >()

template<>
std::optional< int32_t > gbl::string_view_to_value< int32_t > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< uint64_t >()

template<>
std::optional< uint64_t > gbl::string_view_to_value< uint64_t > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< int64_t >()

template<>
std::optional< int64_t > gbl::string_view_to_value< int64_t > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< float >()

template<>
std::optional< float > gbl::string_view_to_value< float > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< double >()

template<>
std::optional< double > gbl::string_view_to_value< double > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ string_view_to_value< void * >()

template<>
std::optional< void * > gbl::string_view_to_value< void * > ( const StringView view)
inline

Definition at line 36 of file gimbal_string_view.hpp.

◆ operator""_strv()

consteval StringView gbl::operator""_strv ( const char *  pString,
std::size_t  size 
)
inlinenoexcept

Definition at line 307 of file gimbal_string_view.hpp.

307 {
308 return StringView(pString, size);
309}