NSVD Reader  0.0.1
nodamushi::svd::value< T, attribute, required, name > Struct Template Reference

This class reperesents SVD(xml) element / attribute. More...

#include <value.hpp>

Public Types

using this_t = value< T, attribute, required, name... >
 
using value_type_t = ::nodamushi::svd::vattr_unwrap< T >
 
using type = typename value_type_t::type
 

Public Member Functions

 value ()
 default constructor More...
 
 value (const type &t)
 constructor with initial value More...
 
 value (value &&)=default
 move constrocutor More...
 
constexpr bool is_required () const noexcept
 
constexpr bool is_attribute () const noexcept
 
std::string get_name () const noexcept
 
template<typename SVD >
auto operator= (SVD &src) -> typename std::enable_if< std::is_base_of< svd_reader, SVD >::value, bool >::type
 set value from SVD reader More...
 
template<typename SVD >
auto operator= (SVD &&src) -> typename std::enable_if< std::is_base_of< svd_reader, SVD >::value, bool >::type
 set value from SVD reader More...
 
template<typename V >
auto operator= (const V &value) -> typename std::enable_if<!std::is_base_of< svd_reader, V >::value, this_t & >::type
 set value. More...
 
template<typename V >
this_toperator= (V &&value)
 set value. More...
 
void clear () noexcept
 clear this object. After calling this method,this object status will be empty. More...
 
valueoperator= (value &&)=default
 move More...
 
valueoperator= (const value &)=default
 copy More...
 
const typeget () const
 get value More...
 
typeget ()
 get value More...
 
typeoperator * ()
 get value More...
 
const typeoperator * () const
 get value More...
 
typeoperator-> ()
 -> More...
 
const typeoperator-> () const
 -> More...
 
bool operator== (const type &t) const noexcept
 value == t More...
 
bool operator!= (const type &t) const noexcept
 value != t More...
 
bool operator== (type &&t) const noexcept
 value == t More...
 
bool operator!= (type &&t) const noexcept
 value != t More...
 
bool operator== (const value &t) const noexcept
 value == t More...
 
bool operator!= (const value &&t) const noexcept
 value != t More...
 
typeget_for_init () noexcept
 Get value to initialize. After this method is called, empty() method returns false. More...
 
typeget (type &defaultValue) noexcept
 get or else More...
 
typeget (type &&defaultValue) noexcept
 get or else More...
 
const typeget (const type &defaultValue) const noexcept
 get or else More...
 
bool empty () const noexcept
 when this object is empty,return true. More...
 
 operator bool () const noexcept
 ! empty() More...
 
bool check_require () const noexcept
 Check not empty if this element/attribute is required. More...
 

Static Public Attributes

static constexpr bool REQUIRED =required
 
static constexpr bool ATTRIBUTE =attribute
 

Detailed Description

template<typename T, bool attribute, bool required, char... name>
struct nodamushi::svd::value< T, attribute, required, name >

This class reperesents SVD(xml) element / attribute.

This class has two states that this class object has value or empty, like an optional type.
When the state of this class object is empty, reading the value will result in an error. Check the status before accessing the value.
Parameters
Ttype of value
attributetrue: attribute, false: element
required
nameelement/attribute name
See also
empty_value_access_error

Definition at line 53 of file value.hpp.

Member Typedef Documentation

◆ this_t

template<typename T, bool attribute, bool required, char... name>
using nodamushi::svd::value< T, attribute, required, name >::this_t = value<T,attribute,required,name...>

Definition at line 55 of file value.hpp.

◆ type

template<typename T, bool attribute, bool required, char... name>
using nodamushi::svd::value< T, attribute, required, name >::type = typename value_type_t::type

Definition at line 57 of file value.hpp.

◆ value_type_t

template<typename T, bool attribute, bool required, char... name>
using nodamushi::svd::value< T, attribute, required, name >::value_type_t = ::nodamushi::svd::vattr_unwrap<T>

Definition at line 56 of file value.hpp.

Constructor & Destructor Documentation

◆ value() [1/3]

template<typename T, bool attribute, bool required, char... name>
nodamushi::svd::value< T, attribute, required, name >::value ( )
inline

default constructor

Definition at line 64 of file value.hpp.

◆ value() [2/3]

template<typename T, bool attribute, bool required, char... name>
nodamushi::svd::value< T, attribute, required, name >::value ( const type t)
inline

constructor with initial value

Definition at line 66 of file value.hpp.

◆ value() [3/3]

template<typename T, bool attribute, bool required, char... name>
nodamushi::svd::value< T, attribute, required, name >::value ( value< T, attribute, required, name > &&  )
default

