Ejemplo n.º 1
0
// Iterate over the objects in this object.
//
// The iterator must be closed when it is finished.
//
// The iterator does not need to be fully consumed.
func (o *Object) Iterate(expand bool) *ObjectIter {
	// Increase the ref count
	C.ucl_object_ref(o.object)

	return &ObjectIter{
		expand: expand,
		object: o.object,
		iter:   nil,
	}
}
Ejemplo n.º 2
0
func (o *ObjectIter) Next() *Object {
	obj := C.ucl_iterate_object(o.object, &o.iter, C._Bool(o.expand))
	if obj == nil {
		return nil
	}

	// Increase the ref count so we have to free it
	C.ucl_object_ref(obj)

	return &Object{object: obj}
}
Ejemplo n.º 3
0
// Increments the ref count associated with this. You have to call
// close an additional time to free the memory.
func (o *Object) Ref() error {
	C.ucl_object_ref(o.object)
	return nil
}