The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Gaudi::Utils::TypeNameString Class Reference

Helper class to parse a string of format "type/name". More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/TypeNameString.h>

Collaboration diagram for Gaudi::Utils::TypeNameString:

Public Member Functions

template<size_t N>
 TypeNameString (const char(&tn)[N])
 TypeNameString (std::string_view sv)
 TypeNameString (std::string tn)
 TypeNameString (std::string tn, std::string_view deftyp)
template<class T>
requires ( std::is_constructible_v<TypeNameString, decltype( std::declval<const T&>().value() )> )
 TypeNameString (const T &prop)
const std::string & type () const
const std::string & name () const
bool haveType () const

Private Attributes

std::string m_type
std::string m_name
bool m_haveType

Detailed Description

Helper class to parse a string of format "type/name".

Definition at line 19 of file TypeNameString.h.

Constructor & Destructor Documentation

◆ TypeNameString() [1/5]

template<size_t N>
Gaudi::Utils::TypeNameString::TypeNameString ( const char(&) tn[N])
inline

Definition at line 25 of file TypeNameString.h.

25: TypeNameString{ std::string_view{ tn } } {}
TypeNameString(const char(&tn)[N])

◆ TypeNameString() [2/5]

Gaudi::Utils::TypeNameString::TypeNameString ( std::string_view sv)
inline

Definition at line 26 of file TypeNameString.h.

26: TypeNameString{ std::string{ sv } } {}

◆ TypeNameString() [3/5]

Gaudi::Utils::TypeNameString::TypeNameString ( std::string tn)
inline

Definition at line 27 of file TypeNameString.h.

27 : m_type{ std::move( tn ) } {
28 const auto slash_pos = m_type.find_first_of( "/" );
29 m_haveType = slash_pos != std::string::npos;
30 if ( m_haveType ) {
31 m_name = m_type.substr( slash_pos + 1 );
32 m_type.resize( slash_pos );
33 } else
34 m_name = m_type;
35 }

◆ TypeNameString() [4/5]

Gaudi::Utils::TypeNameString::TypeNameString ( std::string tn,
std::string_view deftyp )
inline

Definition at line 37 of file TypeNameString.h.

37 : TypeNameString( std::move( tn ) ) {
38 if ( !m_haveType ) m_type = deftyp;
39 }

◆ TypeNameString() [5/5]

template<class T>
requires ( std::is_constructible_v<TypeNameString, decltype( std::declval<const T&>().value() )> )
Gaudi::Utils::TypeNameString::TypeNameString ( const T & prop)
inline

Definition at line 45 of file TypeNameString.h.

45: TypeNameString( prop.value() ) {}

Member Function Documentation

◆ haveType()

bool Gaudi::Utils::TypeNameString::haveType ( ) const
inline

Definition at line 49 of file TypeNameString.h.

49{ return m_haveType; }

◆ name()

const std::string & Gaudi::Utils::TypeNameString::name ( ) const
inline

Definition at line 48 of file TypeNameString.h.

48{ return m_name; }

◆ type()

const std::string & Gaudi::Utils::TypeNameString::type ( ) const
inline

Definition at line 47 of file TypeNameString.h.

47{ return m_type; }

Member Data Documentation

◆ m_haveType

bool Gaudi::Utils::TypeNameString::m_haveType
private

Definition at line 21 of file TypeNameString.h.

◆ m_name

std::string Gaudi::Utils::TypeNameString::m_name
private

Definition at line 20 of file TypeNameString.h.

◆ m_type

std::string Gaudi::Utils::TypeNameString::m_type
private

Definition at line 20 of file TypeNameString.h.


The documentation for this class was generated from the following file: