Open property handle
The difference between opening and constructing a property handle is not relevant. Opening a property handle, however, can be performed any number of times.
You may open a property handle several times. Always when opening a property handle, the currently opened handle will be closed. Since open returns an error when failing, one may immediately check the success of the open function, in which case the function returns false (no error).
A valid property handle can be opened, only, when the parent handle ( ObjectSpace or Property ) is valid. Otherwise, the function throws an exception. When one of the open() functions fails (e.g. because of a misspelled property name), an exception is thrown.
void OpenHandleHierarchy ( Objectspace &os ) {
Property person;
Property children;
Property grandChildren;
Value name;
Value firstName;
person.open(os,"Person::Persons",Read);
children.open(person,"children");
grandChildren.open(children,"children");
name.open(grandChildren,"name");
firstName.open(grandChildren,"first_name");
while ( person.next(true) )
while ( children.next(true) )
while ( grandChildren.next(true) )
printf("Grand child: %s %s",name.toString(),firstName.toString());
}