cgv
cgv::utils::token Struct Reference

#include <token.h>

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

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 More...
 
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
 

Detailed Description

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.

Member Function Documentation

◆ skip()

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


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