move constrocutor

Member Function Documentation

◆ check_require()

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::check_require ( ) const
inlinenoexcept

Check not empty if this element/attribute is required.

Returns
is_required() ? !empty() : true ;
See also
is_required()

Definition at line 276 of file value.hpp.

◆ clear()

template<typename T , bool attribute, bool required, char... name>
void nodamushi::svd::value< T, attribute, required, name >::clear ( )
noexcept

clear this object. After calling this method,this object status will be empty.

Definition at line 87 of file imple.hpp.

◆ empty()

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::empty ( ) const
inlinenoexcept

when this object is empty,return true.

Returns
when this object is empty,return true.

Definition at line 263 of file value.hpp.

◆ get() [1/5]

template<typename T , bool attribute, bool required, char... name>
const details::value_type_t< T > & nodamushi::svd::value< T, attribute, required, name >::get ( ) const

get value

Returns
value reference.
Exceptions
empty_value_access_error: when this object is empty.

Definition at line 76 of file imple.hpp.

◆ get() [2/5]

template<typename T , bool attribute, bool required, char... name>
details::value_type_t< T > & nodamushi::svd::value< T, attribute, required, name >::get ( )

get value

Returns
value reference.
Exceptions
empty_value_access_error: when this object is empty.

Definition at line 81 of file imple.hpp.

◆ get() [3/5]

template<typename T, bool attribute, bool required, char... name>
type& nodamushi::svd::value< T, attribute, required, name >::get ( type defaultValue)
inlinenoexcept

get or else

Parameters
defaultValuereturn value when this object is empty.
Returns
value or defaultValue

Definition at line 243 of file value.hpp.

◆ get() [4/5]

template<typename T, bool attribute, bool required, char... name>
type& nodamushi::svd::value< T, attribute, required, name >::get ( type &&  defaultValue)
inlinenoexcept

get or else

Parameters
defaultValuereturn value when this object is empty.
Returns
value or defaultValue

Definition at line 249 of file value.hpp.

◆ get() [5/5]

template<typename T, bool attribute, bool required, char... name>
const type& nodamushi::svd::value< T, attribute, required, name >::get ( const type defaultValue) const
inlinenoexcept

get or else

Parameters
defaultValuereturn value when this object is empty.
Returns
value or defaultValue

Definition at line 255 of file value.hpp.

◆ get_for_init()

template<typename T, bool attribute, bool required, char... name>
type& nodamushi::svd::value< T, attribute, required, name >::get_for_init ( )
inlinenoexcept

Get value to initialize. After this method is called, empty() method returns false.

Returns
value reference

Definition at line 237 of file value.hpp.

◆ get_name()

template<typename T , bool attribute, bool required, char... name>
std::string nodamushi::svd::value< T, attribute, required, name >::get_name ( ) const
noexcept
Returns
this element/attribute name.

Definition at line 66 of file imple.hpp.

◆ is_attribute()

template<typename T, bool attribute, bool required, char... name>
constexpr bool nodamushi::svd::value< T, attribute, required, name >::is_attribute ( ) const
inlinenoexcept
Returns
this property is an attribute

Definition at line 74 of file value.hpp.

◆ is_required()

template<typename T, bool attribute, bool required, char... name>
constexpr bool nodamushi::svd::value< T, attribute, required, name >::is_required ( ) const
inlinenoexcept
Returns
this property is required

Definition at line 72 of file value.hpp.

◆ operator *() [1/2]

template<typename T, bool attribute, bool required, char... name>
type& nodamushi::svd::value< T, attribute, required, name >::operator * ( )
inline

get value

Returns
value reference.
Exceptions
empty_value_access_error: when this object is empty.

Definition at line 164 of file value.hpp.

◆ operator *() [2/2]

template<typename T, bool attribute, bool required, char... name>
const type& nodamushi::svd::value< T, attribute, required, name >::operator * ( ) const
inline

get value

Returns
value reference.
Exceptions
empty_value_access_error: when this object is empty.

Definition at line 170 of file value.hpp.

◆ operator bool()

template<typename T, bool attribute, bool required, char... name>
nodamushi::svd::value< T, attribute, required, name >::operator bool ( ) const
inlinenoexcept

! empty()

See also
empty()

Definition at line 268 of file value.hpp.

◆ operator!=() [1/3]

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::operator!= ( const type t) const
inlinenoexcept

value != t

Parameters
t
Returns
when this object is empty, this method will return true. Otherwise, return value != t.

