company logo

Constructing property handle

Constructing a top property handle creates a new property handle with a pointer to the access node in the property hierarchy tree. In most cases, it constructs an empty property handle, which is opened in the constructor. Thus, instead of calling a constructor, one may also call the open() function with an appropriate parameter list.

A valid property handle can be constructed only, when the parent handle ( ObjectSpace or Property ) is valid. Otherwise, the function throws an exception.

void HandleHierarchy ( ObjectSpace &os ) {

  Property     person(os,"Person::Persons",Read);

  Property     children(person,"children");

  Property     grandChildren(children,"children");

  Value        name(grandChildren,"name");

  Value        firstName(grandChildren,"first_name");

  

  while ( person.next(true) )

    while ( children.next(true) )

      while ( grandChildren.next(true) )

        printf("Grand child: %s %s",name.toString(),firstName.toString());

}