cgv
Loading...
Searching...
No Matches
cgv::utils::typed_token Struct Reference

a typed token also stores the type and value of a parsed token. More...

#include <advanced_scan.h>

Inheritance diagram for cgv::utils::typed_token:
cgv::utils::token

Public Member Functions

 typed_token (const token &t, token_type tt=PLAIN)
 
- Public Member Functions inherited from cgv::utils::token
 token ()
 construct with both pointers set to 0
 
 token (const char *_str)
 construct from c-string
 
 token (const char *_b, const char *_e)
 construct from character range
 
 token (const std::string &s)
 construct from string
 
size_t get_length () const
 return the length of the token in number of characters
 
size_t size () const
 return the length of the token in number of characters
 
bool empty () const
 return whether the token is empty
 
void skip (const std::string &skip_chars)
 set begin by skipping all instances of the given character set
 
void reverse_skip (const std::string &skip_chars)
 set end by skipping all instances of the given character set
 
char operator[] (unsigned int i) const
 return the i-th character of the token
 
bool operator== (const char *s) const
 compare to const char*
 
bool operator== (const std::string &s) const
 compare to string
 
bool operator!= (const char *s) const
 compare to const char*
 
bool operator!= (const std::string &s) const
 compare to string
 

Public Attributes

token_type type
 
double float_value
 
utils::time time_value
 
utils::date date_value
 
- Public Attributes inherited from cgv::utils::token
const char * begin
 pointers that define the range of characters
 
const char * end
 

Detailed Description

a typed token also stores the type and value of a parsed token.

Although a union of the different typed values should have been used, the values of different type are stored successively in the typed_token because of problems with standard construction.

Definition at line 33 of file advanced_scan.h.

Constructor & Destructor Documentation

◆ typed_token()

cgv::utils::typed_token::typed_token ( const token t,
token_type  tt = PLAIN 
)
inline

Definition at line 36 of file advanced_scan.h.

Member Data Documentation

◆ date_value

utils::date cgv::utils::typed_token::date_value

Definition at line 39 of file advanced_scan.h.

◆ float_value

double cgv::utils::typed_token::float_value

Definition at line 37 of file advanced_scan.h.

◆ time_value

utils::time cgv::utils::typed_token::time_value

Definition at line 38 of file advanced_scan.h.

◆ type

token_type cgv::utils::typed_token::type

Definition at line 35 of file advanced_scan.h.


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