CVC4::SExpr Class Reference

A simple S-expression. More...

`#include <sexpr.h>`

## Public Types

typedef SExprKeyword | Keyword

## Public Member Functions

| SExpr ()
| SExpr (const CVC4::Integer &value)
| SExpr (int value)
| SExpr (long int value)
| SExpr (unsigned int value)
| SExpr (unsigned long int value)
| SExpr (const CVC4::Rational &value)
| SExpr (const std::string &value)
| SExpr (const char *value)
| This constructs a string expression from a const char* value.
| SExpr (bool value)
| This adds a convenience wrapper to SExpr to cast from bools.
| SExpr (const Keyword &value)
| SExpr (const std::vector< SExpr > &children)
bool | isAtom () const
| Is this S-expression an atom?
bool | isInteger () const
| Is this S-expression an integer?
bool | isRational () const
| Is this S-expression a rational?
bool | isString () const
| Is this S-expression a string?
bool | isKeyword () const
| Is this S-expression a keyword?
std::string | getValue () const
| Get the string value of this S-expression.
const CVC4::Integer & | getIntegerValue () const
| Get the integer value of this S-expression.
const CVC4::Rational & | getRationalValue () const
| Get the rational value of this S-expression.
const std::vector< SExpr > & | getChildren () const
| Get the children of this S-expression.
bool | operator== (const SExpr &s) const
| Is this S-expression equal to another?
bool | operator!= (const SExpr &s) const
| Is this S-expression different from another?

## Detailed Description

A simple S-expression.

An S-expression is either an atom with a string value, or a list of other S-expressions.

Definition at line 51 of file sexpr.h.

## Member Typedef Documentation

## Keyword

typedef SExprKeyword CVC4::SExpr::Keyword

Definition at line 75 of file sexpr.h.

## Constructor & Destructor Documentation

## SExpr() [1/12]

CVC4::SExpr::SExpr | ( |  | ) |

inline

Definition at line 77 of file sexpr.h.

## SExpr() [2/12]

CVC4::SExpr::SExpr | ( | const CVC4::Integer & | value | ) |

inline

Definition at line 85 of file sexpr.h.

## SExpr() [3/12]

CVC4::SExpr::SExpr | ( | int | value | ) |

inline

Definition at line 93 of file sexpr.h.

## SExpr() [4/12]

CVC4::SExpr::SExpr | ( | long int | value | ) |

inline

Definition at line 101 of file sexpr.h.

## SExpr() [5/12]

CVC4::SExpr::SExpr | ( | unsigned int | value | ) |

inline

Definition at line 109 of file sexpr.h.

## SExpr() [6/12]

CVC4::SExpr::SExpr | ( | unsigned long int | value | ) |

inline

Definition at line 117 of file sexpr.h.

## SExpr() [7/12]

CVC4::SExpr::SExpr | ( | const CVC4::Rational & | value | ) |

inline

Definition at line 125 of file sexpr.h.

## SExpr() [8/12]

CVC4::SExpr::SExpr | ( | const std::string & | value | ) |

inline

Definition at line 133 of file sexpr.h.

## SExpr() [9/12]

CVC4::SExpr::SExpr | ( | const char * | value | ) |

inline

This constructs a string expression from a const char* value.

This cannot be removed in order to support SExpr("foo"). Given the other constructors this SExpr("foo") converts to bool. instead of SExpr(string("foo")).

Definition at line 147 of file sexpr.h.

## SExpr() [10/12]

CVC4::SExpr::SExpr | ( | bool | value | ) |

inline

This adds a convenience wrapper to SExpr to cast from bools.

This is internally handled as the strings "true" and "false"

Definition at line 159 of file sexpr.h.

## SExpr() [11/12]

CVC4::SExpr::SExpr | ( | const Keyword & | value | ) |

inline

Definition at line 167 of file sexpr.h.

## SExpr() [12/12]

CVC4::SExpr::SExpr | ( | const std::vector< SExpr > & | children | ) |

inline

Definition at line 175 of file sexpr.h.

## Member Function Documentation

## getChildren()

const std::vector< SExpr > & CVC4::SExpr::getChildren | ( |  | ) | const

inline

Get the children of this S-expression.

This will cause an error if this S-expression is not a list.

Definition at line 283 of file sexpr.h.

References CVC4::CheckArgument(), and isAtom().

## getIntegerValue()

const CVC4::Integer & CVC4::SExpr::getIntegerValue | ( |  | ) | const

inline

Get the integer value of this S-expression.

This will cause an error if this S-expression is not an integer.

Definition at line 273 of file sexpr.h.

References CVC4::CheckArgument(), and isInteger().

## getRationalValue()

const CVC4::Rational & CVC4::SExpr::getRationalValue | ( |  | ) | const

inline

Get the rational value of this S-expression.

This will cause an error if this S-expression is not a rational.

Definition at line 278 of file sexpr.h.

References CVC4::CheckArgument(), and isRational().

## getValue()

std::string CVC4::SExpr::getValue | ( |  | ) | const

inline

Get the string value of this S-expression.

This will cause an error if this S-expression is not an atom.

Definition at line 250 of file sexpr.h.

References CVC4::CheckArgument(), CVC4::Rational::getDouble(), isAtom(), and CVC4::Integer::toString().

## isAtom()

bool CVC4::SExpr::isAtom | ( |  | ) | const

inline

Is this S-expression an atom?

Definition at line 230 of file sexpr.h.

Referenced by getChildren(), and getValue().

## isInteger()

bool CVC4::SExpr::isInteger | ( |  | ) | const

inline

Is this S-expression an integer?

Definition at line 234 of file sexpr.h.

Referenced by getIntegerValue().

## isKeyword()

bool CVC4::SExpr::isKeyword | ( |  | ) | const

inline

Is this S-expression a keyword?

Definition at line 246 of file sexpr.h.

## isRational()

bool CVC4::SExpr::isRational | ( |  | ) | const

inline

Is this S-expression a rational?

Definition at line 238 of file sexpr.h.

Referenced by getRationalValue().

## isString()

bool CVC4::SExpr::isString | ( |  | ) | const

inline

Is this S-expression a string?

Definition at line 242 of file sexpr.h.

## operator!=()

bool CVC4::SExpr::operator!= | ( | const SExpr & | s | ) | const

inline

Is this S-expression different from another?

Definition at line 296 of file sexpr.h.

## operator==()

bool CVC4::SExpr::operator== | ( | const SExpr & | s | ) | const

inline

Is this S-expression equal to another?

Definition at line 288 of file sexpr.h.

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

- src/util/sexpr.h