cgv
|
representation of a token in a text by two pointers begin and end, that point to the first character of the token and behind the last character of the token. More...
#include <token.h>
Public Member Functions | |
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 | |
const char * | begin |
pointers that define the range of characters | |
const char * | end |
representation of a token in a text by two pointers begin and end, that point to the first character of the token and behind the last character of the token.
In this way the two pointers form a range of characters that can be used with stl functions.
token::token | ( | ) |
construct with both pointers set to 0
Definition at line 8 of file token.cxx.
Referenced by cgv::utils::tokenizer::balanced_bite().
token::token | ( | const char * | _b, |
const char * | _e | ||
) |
token::token | ( | const std::string & | s | ) |
|
inline |
return whether the token is empty
Definition at line 56 of file token.h.
References begin.
Referenced by cgv::ppp::command_token::is_empty(), cgv::utils::operator<<(), cgv::ppp::command_token::split_off_from(), cgv::gui::shortcut::stream_in(), and cgv::utils::to_string().
|
inline |
return the length of the token in number of characters
Definition at line 52 of file token.h.
References begin.
Referenced by cgv::utils::operator<<(), and cgv::utils::to_string().
bool token::operator!= | ( | const char * | s | ) | const |
bool token::operator!= | ( | const std::string & | s | ) | const |
bool token::operator== | ( | const char * | s | ) | const |
bool token::operator== | ( | const std::string & | s | ) | const |
|
inline |
void token::reverse_skip | ( | const std::string & | skip_chars | ) |
set end by skipping all instances of the given character set
Definition at line 38 of file token.cxx.
References begin, and cgv::utils::is_element().
Referenced by cgv::utils::tokenizer::reverse_skip_whitespaces().
|
inline |
return the length of the token in number of characters
Definition at line 54 of file token.h.
References begin.
Referenced by cgv::gui::shortcut::stream_in().
void token::skip | ( | const std::string & | skip_chars | ) |
set begin by skipping all instances of the given character set
return the length of the token in number of characters
return the length of the token in number of characters return whether the token is empty set begin by skipping all instances of the given character set
Definition at line 33 of file token.cxx.
References begin, and cgv::utils::is_element().
Referenced by cgv::utils::tokenizer::skip_whitespaces().
const char* cgv::utils::token::begin |
pointers that define the range of characters
Definition at line 20 of file token.h.
Referenced by cgv::render::shader_program::attach_program(), cgv::utils::tokenizer::balanced_bite(), cgv::utils::balanced_find_content(), cgv::utils::tokenizer::bite(), empty(), cgv::render::shader_program::extract_instances(), get_length(), cgv::ppp::command_token::is_empty(), cgv::utils::operator<<(), operator[](), cgv::utils::tokenizer::reverse_bite(), reverse_skip(), size(), skip(), cgv::ppp::command_token::split_off_from(), cgv::utils::split_to_lines(), cgv::utils::split_to_tokens(), cgv::utils::to_string(), and cgv::utils::tokenizer::tokenizer().