Struct DataObjectList
pub struct DataObjectList(/* private fields */);Expand description
DataObjectList is the base class for list data object.
Implementations§
§impl DataObjectList
impl DataObjectList
pub fn item_count(&self) -> Result<usize, Error>
pub fn item_count(&self) -> Result<usize, Error>
Returns count of items on the list.
pub fn acquire_item(&self, index: usize) -> Result<Weak<DataObject<()>>, Error>
pub fn acquire_item(&self, index: usize) -> Result<Weak<DataObject<()>>, Error>
Acquires an item on the list by index.
§Error
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn acquire_item_unchecked(
&self,
index: usize,
) -> Result<Weak<DataObject<()>>, Error>
pub unsafe fn acquire_item_unchecked( &self, index: usize, ) -> Result<Weak<DataObject<()>>, Error>
Acquires an item on the list by index.
§Safety
The caller must ensure that index < self.item_count().
pub fn release_item(&self, index: usize) -> Result<(), Error>
pub fn release_item(&self, index: usize) -> Result<(), Error>
Releases an item on the list by index.
§Error
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn release_item_unchecked(&self, index: usize) -> Result<(), Error>
pub unsafe fn release_item_unchecked(&self, index: usize) -> Result<(), Error>
Releases an item on the list by index.
§Safety
The caller must ensure that index < self.item_count().
pub fn get_item_template(&self) -> Result<DataObject<()>, Error>
pub fn get_item_template(&self) -> Result<DataObject<()>, Error>
Returns tree structure of the data source for individual list item. Only hierarchy and object types are valid, the data might not be.
Methods from Deref<Target = DataObject<()>>§
pub fn get_name(&self) -> Result<KanziString, Error>
pub fn get_name(&self) -> Result<KanziString, Error>
Allows to retrieve the name of the object.
pub fn set_name(&self, value: impl AsRef<KanziStr>) -> Result<(), Error>
pub fn set_name(&self, value: impl AsRef<KanziStr>) -> Result<(), Error>
Sets the name of the object.
pub fn get_type(&self) -> Result<DataObjectType, Error>
pub fn get_type(&self) -> Result<DataObjectType, Error>
Allows to retrieve the type of the object.
pub fn set_parent<E>(&self, parent: &DataObject<E>) -> Result<(), Error>
pub fn set_parent<E>(&self, parent: &DataObject<E>) -> Result<(), Error>
Assigns a parent DataObject to this DataObject.
pub fn get_parent(&self) -> Result<Option<Weak<DataObject<()>>>, Error>
pub fn get_parent(&self) -> Result<Option<Weak<DataObject<()>>>, Error>
Retrieves the parent DataObject of this DataObject.
§Returns
If None is returned DataObject doesn’t have a parent.
pub fn has_child<E>(&self, child: &DataObject<E>) -> Result<bool, Error>
pub fn has_child<E>(&self, child: &DataObject<E>) -> Result<bool, Error>
Checks whether or not the child exists.
pub fn get_child_count(&self) -> Result<u64, Error>
pub fn get_child_count(&self) -> Result<u64, Error>
Retrieves the count of child objects in this data object.
pub fn get_child(&self, index: u64) -> Result<Weak<DataObject<()>>, Error>
pub fn get_child(&self, index: u64) -> Result<Weak<DataObject<()>>, Error>
Retrieves a child object in given index.
§Errors
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn get_child_unchecked(
&self,
index: u64,
) -> Result<Weak<DataObject<()>>, Error>
pub unsafe fn get_child_unchecked( &self, index: u64, ) -> Result<Weak<DataObject<()>>, Error>
Retrieves a child object in given index.
§Safety
The caller must ensure that index < self.get_child_count().
pub fn get_child_index<E>(&self, child: &DataObject<E>) -> Result<u64, Error>
pub fn get_child_index<E>(&self, child: &DataObject<E>) -> Result<u64, Error>
Retrieves the index of a child data object.
§Errors
Returns an INVALID_ARGUMENT error if the provided DataObject is not a child of self.
pub unsafe fn get_child_index_unchecked<E>(
&self,
child: &DataObject<E>,
) -> Result<u64, Error>
pub unsafe fn get_child_index_unchecked<E>( &self, child: &DataObject<E>, ) -> Result<u64, Error>
Retrieves the index of a child data object.
§Safety
The caller must ensure that self.has_child(child).
pub fn find_child(
&self,
child_name: impl AsRef<KanziStr>,
) -> Result<Option<Weak<DataObject<()>>>, Error>
pub fn find_child( &self, child_name: impl AsRef<KanziStr>, ) -> Result<Option<Weak<DataObject<()>>>, Error>
Tries to find a child with given name.
§Returns
If None is returned, there is no child with provided name.
pub fn add_child<E>(&self, child: &DataObject<E>) -> Result<(), Error>
pub fn add_child<E>(&self, child: &DataObject<E>) -> Result<(), Error>
Adds data object as child of this object. The child should not have a parent.
pub fn insert_child<E>(
&self,
index: u64,
child: &DataObject<E>,
) -> Result<(), Error>
pub fn insert_child<E>( &self, index: u64, child: &DataObject<E>, ) -> Result<(), Error>
Inserts data object as child of this object, allows to specify index of the object.
§Errors
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn insert_child_unchecked<E>(
&self,
index: u64,
child: &DataObject<E>,
) -> Result<(), Error>
pub unsafe fn insert_child_unchecked<E>( &self, index: u64, child: &DataObject<E>, ) -> Result<(), Error>
Inserts data object as child of this object, allows to specify index of the object.
§Safety
The caller must ensure that index < self.get_child_count().
pub fn remove_child<E>(&self, child: &DataObject<E>) -> Result<(), Error>
pub fn remove_child<E>(&self, child: &DataObject<E>) -> Result<(), Error>
Removes a child object from the list of children.
§Errors
Returns an INVALID_ARGUMENT error if the provided DataObject is not a child of self.
pub unsafe fn remove_child_unchecked<E>(
&self,
child: &DataObject<E>,
) -> Result<(), Error>
pub unsafe fn remove_child_unchecked<E>( &self, child: &DataObject<E>, ) -> Result<(), Error>
Removes a child object from the list of children.
§Safety
The caller must ensure that self.has_child(child).
pub fn remove_child_at_index(&self, index: u64) -> Result<(), Error>
pub fn remove_child_at_index(&self, index: u64) -> Result<(), Error>
Removes a child object in given index.
§Errors
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn remove_child_at_index_unchecked(
&self,
index: u64,
) -> Result<(), Error>
pub unsafe fn remove_child_at_index_unchecked( &self, index: u64, ) -> Result<(), Error>
Removes a child object in given index.
§Safety
The caller must ensure that index < self.get_child_count().
pub fn remove_all_children(&self) -> Result<(), Error>
pub fn remove_all_children(&self) -> Result<(), Error>
Removes all child nodes.
pub fn get_children_iterator(&self) -> Result<ChildrenIterator, Error>
pub fn get_children_iterator(&self) -> Result<ChildrenIterator, Error>
Gets an iterator over DataObject children.
pub fn get_children(&self) -> Result<Vec<Weak<DataObject<()>>>, Error>
pub fn get_children(&self) -> Result<Vec<Weak<DataObject<()>>>, Error>
Gets a list of DataObject children.
pub fn set_value(
&self,
value: <T as DataObjectConstraint>::DataArg<'_>,
) -> Result<(), Error>
pub fn set_value( &self, value: <T as DataObjectConstraint>::DataArg<'_>, ) -> Result<(), Error>
Sets the value of this data object.
pub fn get_value(&self) -> Result<T, Error>
pub fn get_value(&self) -> Result<T, Error>
Retrieves the value that is represented by this data object.
pub fn as_abstract(&self) -> &DataObject<()>
pub fn as_abstract(&self) -> &DataObject<()>
Casts DataObject reference to its abstract representation.
Methods from Deref<Target = DataContext>§
pub fn add_modified_notification_handler(
&self,
callback: impl Handle,
) -> Result<ModifiedSubscriptionToken, Error>
pub fn add_modified_notification_handler( &self, callback: impl Handle, ) -> Result<ModifiedSubscriptionToken, Error>
pub fn remove_modified_notification_handler(
&self,
token: &ModifiedSubscriptionToken,
) -> Result<(), Error>
pub fn remove_modified_notification_handler( &self, token: &ModifiedSubscriptionToken, ) -> Result<(), Error>
Allows to unsubscribe from modifications in this data context.
§Arguments
token- Token to identify the subscription that should be removed.
pub fn notify_modified(&self) -> Result<(), Error>
pub fn notify_modified(&self) -> Result<(), Error>
Triggers modification procedure in this data context, which invokes the subscriptions. Should be called by derived classes whenever the value of the object is changed.
pub fn get_data(&self) -> Result<Option<Weak<DataObject<()>>>, Error>
pub fn get_data(&self) -> Result<Option<Weak<DataObject<()>>>, Error>
Retrieves the root object of the underlying data tree. Needs to be implemented by the derived class.
§Returns
Returns data object that is the root of the data tree.
pub fn lookup_data_context(
&self,
relative_path: impl AsRef<KanziStr>,
) -> Result<Option<Weak<DataContext>>, Error>
pub fn lookup_data_context( &self, relative_path: impl AsRef<KanziStr>, ) -> Result<Option<Weak<DataContext>>, Error>
Methods from Deref<Target = Resource>§
pub fn get_name(&self) -> Result<KanziString, Error>
pub fn get_name(&self) -> Result<KanziString, Error>
Gets the resource name.
pub fn get_url(&self) -> Result<KanziString, Error>
pub fn get_url(&self) -> Result<KanziString, Error>
Gets the resource URL. Note that the URL is not necessarily in URL form if resource has been just created.
§Returns
URL string.
Methods from Deref<Target = Object>§
pub fn as_ptr(&self) -> *mut ObjectWrapper
pub fn as_wrapper(&self) -> &ObjectWrapper
pub fn as_object(&self) -> &Object
pub fn as_object(&self) -> &Object
Represents any type inheriting from Object as &Object.
This is useful for comparisions when PartialEq traits failed to compare objects of
different types.
let child = screen.get_child(0)?;
let parent = child.get_parent()?.into_error(ErrorKind::ObjectNotFound)?;
// assert_eq!(screen, parent); // <- Fails to compile!
assert_eq!(screen.as_object(), parent.as_object());pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
Gets a pointer to the backing C++ instance.
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers.
Base value is affected by the following inputs where the highest entry in the list determines the base value:
- Local value set with setProperty or loaded from kzb
- Value set by a style affecting the property.
- Value defined by class metadata.
Modifiers are not applied, the highest-priority base value is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
If there is no value sources, None is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the local value of a property type.
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
Evaluates whether there are any inputs into the property value. Both value sources and modifiers are taken into account.
§Returns
Returns true if there are inputs into the property value, false otherwise.
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Removes the local value associated with the property.
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
Returns the metaclass of the dynamic type of the object.
pub fn get_domain(&self) -> Result<Domain, Error>
pub fn get_domain(&self) -> Result<Domain, Error>
Returns the domain the object belongs to.
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the flag to indicate that the property was loaded from KZB.
pub fn debug_string(&self) -> Result<String, Error>
pub fn debug_string(&self) -> Result<String, Error>
Builds a string representation of the object intended for debugging purposes.
Trait Implementations§
§impl Clone for DataObjectList
impl Clone for DataObjectList
§fn clone(&self) -> DataObjectList
fn clone(&self) -> DataObjectList
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more