Definition at line 196 of file value.hpp.

◆ operator!=() [2/3]

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::operator!= ( type &&  t) const
inlinenoexcept

value != t

Parameters
t
Returns
when this object is empty, this method will return true. Otherwise, return value != t.

Definition at line 210 of file value.hpp.

◆ operator!=() [3/3]

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::operator!= ( const value< T, attribute, required, name > &&  t) const
inlinenoexcept

value != t

Parameters
t
Returns
If this object and t are empty, return false. If either this object or t is empty, this method will return true. Otherwise, return value != t.

Definition at line 229 of file value.hpp.

◆ operator->() [1/2]

template<typename T, bool attribute, bool required, char... name>
type* nodamushi::svd::value< T, attribute, required, name >::operator-> ( )
inline

->

Returns
value pointer
Exceptions
empty_value_access_error: when this object is empty.

Definition at line 176 of file value.hpp.

◆ operator->() [2/2]

template<typename T, bool attribute, bool required, char... name>
const type* nodamushi::svd::value< T, attribute, required, name >::operator-> ( ) const
inline

->

Returns
value pointer
Exceptions
empty_value_access_error: when this object is empty.

Definition at line 182 of file value.hpp.

◆ operator=() [1/6]

template<typename T, bool attribute, bool required, char... name>
template<typename SVD >
auto nodamushi::svd::value< T, attribute, required, name >::operator= ( SVD &  src) -> typename std::enable_if<std::is_base_of<svd_reader,SVD>::value ,bool>::type
inline

set value from SVD reader

Returns
success(true) or fail(false)

Definition at line 84 of file value.hpp.

◆ operator=() [2/6]

template<typename T, bool attribute, bool required, char... name>
template<typename SVD >
auto nodamushi::svd::value< T, attribute, required, name >::operator= ( SVD &&  src) -> typename std::enable_if<std::is_base_of<svd_reader,SVD>::value ,bool>::type
inline

set value from SVD reader

Returns
success(true) or fail(false)

Definition at line 98 of file value.hpp.

◆ operator=() [3/6]

template<typename T, bool attribute, bool required, char... name>
template<typename V >
auto nodamushi::svd::value< T, attribute, required, name >::operator= ( const V &  value) -> typename std::enable_if<!std::is_base_of<svd_reader,V>::value ,this_t&>::type
inline

set value.

Parameters
valuenew value
Returns
this object reference

Definition at line 113 of file value.hpp.

◆ operator=() [4/6]

template<typename T, bool attribute, bool required, char... name>
template<typename V >
this_t& nodamushi::svd::value< T, attribute, required, name >::operator= ( V &&  value)
inline

set value.

Parameters
valuenew value
Returns
this object reference

Definition at line 125 of file value.hpp.

◆ operator=() [5/6]

template<typename T, bool attribute, bool required, char... name>
value& nodamushi::svd::value< T, attribute, required, name >::operator= ( value< T, attribute, required, name > &&  )
default

move

◆ operator=() [6/6]

template<typename T, bool attribute, bool required, char... name>
value& nodamushi::svd::value< T, attribute, required, name >::operator= ( const value< T, attribute, required, name > &  )
default

copy

◆ operator==() [1/3]

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::operator== ( const type t) const
inlinenoexcept

value == t

Parameters
t
Returns
when this object is empty, this method will return false. when this object has value, return value == t.

Definition at line 189 of file value.hpp.

◆ operator==() [2/3]

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::operator== ( type &&  t) const
inlinenoexcept

value == t

Parameters
t
Returns
when this object is empty, this method will return false. Otherwise, return value == t.

Definition at line 203 of file value.hpp.

◆ operator==() [3/3]

template<typename T, bool attribute, bool required, char... name>
bool nodamushi::svd::value< T, attribute, required, name >::operator== ( const value< T, attribute, required, name > &  t) const
inlinenoexcept

value == t

Parameters
t
Returns
If this object and t are empty, return true. If either this object or t is empty, this method will return false. Otherwise, return value == t.

Definition at line 219 of file value.hpp.

Member Data Documentation

◆ ATTRIBUTE

template<typename T, bool attribute, bool required, char... name>
constexpr bool nodamushi::svd::value< T, attribute, required, name >::ATTRIBUTE =attribute
static

Definition at line 60 of file value.hpp.

◆ REQUIRED

template<typename T, bool attribute, bool required, char... name>
constexpr bool nodamushi::svd::value< T, attribute, required, name >::REQUIRED =required
static

Definition at line 59 of file value.hpp.


The documentation for this struct was generated from the following files: