Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes
omni::Id Struct Reference

Id type for classes An Id must only contain alpha numerical characters and must begin with a letter. More...

#include <Id.h>

Public Member Functions

 Id ()
 Default constructor. More...
 
 Id (QString const &)
 Constructor from string. More...
 
 Id (const char *)
 Constructor from const char*. More...
 
QString const & str () const
 Returns string representation (const) More...
 
 operator QString () const
 Cast operator returns copy of string representation. More...
 
bool valid () const
 Returns true if string is valid. More...
 
bool operator< (const Id &) const
 Comparison operator. More...
 
bool operator!= (const Id &) const
 Returns true if two ids do not match. More...
 
bool operator== (const Id &) const
 Returns true if two ids match. More...
 

Private Member Functions

void make (QString const &)
 Make Id from string. More...
 

Private Attributes

QString str_
 Internal string buffer. More...
 

Detailed Description

Id type for classes An Id must only contain alpha numerical characters and must begin with a letter.

Constructor & Destructor Documentation

omni::Id::Id ( )

Default constructor.

29  {
30  }
omni::Id::Id ( QString const &  _str)

Constructor from string.

33  {
34  make(_str);
35  }
void make(QString const &)
Make Id from string.
Definition: Id.cpp:72
omni::Id::Id ( const char *  _c)

Constructor from const char*.

38  {
39  make(QString(_c));
40  }
void make(QString const &)
Make Id from string.
Definition: Id.cpp:72

Member Function Documentation

void omni::Id::make ( QString const &  _str)
private

Make Id from string.

73  {
74  str_ = "";
75  // An id must not be empty
76  if (_str.isEmpty()) return;
77 
78  // An Id must begin with a letter
79  if (!_str[0].isLetter()) return;
80 
81  // An id must only contain alpha numerical characters
82  // and underscores
83  for (auto& c : _str)
84  {
85  if (!c.isLetterOrNumber() && (!c.isPunct())) return;
86  }
87  str_=_str;
88  }
QString str_
Internal string buffer.
Definition: Id.h:68
omni::Id::operator QString ( ) const

Cast operator returns copy of string representation.

48  {
49  return str_;
50  }
QString str_
Internal string buffer.
Definition: Id.h:68
bool omni::Id::operator!= ( const Id _rhs) const

Returns true if two ids do not match.

63  {
64  return !(*this == _rhs);
65  }
bool omni::Id::operator< ( const Id _rhs) const

Comparison operator.

58  {
59  return this->str_ < _rhs.str_;
60  }
QString str_
Internal string buffer.
Definition: Id.h:68
bool omni::Id::operator== ( const Id _rhs) const

Returns true if two ids match.

68  {
69  return this->str_ == _rhs.str_;
70  }
QString str_
Internal string buffer.
Definition: Id.h:68
QString const & omni::Id::str ( ) const

Returns string representation (const)

43  {
44  return str_;
45  }
QString str_
Internal string buffer.
Definition: Id.h:68
bool omni::Id::valid ( ) const

Returns true if string is valid.

53  {
54  return !str_.isEmpty();
55  }
QString str_
Internal string buffer.
Definition: Id.h:68

Field Documentation

QString omni::Id::str_
private

Internal string buffer.


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