www.mooseframework.org
Public Member Functions | Private Attributes | Friends | List of all members
MooseEnumItem Class Reference

Class for containing MooseEnum item information. More...

#include <MooseEnumItem.h>

Public Member Functions

 MooseEnumItem (const std::string &name, const int &id)
 
 ~MooseEnumItem ()=default
 
 MooseEnumItem (const MooseEnumItem &other)
 
 MooseEnumItem (MooseEnumItem &&other)=default
 
MooseEnumItemoperator= (const MooseEnumItem &other)
 
MooseEnumItemoperator= (MooseEnumItem &&other)=default
 
bool operator< (const MooseEnumItem &other) const
 Less than operator. More...
 
const int & id () const
 Return the numeric, name, or raw name. More...
 
const std::string & name () const
 
const std::string & rawName () const
 
 operator int () const
 Operator to allow this class to be used directly as a string for int. More...
 
 operator std::string () const
 
bool operator== (const char *value) const
 Comparison operators. More...
 
bool operator!= (const char *value) const
 
bool operator== (const std::string &value) const
 
bool operator!= (const std::string &value) const
 
bool operator== (int value) const
 
bool operator!= (int value) const
 
bool operator== (unsigned short value) const
 
bool operator!= (unsigned short value) const
 
bool operator== (const MooseEnumItem &) const
 
bool operator!= (const MooseEnumItem &) const
 

Private Attributes

std::string _raw_name
 The name as provided in constructor. More...
 
std::string _name
 Upper case name. More...
 
int _id
 The numeric value for item. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const MooseEnumItem &item)
 ostream operator for string printing. More...
 

Detailed Description

Class for containing MooseEnum item information.

Definition at line 24 of file MooseEnumItem.h.

Constructor & Destructor Documentation

MooseEnumItem::MooseEnumItem ( const std::string &  name,
const int &  id 
)

Definition at line 19 of file MooseEnumItem.C.

21 {
22 }
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
Definition: MooseUtils.C:555
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
std::string _raw_name
The name as provided in constructor.
Definition: MooseEnumItem.h:85
const std::string & name() const
Definition: MooseEnumItem.h:39
std::string trim(const std::string &str, const std::string &white_space=" \t\n\v\f\r")
Standard scripting language trim function.
Definition: MooseUtils.C:95
MooseEnumItem::~MooseEnumItem ( )
default
MooseEnumItem::MooseEnumItem ( const MooseEnumItem other)

Definition at line 24 of file MooseEnumItem.C.

25  : _raw_name(other._raw_name), _name(other._name), _id(other._id)
26 {
27 }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
std::string _raw_name
The name as provided in constructor.
Definition: MooseEnumItem.h:85
MooseEnumItem::MooseEnumItem ( MooseEnumItem &&  other)
default

Member Function Documentation

const int& MooseEnumItem::id ( ) const
inline

Return the numeric, name, or raw name.

Definition at line 38 of file MooseEnumItem.h.

Referenced by MooseEnum::compareCurrent(), and MultiMooseEnum::contains().

38 { return _id; }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
const std::string& MooseEnumItem::name ( ) const
inline

Definition at line 39 of file MooseEnumItem.h.

Referenced by MooseEnum::checkDeprecated(), MooseEnum::compareCurrent(), operator!=(), MooseEnum::operator!=(), operator==(), and MooseEnum::operator==().

39 { return _name; }
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
MooseEnumItem::operator int ( ) const
inline

Operator to allow this class to be used directly as a string for int.

Definition at line 47 of file MooseEnumItem.h.

47 { return _id; }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
MooseEnumItem::operator std::string ( ) const
inline

Definition at line 48 of file MooseEnumItem.h.

48 { return _name; }
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
bool MooseEnumItem::operator!= ( const char *  value) const

Definition at line 46 of file MooseEnumItem.C.

Referenced by operator std::string(), and operator!=().

47 {
48  std::string name(MooseUtils::toUpper(value));
49  return _name != name;
50 }
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
Definition: MooseUtils.C:555
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
const std::string & name() const
Definition: MooseEnumItem.h:39
bool MooseEnumItem::operator!= ( const std::string &  value) const

Definition at line 60 of file MooseEnumItem.C.

61 {
62  std::string name(MooseUtils::toUpper(value));
63  return _name != name;
64 }
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
Definition: MooseUtils.C:555
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
const std::string & name() const
Definition: MooseEnumItem.h:39
bool MooseEnumItem::operator!= ( int  value) const
inline

Definition at line 64 of file MooseEnumItem.h.

64 { return _id != value; }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
bool MooseEnumItem::operator!= ( unsigned short  value) const
inline

Definition at line 67 of file MooseEnumItem.h.

67 { return _id != value; }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
bool MooseEnumItem::operator!= ( const MooseEnumItem ) const

Definition at line 73 of file MooseEnumItem.C.

74 {
75  mooseError("Direct comparison between MooseEnumItems is not supported.");
76 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool MooseEnumItem::operator< ( const MooseEnumItem other) const
inline

Less than operator.

This is required for this class to work in maps and sets.

Definition at line 76 of file MooseEnumItem.h.

76 { return _id < other._id; }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
MooseEnumItem & MooseEnumItem::operator= ( const MooseEnumItem other)

Definition at line 30 of file MooseEnumItem.C.

31 {
32  _raw_name = other._raw_name;
33  _name = other._name;
34  _id = other._id;
35  return *this;
36 }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
std::string _raw_name
The name as provided in constructor.
Definition: MooseEnumItem.h:85
MooseEnumItem& MooseEnumItem::operator= ( MooseEnumItem &&  other)
default
bool MooseEnumItem::operator== ( const char *  value) const

Comparison operators.

The comparison operators using the char * and string are case sensitive.

Definition at line 39 of file MooseEnumItem.C.

Referenced by operator std::string(), and operator!=().

40 {
41  std::string name(MooseUtils::toUpper(value));
42  return _name == name;
43 }
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
Definition: MooseUtils.C:555
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
const std::string & name() const
Definition: MooseEnumItem.h:39
bool MooseEnumItem::operator== ( const std::string &  value) const

Definition at line 53 of file MooseEnumItem.C.

54 {
55  std::string name(MooseUtils::toUpper(value));
56  return _name == name;
57 }
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
Definition: MooseUtils.C:555
std::string _name
Upper case name.
Definition: MooseEnumItem.h:88
const std::string & name() const
Definition: MooseEnumItem.h:39
bool MooseEnumItem::operator== ( int  value) const
inline

Definition at line 63 of file MooseEnumItem.h.

63 { return _id == value; }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
bool MooseEnumItem::operator== ( unsigned short  value) const
inline

Definition at line 66 of file MooseEnumItem.h.

66 { return _id == value; }
int _id
The numeric value for item.
Definition: MooseEnumItem.h:91
bool MooseEnumItem::operator== ( const MooseEnumItem ) const

Definition at line 67 of file MooseEnumItem.C.

68 {
69  mooseError("Direct comparison between MooseEnumItems is not supported.");
70 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
const std::string& MooseEnumItem::rawName ( ) const
inline

Definition at line 40 of file MooseEnumItem.h.

Referenced by operator<<().

40 { return _raw_name; }
std::string _raw_name
The name as provided in constructor.
Definition: MooseEnumItem.h:85

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const MooseEnumItem item 
)
friend

ostream operator for string printing.

Definition at line 79 of file MooseEnumItem.C.

Referenced by operator<().

80 {
81  out << item.rawName();
82  return out;
83 }
const std::string & rawName() const
Definition: MooseEnumItem.h:40

Member Data Documentation

int MooseEnumItem::_id
private

The numeric value for item.

Definition at line 91 of file MooseEnumItem.h.

Referenced by id(), operator int(), operator!=(), operator<(), operator=(), and operator==().

std::string MooseEnumItem::_name
private

Upper case name.

Definition at line 88 of file MooseEnumItem.h.

Referenced by name(), operator std::string(), operator!=(), operator=(), and operator==().

std::string MooseEnumItem::_raw_name
private

The name as provided in constructor.

Definition at line 85 of file MooseEnumItem.h.

Referenced by operator=(), and rawName().


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