Geogram  Version 1.9.0
A programming library of geometric algorithms
GEO::BooleanExpression Class Reference

A simple parser for boolean expressions. More...

#include <geogram/basic/boolean_expression.h>

Public Member Functions

 BooleanExpression (const std::string &expr)
 Constructs a boolean expression. More...
 
bool operator() (index_t x)
 Evaluates the boolean expression. More...
 

Protected Member Functions

bool parse_or ()
 
bool parse_and ()
 
bool parse_factor ()
 
bool parse_variable ()
 
char cur_char () const
 
void next_char ()
 

Detailed Description

A simple parser for boolean expressions.

Definition at line 57 of file boolean_expression.h.

Constructor & Destructor Documentation

◆ BooleanExpression()

GEO::BooleanExpression::BooleanExpression ( const std::string &  expr)

Constructs a boolean expression.

Parameters
[in]exprthe expression, with the following syntax:
  • Variables: A..Z or x0..x31
  • and: '&' or '*'
  • or: '|' or '+'
  • xor: '^'
  • difference: '-'
  • special: '*' for union
  • one can use '(' and ')' to group subexpression

Member Function Documentation

◆ operator()()

bool GEO::BooleanExpression::operator() ( index_t  x)

Evaluates the boolean expression.

Parameters
[in]xthe different bits of x correspond to the variables A..Z or x0..x31.

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