C API FactPathIterator functions
FactPathIterator manages FactPathIterator objects created in FactSheets with the help of a rl3_factsheet_get_factpath_iterator function. |
Contents
- 1 rl3_factpathiterator_destroy
- 2 rl3_factpathiterator_is_end
- 3 rl3_factpathiterator_next
- 4 rl3_factpathiterator_get_label
- 5 rl3_factpathiterator_get_value
- 6 rl3_factpathiterator_get_weight
- 7 rl3_factpathiterator_get_annotation_start
- 8 rl3_factpathiterator_get_annotation_end
- 9 rl3_factpathiterator_has_factsheet
- 10 rl3_factpathiterator_get_factsheet
- 11 rl3_factpathiterator_to_json
rl3_factpathiterator_destroy
void rl3_factpathiterator_destroy(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Delete an iterator to release memory.
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | nothing |
rl3_factpathiterator_is_end
unsigned char rl3_factpathiterator_is_end(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Define whether an iterator has looked through all the items in a data structure.
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | 1 if there are no more items to be looked through in a data structure, 0 if otherwise
|
rl3_factpathiterator_next
unsigned char rl3_factpathiterator_next(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
TBD!!!: Not sure of the return type
Obtain the next element in an iteration.
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | 1 if there is a next element for a new iteration, 0 if otherwise
|
rl3_factpathiterator_get_label
const char* rl3_factpathiterator_get_label(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Get a fact name (label) when iterating.
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | a pointer to the first character in the return string |
rl3_factpathiterator_get_value
const char* rl3_factpathiterator_get_value(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Get a fact value when iterating.
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | a pointer to the first character in the return string |
rl3_factpathiterator_get_weight
double rl3_factpathiterator_get_weight(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Get a fact weight when iterating.
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | double |
rl3_factpathiterator_get_annotation_start
unsigned int rl3_factpathiterator_get_annotation_start(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Get a fact start position when iterating (measured in Unicode characters, not bytes).
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | integer (in the non-negative integer range) |
rl3_factpathiterator_get_annotation_end
unsigned int rl3_factpathiterator_get_annotation_end(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Get a fact end position when iterating (measured in Unicode characters, not bytes).
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | integer (in the non-negative integer range) |
rl3_factpathiterator_has_factsheet
unsigned char rl3_factpathiterator_has_factsheet(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
Define whether a fact contains a factsheet when iterating.
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | 1 if a fact contains a factsheet, 0 if otherwise.
|
rl3_factpathiterator_get_factsheet
const struct RL3_Factsheet* rl3_factpathiterator_get_factsheet(struct RL3_Engine* engine, struct RL3_FactPathIterator* iterator);
The get_factsheet() function should not be confused with a similar function for the FactSheet structure.
The difference is in the return type in case a fact contains no factsheet:
|
engine: | a pointer to an engine structure |
iterator: | a pointer to an iterator structure |
Returns: | a pointer to a factsheet structure; if a fact does not contain a factsheet, the function returns null. |
rl3_factpathiterator_to_json
const char* rl3_factpathiterator_to_json(RL3_Engine* engine, RL3_FactPathIterator* iterator, RL3_SharedText* root_text, unsigned char include_text);
Save associated Fact as JSON string.
engine: | a pointer to an engine structure |
iterator: | a pointer to iterator structure containing fact to be serializer |
root_text: | NULL if fact should be considered as independent / self-containing structure.
|
include_text | 1 if text field should be included in the output; 0 otherwise.
|
Returns: | a pointer to the first character in the return string. |