HAL
hal::Token< T > Struct Template Reference

#include <token_stream.h>

Collaboration diagram for hal::Token< T >:
Collaboration graph

Public Member Functions

 Token (u32 n, const T s)
 
 operator T () const
 
Token< T > & operator= (const T &s)
 
Token< T > & operator+= (const T &s)
 
bool operator== (const T &s) const
 
bool operator!= (const T &s) const
 

Public Attributes

u32 number
 
string
 

Detailed Description

template<typename T>
struct hal::Token< T >

A token holds a string and a line number and may, for example, be used during parsing of input files.

Definition at line 42 of file token_stream.h.

Constructor & Destructor Documentation

◆ Token()

template<typename T >
hal::Token< T >::Token ( u32  n,
const T  s 
)
inline

Construct a token from a line number and a string.

Parameters
[in]n- The line number.
[in]s- The string.

Definition at line 50 of file token_stream.h.

Member Function Documentation

◆ operator T()

template<typename T >
hal::Token< T >::operator T ( ) const
inline

The token is implicitly cast to a string when being used instead of a string.

Definition at line 67 of file token_stream.h.

References hal::T.

◆ operator!=()

template<typename T >
bool hal::Token< T >::operator!= ( const T &  s) const
inline

Check if the string stored within the token is unequal to another string.

Parameters
[in]s- The string to compare against.
Returns
True if both strings are not equal, false otherwise.

Definition at line 113 of file token_stream.h.

◆ operator+=()

template<typename T >
Token<T>& hal::Token< T >::operator+= ( const T &  s)
inline

Append a string to the one stored within the token.

Parameters
[in]s- The string to append.
Returns
A reference to the token.

Definition at line 90 of file token_stream.h.

◆ operator=()

template<typename T >
Token<T>& hal::Token< T >::operator= ( const T &  s)
inline

Assign a new string to the token.

Parameters
[in]s- The new string.
Returns
A reference to the token.

Definition at line 78 of file token_stream.h.

◆ operator==()

template<typename T >
bool hal::Token< T >::operator== ( const T &  s) const
inline

Check if the string stored within the token is equal to another string.

Parameters
[in]s- The string to compare against.
Returns
True if both strings are equal, false otherwise.

Definition at line 102 of file token_stream.h.

Member Data Documentation

◆ number

template<typename T >
u32 hal::Token< T >::number

The line number.

Definition at line 57 of file token_stream.h.

◆ string

template<typename T >
T hal::Token< T >::string

The string.

Definition at line 62 of file token_stream.h.


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