Package ghidra.program.model.data
Interface Category
- All Superinterfaces:
Comparable<Category>
Each data type resides in a given a category.
-
Method Summary
Modifier and TypeMethodDescriptionaddDataType
(DataType dt, DataTypeConflictHandler handler) Adds the given datatype to this category.copyCategory
(Category category, DataTypeConflictHandler handler, TaskMonitor monitor) Make a new sub-category from the given category.createCategory
(String name) Create a category with the given name; if category already exists, then return that category.Category[]
Get all categories in this category.getCategory
(String name) Get a category with the given name.return the full CategoryPath for this category.Get the fully qualified name for this category.getDataType
(String name) Get a data type with the given name.Get the data type manager associated with this category.DataType[]
Get all data types in this category.getDataTypesByBaseName
(String name) Get all data types whose name matches the given name once any conflict suffixes have been removed from both the given name and the data types that are being scanned.long
getID()
Get the ID for this category.getName()
Get the name of this category.Return this category's parent; return null if this is the root category.getRoot()
Get the root category.boolean
isRoot()
Returns true if this is the root category.void
moveCategory
(Category category, TaskMonitor monitor) Move the given category to this category; category is removed from its original parent category.void
moveDataType
(DataType type, DataTypeConflictHandler handler) Move a data type into this category.boolean
remove
(DataType type, TaskMonitor monitor) Remove a datatype from this category.boolean
removeCategory
(String name, TaskMonitor monitor) Remove the named category from this category.boolean
removeEmptyCategory
(String name, TaskMonitor monitor) Remove the named category from this category, IFF it is empty.void
Sets the name of this category.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
getName
String getName()Get the name of this category.- Returns:
- the name.
-
setName
Sets the name of this category.- Parameters:
name
- the new name for this category- Throws:
DuplicateNameException
- if another category exists in the same parent with the same nameInvalidNameException
- if the name is not an acceptable name.
-
getCategories
Category[] getCategories()Get all categories in this category.- Returns:
- zero-length array if there are no categories.
-
getDataTypes
DataType[] getDataTypes()Get all data types in this category.- Returns:
- zero-length array if there are no data types.
-
getDataTypesByBaseName
Get all data types whose name matches the given name once any conflict suffixes have been removed from both the given name and the data types that are being scanned.
NOTE: Thename
provided must not contain array or pointer decorations.- Parameters:
name
- the name for which to get conflict related data types in this category. Note: the name that is passed in will be normalized to its base name, so you may pass in names with .conflict appended as a convenience.- Returns:
- a list of data types that have the same base name as the base name of the given name.
-
addDataType
Adds the given datatype to this category.- Parameters:
dt
- the datatype to add to this category.handler
- the DataTypeConflictHandler to use if conflicts are discovered.- Returns:
- the new datatype with its category path adjusted.
-
getCategory
Get a category with the given name.- Parameters:
name
- the name of the category.- Returns:
- null if there is no category by this name.
-
getCategoryPath
CategoryPath getCategoryPath()return the full CategoryPath for this category.- Returns:
- the full CategoryPath for this category.
-
getDataType
Get a data type with the given name.- Parameters:
name
- the name of the data type.- Returns:
- null if there is no data type by this name.
-
createCategory
Create a category with the given name; if category already exists, then return that category.- Parameters:
name
- the category name.- Returns:
- the category.
- Throws:
InvalidNameException
- if name has invalid characters.
-
removeCategory
Remove the named category from this category.- Parameters:
name
- the name of the category to remove.monitor
- the task monitor.- Returns:
- true if the category was removed.
-
removeEmptyCategory
Remove the named category from this category, IFF it is empty.- Parameters:
name
- the name of the category to remove.monitor
- the task monitor.- Returns:
- true if the category was removed.
-
moveCategory
Move the given category to this category; category is removed from its original parent category.- Parameters:
category
- the category to move.monitor
- the monitor.- Throws:
DuplicateNameException
- if this category already contains a category or data type with the same name as the category param.
-
copyCategory
Make a new sub-category from the given category.- Parameters:
category
- the category to copy into this category.handler
- the handler to call if there is a data type conflict.monitor
- the monitor.- Returns:
- category that is added to this category.
-
getParent
Category getParent()Return this category's parent; return null if this is the root category.- Returns:
- the category.
-
isRoot
boolean isRoot()Returns true if this is the root category.- Returns:
- true if this is the root category.
-
getCategoryPathName
String getCategoryPathName()Get the fully qualified name for this category.- Returns:
- the name.
-
getRoot
Category getRoot()Get the root category.- Returns:
- the category.
-
getDataTypeManager
DataTypeManager getDataTypeManager()Get the data type manager associated with this category.- Returns:
- the manager.
-
moveDataType
void moveDataType(DataType type, DataTypeConflictHandler handler) throws DataTypeDependencyException Move a data type into this category.- Parameters:
type
- data type to be moved.handler
- the handler to call if there is a data type conflict.- Throws:
DataTypeDependencyException
- if a disallowed dependency is created during the move.
-
remove
Remove a datatype from this category.- Parameters:
type
- data type to be removed.monitor
- monitor of progress in case operation takes a long time.- Returns:
- true if the data type was found in this category and successfully removed.
-
getID
long getID()Get the ID for this category.- Returns:
- the ID.
-