HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_TypeDefinitionFileLoader Class Reference

A class for handling files and HDAs as sources of vop type definitions. More...

#include <VOP_TypeDefinitionFile.h>

+ Inheritance diagram for VOP_TypeDefinitionFileLoader:

Public Member Functions

 VOP_TypeDefinitionFileLoader (VOP_LanguageManager &mgr)
 
 ~VOP_TypeDefinitionFileLoader () override
 
const char * getDefaultSourceFile () const
 Gets the file path where the vop types are saved by default. More...
 
void loadDefinitionFilesInSearchPath ()
 Looks for the definition files in the search path and loads them. More...
 
bool loadFile (const char *file_path, UT_String &errors)
 Loads the definitions from the specified file. More...
 
void createOrUpdateType (const char *old_type_name, VOP_TypeDefinitionHandle type_handle, const char *source_path, UT_String &errors)
 
bool deleteType (const char *type_name)
 Deletes the definition from the source. More...
 
void registerDefaultFactories ()
 Adds default factories to the map (eg, for "struct" metatype) More...
 
void registerOperatorInterests ()
 
void registerFactory (const UT_StringHolder &metatype_name, const VOP_TypeDefinitionFactory &factory)
 
void unregisterFactory (const UT_StringHolder &metatype_name)
 
void beginDeferUpdates ()
 
void endDeferUpdates ()
 
- Public Member Functions inherited from OP_UpdateTableSink
 OP_UpdateTableSink ()
 
virtual ~OP_UpdateTableSink ()
 
virtual void tableDeleted (OP_OperatorTable *table)
 
- Public Member Functions inherited from OP_UpdateTemplatesSink
 OP_UpdateTemplatesSink ()
 
virtual ~OP_UpdateTemplatesSink ()
 

Protected Member Functions

void tableUpdated (OP_OperatorTable *table) override
 
void templatesUpdated (OP_Operator *op) override
 
void operatorDeleted (OP_Operator *op) override
 
- Protected Member Functions inherited from OP_UpdateTableSink
void addUpdateTableSink (OP_OperatorTable *table)
 
void removeUpdateTableSink (OP_OperatorTable *table)
 
void removeAllTableSinks ()
 
- Protected Member Functions inherited from OP_UpdateTemplatesSink
void addUpdateTemplatesSink (OP_Operator *op)
 
bool hasTemplatesSink (OP_Operator *op)
 
void removeUpdateTemplatesSink (OP_Operator *op)
 
void removeAllTemplatesSinks ()
 

Detailed Description

A class for handling files and HDAs as sources of vop type definitions.

Definition at line 125 of file VOP_TypeDefinitionFile.h.

Constructor & Destructor Documentation

VOP_TypeDefinitionFileLoader::VOP_TypeDefinitionFileLoader ( VOP_LanguageManager mgr)
VOP_TypeDefinitionFileLoader::~VOP_TypeDefinitionFileLoader ( )
override

Member Function Documentation

void VOP_TypeDefinitionFileLoader::beginDeferUpdates ( )

Starts and ends a block of code in which the op table updates should not be handled. All the pending actions are performed only at the time the last endDeferHandlingUpdates() is called.

void VOP_TypeDefinitionFileLoader::createOrUpdateType ( const char *  old_type_name,
VOP_TypeDefinitionHandle  type_handle,
const char *  source_path,
UT_String errors 
)

Sets a new type definition for a given type name.

Parameters
old_type_nameThe original name of the type to redefine. This should be NULL, if it's a brand new type. If the new definition has a new type name, this parameter contains the original (old) type name that is being renamed.
type_handleThe handle to the type definition object. Manager will use it as the new definition for the type. The definition must have a valid non-empty type name string.
source_pathThe file where to save the type definition. If the old definition resided in another file, it is moved to this new file. If NULL, a default file will be used.
errorsAn outgoing string parameter that will contain error messages if manger encounters any problems.
bool VOP_TypeDefinitionFileLoader::deleteType ( const char *  type_name)

Deletes the definition from the source.

void VOP_TypeDefinitionFileLoader::endDeferUpdates ( )

Starts and ends a block of code in which the op table updates should not be handled. All the pending actions are performed only at the time the last endDeferHandlingUpdates() is called.

const char* VOP_TypeDefinitionFileLoader::getDefaultSourceFile ( ) const

Gets the file path where the vop types are saved by default.

void VOP_TypeDefinitionFileLoader::loadDefinitionFilesInSearchPath ( )

Looks for the definition files in the search path and loads them.

bool VOP_TypeDefinitionFileLoader::loadFile ( const char *  file_path,
UT_String errors 
)

Loads the definitions from the specified file.

void VOP_TypeDefinitionFileLoader::operatorDeleted ( OP_Operator op)
overrideprotectedvirtual

Virtual overrides from the base class. Respectively: monitoring for any new HDAs that appear in a table, keeping an eye on existing HDAs for anu updates, and making sure we handle deleted HDA operator types.

Reimplemented from OP_UpdateTemplatesSink.

void VOP_TypeDefinitionFileLoader::registerDefaultFactories ( )

Adds default factories to the map (eg, for "struct" metatype)

void VOP_TypeDefinitionFileLoader::registerFactory ( const UT_StringHolder metatype_name,
const VOP_TypeDefinitionFactory factory 
)

Registers a functor that creates a data type definition object associated with the given meta type name, when such meta type is encountered when reading and parsing a JSON file. After that the created object is given a chance to load itself from the definition JSON value.

void VOP_TypeDefinitionFileLoader::registerOperatorInterests ( )

Registers interests in tables and ops to monitor HDAs for their section that may define vop structs.

void VOP_TypeDefinitionFileLoader::tableUpdated ( OP_OperatorTable table)
overrideprotectedvirtual

Virtual overrides from the base class. Respectively: monitoring for any new HDAs that appear in a table, keeping an eye on existing HDAs for anu updates, and making sure we handle deleted HDA operator types.

Implements OP_UpdateTableSink.

void VOP_TypeDefinitionFileLoader::templatesUpdated ( OP_Operator op)
overrideprotectedvirtual

Virtual overrides from the base class. Respectively: monitoring for any new HDAs that appear in a table, keeping an eye on existing HDAs for anu updates, and making sure we handle deleted HDA operator types.

Implements OP_UpdateTemplatesSink.

void VOP_TypeDefinitionFileLoader::unregisterFactory ( const UT_StringHolder metatype_name)

Registers a functor that creates a data type definition object associated with the given meta type name, when such meta type is encountered when reading and parsing a JSON file. After that the created object is given a chance to load itself from the definition JSON value.


The documentation for this class was generated from the following file: