CPP API class rl3::FactIterator

From RL3 Wiki
Jump to: navigation, search

rl3::FactIterator class overview

Description
The rl3::FactIterator class implements the necessary set of functions that can be used to cycle through iterable objects.
Remarks
The get_factsheet() function should not be confused with similar functions in the Fact class. For details, see below.

constructor

rl3::FactIterator objects are created in rl3::Factsheet class with the help of get_fact_iterator functions.

destructor

~FactIterator();

Destroy a FactIterator object.

is_end();

bool is_end();

Define whether an iterator has looked through all the items in a data structure.

Returns: true if an iterator has looked through all the items, false if otherwise

next();

bool next();

Obtain the next element in an iteration.

Returns: true if there is next element for an iteration, false if otherwise

get_label();

UnicodeString get_label();

Get a fact name (label) when iterating (as a unicode string).

Returns: UnicodeString object

get_label_str();

string get_label_str();

Get a fact name (label) when iterating (as a UTF-8 string).

Returns: std::string object

get_value();

UnicodeString get_value();

Get a fact value when iterating (as a unicode string).

Returns: UnicodeString object

get_value_str();

string get_value_str();

Get a fact value when iterating (as a UTF-8 string).

Returns: std::string object

get_weight();

double get_weight();

Get a fact weight when iterating.

Returns: double

get_annotation_start();

unsigned int get_annotation_start();

Get a fact start position when iterating.

Returns: unsigned integer

get_annotation_end();

unsigned int get_annotation_end();

Get a fact end position when iterating.

Returns: unsigned integer

has_factsheet();

bool has_factsheet();

Define whether a fact contains a factsheet when iterating.

Returns: true if a fact contains a factsheet, false if otherwise

get_factsheet();

std::shared_ptr<rl3::Factsheet> get_factsheet();

Get a factsheet from a fact when iterating.

Returns: a shared pointer to a Factsheet object

to_json

string to_json(std::shared_ptr<rl3::SharedText> root_text = NULL, bool include_text = true);

Save associated Fact as JSON string.

root_text: NULL if fact should be considered as independent / self-containing structure. Default is NULL.
include_text true if text field should be included in the output; false otherwise. Default is true.
Returns: JSON string.