dlvhex
2.5.0
|
String-based term object (comfort interface). More...
#include <include/dlvhex2/ComfortPluginInterface.h>
Public Types | |
enum | Type { STR, INT } |
Public Member Functions | |
bool | isConstant () const |
detect whether object stores a constant. | |
bool | isVariable () const |
detect whether object stores a variable. | |
bool | isInteger () const |
detect whether object stores an integer. | |
bool | isAnon () const |
detect whether object stores an anonymous variable. | |
bool | operator== (const ComfortTerm &other) const |
Check equality. | |
bool | operator!= (const ComfortTerm &other) const |
Check inequality. | |
bool | operator< (const ComfortTerm &other) const |
Compare terms. | |
std::ostream & | print (std::ostream &o) const |
Print term (using ostream_printable<T>). | |
ComfortTerm () | |
Constructor. | |
ComfortTerm (int intval) | |
Constructor for integer terms. | |
ComfortTerm (std::string strval, bool addQuotes=false) | |
Constructor for constant or string terms. | |
std::string | getUnquotedString () const |
Retrieves the term as string without quotes, independent if it is stored with or without quotes. | |
std::string | getString () const |
Retrieves the internal term as string. | |
std::string | getVariable () const |
Retrieves the internal term as string. | |
Static Public Member Functions | |
static ComfortTerm | createVariable (const std::string &s) |
Construct variable term. | |
static ComfortTerm | createConstant (const std::string &s) |
Construct constant term. | |
static ComfortTerm | createInteger (int i) |
Construct integer term. | |
Data Fields | |
Type | type |
Type of stored content. | |
std::string | strval |
String content storage. | |
int | intval |
Integer content storage. | |
Protected Member Functions | |
ComfortTerm (Type type, const std::string &strval, int intval) | |
Constructor. |
String-based term object (comfort interface).
This term object stores integers or strings, where strings can be constants or variables.
You can stream instances of this class into std::ostream&.
Definition at line 82 of file ComfortPluginInterface.h.
enum ComfortTerm::Type |
Definition at line 85 of file ComfortPluginInterface.h.
ComfortTerm::ComfortTerm | ( | Type | type, |
const std::string & | strval, | ||
int | intval | ||
) | [inline, protected] |
Constructor.
Use "create..." functions to create comfort terms.
type | See ComfortTerm::type. |
strval | See ComfortTerm::strval. |
intval | See ComfortTerm::intval. |
Definition at line 219 of file ComfortPluginInterface.h.
ComfortTerm::ComfortTerm | ( | ) | [inline] |
Constructor.
Definition at line 224 of file ComfortPluginInterface.h.
ComfortTerm::ComfortTerm | ( | int | intval | ) | [inline] |
Constructor for integer terms.
intval | Integer. |
Definition at line 228 of file ComfortPluginInterface.h.
ComfortTerm::ComfortTerm | ( | std::string | strval, |
bool | addQuotes = false |
||
) | [inline] |
Constructor for constant or string terms.
strval | Value. |
addQuotes | True to store "\p strval" and false to store strval . |
Definition at line 234 of file ComfortPluginInterface.h.
static ComfortTerm ComfortTerm::createConstant | ( | const std::string & | s | ) | [inline, static] |
Construct constant term.
s | String representation of the constant term. |
Definition at line 154 of file ComfortPluginInterface.h.
Referenced by ComfortInterpretation::keep(), ComfortInterpretation::matchPredicate(), ComfortInterpretation::remove(), TestAAtom::retrieve(), and TestBAtom::retrieve().
static ComfortTerm ComfortTerm::createInteger | ( | int | i | ) | [inline, static] |
Construct integer term.
i | String representation of the integer term. |
Definition at line 162 of file ComfortPluginInterface.h.
Referenced by TestMinusOneAtom::retrieve().
static ComfortTerm ComfortTerm::createVariable | ( | const std::string & | s | ) | [inline, static] |
Construct variable term.
s | String representation of the term. |
Definition at line 146 of file ComfortPluginInterface.h.
std::string ComfortTerm::getString | ( | ) | const [inline] |
Retrieves the internal term as string.
Definition at line 251 of file ComfortPluginInterface.h.
std::string ComfortTerm::getUnquotedString | ( | ) | const [inline] |
Retrieves the term as string without quotes, independent if it is stored with or without quotes.
Definition at line 241 of file ComfortPluginInterface.h.
std::string ComfortTerm::getVariable | ( | ) | const [inline] |
Retrieves the internal term as string.
Definition at line 258 of file ComfortPluginInterface.h.
bool ComfortTerm::isAnon | ( | ) | const [inline] |
detect whether object stores an anonymous variable.
Definition at line 138 of file ComfortPluginInterface.h.
bool ComfortTerm::isConstant | ( | ) | const [inline] |
detect whether object stores a constant.
Definition at line 118 of file ComfortPluginInterface.h.
bool ComfortTerm::isInteger | ( | ) | const [inline] |
detect whether object stores an integer.
Definition at line 132 of file ComfortPluginInterface.h.
Referenced by print().
bool ComfortTerm::isVariable | ( | ) | const [inline] |
detect whether object stores a variable.
Definition at line 125 of file ComfortPluginInterface.h.
bool ComfortTerm::operator!= | ( | const ComfortTerm & | other | ) | const [inline] |
Check inequality.
other | Term to compare to. |
other
and false otherwise. Definition at line 183 of file ComfortPluginInterface.h.
bool ComfortTerm::operator< | ( | const ComfortTerm & | other | ) | const [inline] |
Compare terms.
We require this for storing ComfortTerm in sets.
other | Term to compare to. |
other
and false otherwise. Definition at line 193 of file ComfortPluginInterface.h.
bool ComfortTerm::operator== | ( | const ComfortTerm & | other | ) | const [inline] |
std::ostream & ComfortTerm::print | ( | std::ostream & | o | ) | const |
Print term (using ostream_printable<T>).
Non-virtual on purpose. (see Printhelpers.h)
o | Stream to print to. |
o
. Definition at line 56 of file ComfortPluginInterface.cpp.
References intval, isInteger(), and strval.
Integer content storage.
Only relevant if type == INT.
Definition at line 112 of file ComfortPluginInterface.h.
Referenced by operator<(), operator==(), and print().
std::string ComfortTerm::strval |
String content storage.
Only relevant if type == STR.
Definition at line 105 of file ComfortPluginInterface.h.
Referenced by ComfortAtom::isStrongNegated(), operator<(), operator==(), and print().
Type of stored content.
Indicates, whether strval or intval contains relevant data.
Definition at line 98 of file ComfortPluginInterface.h.
Referenced by operator<(), and operator==().