1.11 Overview of accessing and changing values
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • A C++ interface to SWI-Prolog
        • A C++ interface to SWI-Prolog
          • Overview of accessing and changing values
            • Converting PlTerm to native C and C++ types
            • Unification
            • Comparison
            • Analysing compound terms
            • Miscellaneous
            • The class PlTerm_string
            • The class PlCodeList
            • The class PlCharList
            • The class PlCompound
            • The class PlTerm_tail
            • The class PlTermv
            • The class PlAtom - Supporting Prolog constants
            • Classes for the recorded database: PlRecord and PlRecordExternalCopy

1.11.5 Miscellaneous

bool is_null()
t.is_null() is the same as t.unwrap() == PlTerm::null
bool not_null()
t.not_null() is the same as t.unwrap() != PlTerm::null
bool reset()
t.reset() is the same as t.unwrap() = PlTerm::null
bool reset(term_t)
t.reset(x) is the same as t.unwrap() = x
int PlTerm::type()
Yields the actual type of the term as PL_term_type(). Return values are PL_VARIABLE, PL_FLOAT, PL_INTEGER, PL_ATOM, PL_STRING or PL_TERM
std::string as_string(PlEncoding enc=EncLocale)
Returns the string representation of the atom. See PlAtom::as_string() for an explanation of the encodings and caveats about std::string::c_str().
std::string atomic_as_string(PlEncoding enc=EncLocale)
As PlTerm::as_string(), but throws an exception if the term isn't atomic (see atomic/1).
std::string atom_or_string_as_string(PlEncoding enc=EncLocale)
As PlTerm::as_string(), but throws an exception if the term isn't an atom or a string.

To avoid very confusing combinations of constructors and therefore possible undesirable effects a number of subclasses of PlTerm have been defined that provide constructors for creating special Prolog terms. These subclasses are defined below.