PLaSK library

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
plask::XMLReader::EnumAttributeReader< EnumT > Struct Template Reference

Enum attribute reader class. More...

`#include <plask/utils/xml/reader.hpp>`

Collaboration diagram for plask::XMLReader::EnumAttributeReader< EnumT >:
[legend]

## Public Member Functions
| EnumAttributeReader (XMLReader &reader, const std::string &attr_name, bool case_sensitive=false)
| Create enum attribute reader.
EnumAttributeReader & | value (std::string key, EnumT val, std::size_t min=std::numeric_limits< std::size_t >::max())
| Add allowed parameter.
EnumT | require ()
| Require attribute.
plask::optional< EnumT > | get ()
| Get attribute.
EnumT | get (EnumT default_value)
| Get attribute with default value.

## Protected Member Functions
EnumT | parse (std::string value)

## Protected Attributes
XMLReader & | reader
const std::string | attr_name
bool | case_insensitive
std::map< std::string, EnumT > | values
std::string | help

## Detailed Description

template<typename EnumT>
struct plask::XMLReader::EnumAttributeReader< EnumT >

Enum attribute reader class.

Definition at line 185 of file reader.hpp.

## Constructor & Destructor Documentation

## ◆ EnumAttributeReader()

template<typename EnumT >

plask::XMLReader::EnumAttributeReader< EnumT >::EnumAttributeReader | ( | XMLReader & | reader,
|  | const std::string & | attr_name,
|  | bool | case_sensitive = `false`
| ) |  |
| inline

Create enum attribute reader.

Parameters

  reader | XML reader
  attr_name | name of the attribute
  case_sensitive | true if the attribute value should be case sensitive

Definition at line 212 of file reader.hpp.

## Member Function Documentation

## ◆ get() [1/2]

template<typename EnumT >

plask::optional< EnumT > plask::XMLReader::EnumAttributeReader< EnumT >::get | ( |  | ) |
| inline

Get attribute.

Returns
  optional set if the attribute was specified

Definition at line 250 of file reader.hpp.

## ◆ get() [2/2]

template<typename EnumT >

EnumT plask::XMLReader::EnumAttributeReader< EnumT >::get | ( | EnumT | default_value | ) |
| inline

Get attribute with default value.

Parameters

  default_value | default value of the attribute

Returns
  optional set if the attribute was specified

Definition at line 261 of file reader.hpp.

## ◆ parse()

template<typename EnumT >

EnumT plask::XMLReader::EnumAttributeReader< EnumT >::parse | ( | std::string | value | ) |
| inline protected

Definition at line 196 of file reader.hpp.

## ◆ require()

template<typename EnumT >

EnumT plask::XMLReader::EnumAttributeReader< EnumT >::require | ( |  | ) |
| inline

Require attribute.

Definition at line 242 of file reader.hpp.

## ◆ value()

template<typename EnumT >

EnumAttributeReader & plask::XMLReader::EnumAttributeReader< EnumT >::value | ( | std::string | key,
|  | EnumT | val,
|  | std::size_t | min = `std::numeric_limits<std::size_t>::max()`
| ) |  |
| inline

Add allowed parameter.

Parameters

  key | text representing the attribute value
  val | value of the attribute
  min | minimum number of letters in the attribute

Definition at line 221 of file reader.hpp.

## Member Data Documentation

## ◆ attr_name

template<typename EnumT >

const std::string plask::XMLReader::EnumAttributeReader< EnumT >::attr_name
| protected

Definition at line 190 of file reader.hpp.

## ◆ case_insensitive

template<typename EnumT >

bool plask::XMLReader::EnumAttributeReader< EnumT >::case_insensitive
| protected

Definition at line 191 of file reader.hpp.

## ◆ help

template<typename EnumT >

std::string plask::XMLReader::EnumAttributeReader< EnumT >::help
| protected

Definition at line 194 of file reader.hpp.

## ◆ reader

template<typename EnumT >

XMLReader& plask::XMLReader::EnumAttributeReader< EnumT >::reader
| protected

Definition at line 189 of file reader.hpp.

## ◆ values

template<typename EnumT >

std::map<std::string, EnumT> plask::XMLReader::EnumAttributeReader< EnumT >::values
| protected

Definition at line 193 of file reader.hpp.

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

- plask/utils/xml/reader.hpp