#include <opennurbs_archive.h>
Public Types | |
enum | : int { UnsetComponentIndex = ON_UNSET_INT_INDEX } |
Public Member Functions | |
ON_ComponentManifest () ON_NOEXCEPT | |
~ON_ComponentManifest () | |
unsigned int | ActiveAndDeletedComponentCount (ON_ModelComponent::Type component_type) const |
unsigned int | ActiveComponentCount (ON_ModelComponent::Type component_type) const |
const class ON_ComponentManifestItem & | AddComponentToManifest (const class ON_ModelComponent &component, bool bResolveIdAndNameCollisions, ON_wString *assigned_name) |
Add a component to this manifest. If the id is not set or not unique, the component will not be added. If a unique name is required and the name is not set or not unique, the component will not be added. More... | |
const class ON_ComponentManifestItem & | AddComponentToManifest (ON_ModelComponent::Type component_type, ON__UINT64 component_serial_number, ON_UUID component_id, const ON_NameHash &component_name_hash) |
Add a component to this manifest. More... | |
const class ON_ComponentManifestItem & | AddComponentToManifest (ON_ModelComponent::Type component_type, ON__UINT64 component_serial_number, ON_UUID component_parent_id, ON_UUID component_id, const ON_NameHash &component_name_hash, const wchar_t *candidate_name, ON_wString &assigned_name) |
Add a component to this manifest. If the id is not set or in use, then a new one will be assigned. If the component type requires a unique name and the name is not set or in use, then a new one will be assigned. More... | |
const class ON_ComponentManifestItem & | AddComponentToManifest (ON_ModelComponent::Type component_type, ON__UINT64 component_serial_number, ON_UUID component_parent_id, ON_UUID component_id, const wchar_t *original_name, ON_wString &assigned_name) |
const class ON_ComponentManifestItem & | AddSystemComponentToManifest (const class ON_ModelComponent &component) |
const class ON_ComponentManifestItem & | ChangeComponentName (ON_UUID item_id, ON_ModelComponent::Type component_type, ON_UUID component_parent_id, const wchar_t *component_name) |
Modify a manifest items's component name More... | |
const class ON_ComponentManifestItem & | ChangeComponentName (const class ON_ModelComponent &component) |
Modify a manifest items's component name More... | |
const class ON_ComponentManifestItem & | ChangeComponentNameHash (ON_UUID item_id, const ON_NameHash &component_name_hash) |
A function for expert users to directly set the component's name hash. Generally, it is better to use the ChangeComponentName() functions. More... | |
const class ON_ComponentManifestItem & | ChangeComponentRuntimeSerialNumber (ON_UUID item_id, ON__UINT64 component_runtime_serial_number) |
Modify a manifest items's component m_component_runtime_serial_number, m_original_index, m_original_id, and m_name_hash values. More... | |
int | ComponentIndexLimit (ON_ModelComponent::Type component_type) const |
const class ON_ComponentManifestItem & | DeleteComponent (ON_UUID item_id) |
Set a component's status to deleted. More... | |
const class ON_ComponentManifestItem & | DeleteComponent (ON__UINT64 component_runtime_serial_number) |
unsigned int | DeletedComponentCount (ON_ModelComponent::Type component_type) const |
const class ON_ComponentManifestItem * | FirstItem (ON_ModelComponent::Type component_type) const |
bool | IdIsAvailable (ON_UUID id) const |
unsigned int | ItemCount () const |
Total number of items in the manifest, including items referencing system components and deleted items. More... | |
const class ON_ComponentManifestItem & | ItemFromComponentRuntimeSerialNumber (ON__UINT64 component_runtime_serial_number) const |
const class ON_ComponentManifestItem & | ItemFromId (ON_UUID item_id) const |
const class ON_ComponentManifestItem & | ItemFromId (ON_ModelComponent::Type component_type, ON_UUID item_id) const |
Returns the item if it has the required component type and id. More... | |
const class ON_ComponentManifestItem & | ItemFromIndex (ON_ModelComponent::Type component_type, int item_index) const |
const class ON_ComponentManifestItem & | ItemFromName (const class ON_ModelComponent *model_component) const |
const class ON_ComponentManifestItem & | ItemFromName (ON_ModelComponent::Type component_type, ON_UUID parent_id, const wchar_t *name) const |
const class ON_ComponentManifestItem & | ItemFromNameHash (ON_ModelComponent::Type component_type, const ON_NameHash &component_name_hash) const |
const class ON_ComponentManifestItem & | ItemFromUnsignedIndex (ON_ModelComponent::Type component_type, unsigned int unsigned_item_index) const |
const class ON_ComponentManifestItem * | LastItem (ON_ModelComponent::Type component_type) const |
ON__UINT64 | ManifestContentVersionNumber () const |
This number is incremented every time the manifest changes. More... | |
bool | NameIsAvailable (ON_ModelComponent::Type component_type, const ON_NameHash &candidate_name_hash) const |
const class ON_ComponentManifestItem * | NextItem (const class ON_ComponentManifestItem *item) const |
const class ON_ComponentManifestItem * | NextItem (ON_UUID manifest_item_id) const |
const class ON_ComponentManifestItem * | PreviousItem (const class ON_ComponentManifestItem *item) const |
const class ON_ComponentManifestItem * | PreviousItem (ON_UUID manifest_item_id) const |
bool | RemoveAllComponents (ON_ModelComponent::Type component_type, bool bResetManifestIndex) |
bool | RemoveComponent (const ON_ModelComponent &component) |
bool | RemoveComponent (ON__UINT64 component_runtime_serial_number) |
bool | RemoveComponent (ON_UUID item_id) |
bool | RemoveIndexedComponent (ON_ModelComponent::Type component_type, int item_index) |
void | Reset () |
unsigned int | SystemComponentCount (ON_ModelComponent::Type component_type) const |
const class ON_ComponentManifestItem & | SystemItemFromIndex (ON_ModelComponent::Type component_type, int system_item_index) const |
const class ON_ComponentManifestItem & | SystemItemFromNameHash (ON_ModelComponent::Type component_type, const ON_NameHash &system_item_name_hash) const |
unsigned int | TotalComponentCount (ON_ModelComponent::Type component_type) const |
const class ON_ComponentManifestItem & | UndeleteComponent (ON_UUID item_id, ON_UUID parent_id, const wchar_t *candidate_name, ON_wString &assigned_name) |
Undelete a previously deleted component. More... | |
const class ON_ComponentManifestItem & | UndeleteComponentAndChangeRuntimeSerialNumber (ON_UUID item_id, ON_UUID parent_id, ON__UINT64 new_component_runtime_serial_number, const wchar_t *candidate_name, ON_wString &assigned_name) |
Undelete a previously deleted component with the same id and change the serial number to new_component_runtime_serial_number. More... | |
ON_UUID | UnusedId (ON_UUID candidate_id) const |
Get an id that is not currently used in this manifest More... | |
const ON_wString | UnusedName (ON_ModelComponent::Type component_type, ON_UUID component_parent_id, const wchar_t *candidate_name, const wchar_t *base_name, const wchar_t *suffix_separator, unsigned int suffix0, unsigned int *suffix_value) const |
Get a name that is currently not used in this manifest as either a component or manifest name. More... | |
const ON_wString | UnusedName (const ON_ModelComponent &model_component) const |
Get a name that is currently not used in this manifest as either a component or manifest name. More... | |
Static Public Attributes | |
static const ON_ComponentManifest | Empty |
ON_ComponentManifest::ON_ComponentManifest | ( | ) |
ON_ComponentManifest::~ON_ComponentManifest | ( | ) |
unsigned int ON_ComponentManifest::ActiveAndDeletedComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
component_type | [in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted. |
The count includes active and deleted components. The count does not include system components (those added by calling AddSystemComponentToManifest()).
unsigned int ON_ComponentManifest::ActiveComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
component_type | [in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted. |
The count does not include deleted components (IsDeleted() = true). The count does not include system components (those added by calling AddSystemComponentToManifest()).
const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest | ( | const class ON_ModelComponent & | component, |
bool | bResolveIdAndNameCollisions, | ||
ON_wString * | assigned_name | ||
) |
Add a component to this manifest. If the id is not set or not unique, the component will not be added. If a unique name is required and the name is not set or not unique, the component will not be added.
component | [in] If you want to update the component id, index and name values to match the ones assigned in the manifest, then call component.SetIdentification(manifest_item), where manifest_item is the information returned by this function. |
bResolveIdAndNameCollisions | [in] If false, then the component parameter id must not be used in the manifest and, when required, the name must be set and unique. If true and a new id or name is required, one will be assigned. Note that the component parameter is const and its id and name are not modified. |
assigned_name | [out] If not null, the assigned name is returned here. |
Use
const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest | ( | ON_ModelComponent::Type | component_type, |
ON__UINT64 | component_serial_number, | ||
ON_UUID | component_id, | ||
const ON_NameHash & | component_name_hash | ||
) |
Add a component to this manifest.
component_type | [in] Type of component. |
component_serial_number | [in] 0 or the component's unique runtime serial number (ON_ModelComponent::RuntimeSerialNumber()). |
component_id | [in] |
component_name_hash | [in] If the the component type requires a unique name and the name is not valid or in use, the component will not be added. |
const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest | ( | ON_ModelComponent::Type | component_type, |
ON__UINT64 | component_serial_number, | ||
ON_UUID | component_parent_id, | ||
ON_UUID | component_id, | ||
const ON_NameHash & | component_name_hash, | ||
const wchar_t * | candidate_name, | ||
ON_wString & | assigned_name | ||
) |
Add a component to this manifest. If the id is not set or in use, then a new one will be assigned. If the component type requires a unique name and the name is not set or in use, then a new one will be assigned.
component_type | [in] Type of component. |
component_serial_number | [in] 0 or the component's unique runtime serial number (ON_ModelComponent::RuntimeSerialNumber()). |
component_id | [in] If the id is nil or in use, a new id will be assigned. |
component_name_hash | [in] If the the component type requires a unique name and the name is not valid or in use, the component will not be added. |
original_name | [in/out] If a new name needs to be assigned, the input value will be used as a candidate and then as the root. Passing in the current name is a good choice. The output value is the final assigned name. |
const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest | ( | ON_ModelComponent::Type | component_type, |
ON__UINT64 | component_serial_number, | ||
ON_UUID | component_parent_id, | ||
ON_UUID | component_id, | ||
const wchar_t * | original_name, | ||
ON_wString & | assigned_name | ||
) |
const class ON_ComponentManifestItem& ON_ComponentManifest::AddSystemComponentToManifest | ( | const class ON_ModelComponent & | component | ) |
const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentName | ( | ON_UUID | item_id, |
ON_ModelComponent::Type | component_type, | ||
ON_UUID | component_parent_id, | ||
const wchar_t * | component_name | ||
) |
Modify a manifest items's component name
item_id | [in] Identifies the manifest item to modify. |
component_parent_id | [in] ON_ModelComponent.ParentId() value. When ON_ModelComponent::UniqueNameIncludesParent(component_type) is true, it is critical that component_parent_id be set correctly. |
name | [in] new name |
const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentName | ( | const class ON_ModelComponent & | component | ) |
Modify a manifest items's component name
component | [in] The component that is in the manifest with the new name set. |
const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentNameHash | ( | ON_UUID | item_id, |
const ON_NameHash & | component_name_hash | ||
) |
A function for expert users to directly set the component's name hash. Generally, it is better to use the ChangeComponentName() functions.
item_id | [in] Identifies the manifest item to modify. |
component_name_hash | [in] new name hash |
const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentRuntimeSerialNumber | ( | ON_UUID | item_id, |
ON__UINT64 | component_runtime_serial_number | ||
) |
Modify a manifest items's component m_component_runtime_serial_number, m_original_index, m_original_id, and m_name_hash values.
manifest_id | [in] identifies the manifest item to modify |
component_runtime_serial_number | [in] |
int ON_ComponentManifest::ComponentIndexLimit | ( | ON_ModelComponent::Type | component_type | ) | const |
component_type | [in] |
const class ON_ComponentManifestItem& ON_ComponentManifest::DeleteComponent | ( | ON_UUID | item_id | ) |
Set a component's status to deleted.
const class ON_ComponentManifestItem& ON_ComponentManifest::DeleteComponent | ( | ON__UINT64 | component_runtime_serial_number | ) |
unsigned int ON_ComponentManifest::DeletedComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
component_type | [in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted. |
System components cannot be deleted.
const class ON_ComponentManifestItem* ON_ComponentManifest::FirstItem | ( | ON_ModelComponent::Type | component_type | ) | const |
bool ON_ComponentManifest::IdIsAvailable | ( | ON_UUID | id | ) | const |
unsigned int ON_ComponentManifest::ItemCount | ( | ) | const |
Total number of items in the manifest, including items referencing system components and deleted items.
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromComponentRuntimeSerialNumber | ( | ON__UINT64 | component_runtime_serial_number | ) | const |
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromId | ( | ON_UUID | item_id | ) | const |
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromId | ( | ON_ModelComponent::Type | component_type, |
ON_UUID | item_id | ||
) | const |
Returns the item if it has the required component type and id.
Every item has a unique manifest id. The component_type parameter is provided if an additional check needs to be made on component type.
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromIndex | ( | ON_ModelComponent::Type | component_type, |
int | item_index | ||
) | const |
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromName | ( | const class ON_ModelComponent * | model_component | ) | const |
component_type | [in] |
component_name_hash | [in] The value of ON_ModelComponent::UniqueNameIgnoresCase(component_type) must be used when creating the name hash (group names are case sensitive). |
If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true, then the parent_id must be used to calculate the name hash (layer names require parent ids).
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromName | ( | ON_ModelComponent::Type | component_type, |
ON_UUID | parent_id, | ||
const wchar_t * | name | ||
) | const |
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromNameHash | ( | ON_ModelComponent::Type | component_type, |
const ON_NameHash & | component_name_hash | ||
) | const |
component_type | [in] |
component_name_hash | [in] The value of ON_ModelComponent::UniqueNameIgnoresCase(component_type) must be used when creating the name hash (group names are case sensitive). |
If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true, then the parent_id must be used to calculate the name hash (layer names require parent ids).
const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromUnsignedIndex | ( | ON_ModelComponent::Type | component_type, |
unsigned int | unsigned_item_index | ||
) | const |
const class ON_ComponentManifestItem* ON_ComponentManifest::LastItem | ( | ON_ModelComponent::Type | component_type | ) | const |
ON__UINT64 ON_ComponentManifest::ManifestContentVersionNumber | ( | ) | const |
This number is incremented every time the manifest changes.
bool ON_ComponentManifest::NameIsAvailable | ( | ON_ModelComponent::Type | component_type, |
const ON_NameHash & | candidate_name_hash | ||
) | const |
component_type | [in] ON_ModelComponent::ComponentTypeIsValidAndNotMixed(component_type) must be true or false will be returned. |
candidate_name_hash | [in] candidate_name_hash.IsValidAndNotEmpty() must be true or false will be returned. |
const class ON_ComponentManifestItem* ON_ComponentManifest::NextItem | ( | const class ON_ComponentManifestItem * | item | ) | const |
const class ON_ComponentManifestItem* ON_ComponentManifest::NextItem | ( | ON_UUID | manifest_item_id | ) | const |
const class ON_ComponentManifestItem* ON_ComponentManifest::PreviousItem | ( | const class ON_ComponentManifestItem * | item | ) | const |
const class ON_ComponentManifestItem* ON_ComponentManifest::PreviousItem | ( | ON_UUID | manifest_item_id | ) | const |
bool ON_ComponentManifest::RemoveAllComponents | ( | ON_ModelComponent::Type | component_type, |
bool | bResetManifestIndex | ||
) |
bool ON_ComponentManifest::RemoveComponent | ( | const ON_ModelComponent & | component | ) |
bool ON_ComponentManifest::RemoveComponent | ( | ON__UINT64 | component_runtime_serial_number | ) |
bool ON_ComponentManifest::RemoveComponent | ( | ON_UUID | item_id | ) |
bool ON_ComponentManifest::RemoveIndexedComponent | ( | ON_ModelComponent::Type | component_type, |
int | item_index | ||
) |
void ON_ComponentManifest::Reset | ( | ) |
unsigned int ON_ComponentManifest::SystemComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
const class ON_ComponentManifestItem& ON_ComponentManifest::SystemItemFromIndex | ( | ON_ModelComponent::Type | component_type, |
int | system_item_index | ||
) | const |
const class ON_ComponentManifestItem& ON_ComponentManifest::SystemItemFromNameHash | ( | ON_ModelComponent::Type | component_type, |
const ON_NameHash & | system_item_name_hash | ||
) | const |
unsigned int ON_ComponentManifest::TotalComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
component_type | [in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted. |
The count includes active, deleted, and system components.
const class ON_ComponentManifestItem& ON_ComponentManifest::UndeleteComponent | ( | ON_UUID | item_id, |
ON_UUID | parent_id, | ||
const wchar_t * | candidate_name, | ||
ON_wString & | assigned_name | ||
) |
Undelete a previously deleted component.
const class ON_ComponentManifestItem& ON_ComponentManifest::UndeleteComponentAndChangeRuntimeSerialNumber | ( | ON_UUID | item_id, |
ON_UUID | parent_id, | ||
ON__UINT64 | new_component_runtime_serial_number, | ||
const wchar_t * | candidate_name, | ||
ON_wString & | assigned_name | ||
) |
Undelete a previously deleted component with the same id and change the serial number to new_component_runtime_serial_number.
Often when an object is modified, the original and new object have the same id but different serial numbers. The original is deleted. When the item is undeleted for the object, the runtime serial number needs to be udated.
Get an id that is not currently used in this manifest
component_type | [in] ON_ModelComponent::ComponentTypeIsValidAndNotMixed(component_type) must be true. candidate_id If candidate_id is valid component id and not in use, then its value is returned. |
If candidate_id cannot be used, then ON_CreateId() is used to create a new id.
const ON_wString ON_ComponentManifest::UnusedName | ( | ON_ModelComponent::Type | component_type, |
ON_UUID | component_parent_id, | ||
const wchar_t * | candidate_name, | ||
const wchar_t * | base_name, | ||
const wchar_t * | suffix_separator, | ||
unsigned int | suffix0, | ||
unsigned int * | suffix_value | ||
) | const |
Get a name that is currently not used in this manifest as either a component or manifest name.
component_type | [in] ON_ModelComponent::ComponentTypeIsValidAndNotMixed(component_type) must be true. |
component_parent_id | [in] If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true and candidate_name is not empty, then the component parent id must be accurate. This is the case for ON_Layer names. Otherwise, you may pass ON_nil_uuid. |
candidate_name | [in] If candidate_name is a valid and not it use, then unused_component_name = candidate_name. If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true and candidate_name is not empty, then component_parent_id must be accurate. This is the case for ON_Layer names. |
base_name | [in] If base_name is empty or not valid, then ON_ModelComponent::ComponentTypeToString(component_type) is used as base_name |
suffix_separator | [in] empty or the string to place between base_name and the suffix when searching for an unsued name. |
suffix0 | [in] If a suffix needs to be appended, the search for a unused name begins with the suffix values suffix0+1. |
suffix_value | [out] If nullptr != suffix_value, the value used to generate the unique name suffix is returned. |
If candidate_name could not be used, then it has the form base_name + suffix_separator + X, where X is an integer > suffix0.
const ON_wString ON_ComponentManifest::UnusedName | ( | const ON_ModelComponent & | model_component | ) | const |
Get a name that is currently not used in this manifest as either a component or manifest name.
model_component | [in] The component type, id, parent id, and candidate name parameters for the more complicated version of UnusedName() are taken from this parameter. |
If candidate_name could not be used, then it has the form base_name + suffix_separator + X, where X is an integer > suffix0.
|
static |