sptk2 logo
SPTK Home Page
Public Types | Public Member Functions | List of all members
sptk::WSFieldIndex Class Reference

#include <WSFieldIndex.h>

Public Types

enum class  Group : uint8_t { ELEMENTS = 1 , ATTRIBUTES = 2 , ELEMENTS_AND_ATTRIBUTES = 3 }
 

Public Member Functions

 WSFieldIndex ()=default
 
 ~WSFieldIndex ()=default
 
 WSFieldIndex (const WSFieldIndex &)
 
 WSFieldIndex (WSFieldIndex &&) noexcept
 
WSFieldIndexoperator= (const WSFieldIndex &)
 
WSFieldIndexoperator= (WSFieldIndex &&) noexcept
 
void setElements (const Strings &fieldNames, std::initializer_list< WSType * > fieldList)
 
void setAttributes (const Strings &fieldNames, std::initializer_list< WSType * > fieldList)
 
const std::map< String, WSType * > & elements () const
 
const std::map< String, WSType * > & attributes () const
 
WSTypefind (const String &name) const
 
void forEach (const std::function< bool(WSType *)> &method, Group fieldType=Group::ELEMENTS_AND_ATTRIBUTES)
 
void forEach (const std::function< bool(const WSType *)> &method, Group fieldType=Group::ELEMENTS_AND_ATTRIBUTES) const
 
bool hasElements () const
 
bool hasAttributes () const
 

Detailed Description

Field index contains pointers to WSType objects

Member Enumeration Documentation

◆ Group

enum class sptk::WSFieldIndex::Group : uint8_t
strong

Type(s) of field that are processed with forEach

Constructor & Destructor Documentation

◆ WSFieldIndex() [1/3]

sptk::WSFieldIndex::WSFieldIndex ( )
default

Initialize field index with field fieldList

Parameters
fieldNamesField names
fieldListField list

◆ ~WSFieldIndex()

sptk::WSFieldIndex::~WSFieldIndex ( )
default

Destructor

◆ WSFieldIndex() [2/3]

sptk::WSFieldIndex::WSFieldIndex ( const WSFieldIndex )
inline

Do not change internal state

◆ WSFieldIndex() [3/3]

sptk::WSFieldIndex::WSFieldIndex ( WSFieldIndex &&  )
inlinenoexcept

Do not change internal state

Member Function Documentation

◆ attributes()

const std::map< String, WSType * > & sptk::WSFieldIndex::attributes ( ) const
inline

Get attributes

Returns
const attributes map

◆ elements()

const std::map< String, WSType * > & sptk::WSFieldIndex::elements ( ) const
inline

Get elements

Returns
const elements map

◆ find()

WSType * sptk::WSFieldIndex::find ( const String name) const

Return a field for field name, or return nullptr if not found

Parameters
nameField name
Returns
field pointer, or nullptr if not found

◆ forEach() [1/2]

void sptk::WSFieldIndex::forEach ( const std::function< bool(const WSType *)> &  method,
Group  fieldType = Group::ELEMENTS_AND_ATTRIBUTES 
) const

Execute the method for each field until it returns false

Parameters
methodMethod to execute

◆ forEach() [2/2]

void sptk::WSFieldIndex::forEach ( const std::function< bool(WSType *)> &  method,
Group  fieldType = Group::ELEMENTS_AND_ATTRIBUTES 
)

Execute the method for each field until it returns false

Parameters
methodMethod to execute

◆ operator=() [1/2]

WSFieldIndex & sptk::WSFieldIndex::operator= ( const WSFieldIndex )
inline

Do not change internal state

◆ operator=() [2/2]

WSFieldIndex & sptk::WSFieldIndex::operator= ( WSFieldIndex &&  )
inlinenoexcept

Do not change internal state

◆ setAttributes()

void sptk::WSFieldIndex::setAttributes ( const Strings fieldNames,
std::initializer_list< WSType * >  fieldList 
)

Initialize field index with attributes

Parameters
fieldNamesField names
fieldListField list

◆ setElements()

void sptk::WSFieldIndex::setElements ( const Strings fieldNames,
std::initializer_list< WSType * >  fieldList 
)

Initialize field index with elements

Parameters
fieldNamesField names
fieldListField list

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

Fri Oct 14 2022 09:58:48: SPTK 5.4.1