Archicad 29 C++ API
Loading...
Searching...
No Matches
ACAPI::AttributeManagerImportCallback Class Referenceabstract

AttributeManagerImportCallback is responsible for registering and handling file types to the AttributeManager through API. You can make your own implementation to add the possibility to import attributes from your own file format. More...

#include <AttributeManagerImportCallback.hpp>

Inheritance diagram for ACAPI::AttributeManagerImportCallback:
ACAPI::AddonServiceInterface

Public Member Functions

 AttributeManagerImportCallback (const GS::UniString &fileExtension)
 Constructs a new attribute manager callback.
 
virtual API_AttributeManagerFormat GetFileTypeFormat () const =0
 Provide the new file type, that should be registered on the AttributeManager dialog.
 
virtual GSErrCode ImportAttributeProcess (const IO::Location &sourceFile, GS::Array< GS::Pair< API_Attribute, API_AttributeDefExt * > > &result) const =0
 The import logic from the new file type.
 
- Public Member Functions inherited from ACAPI::AddonServiceInterface
 AddonServiceInterface (const API_Guid &serviceIdentifier)
 Creates and registers the AddonServiceInterface.
 
Result< void > GetStatus (const API_Token &token) const
 Get the status of the service registration.
 
virtual GSErrCode Initialize ()
 The callback function for the initialization phase.
 

Additional Inherited Members

- Protected Attributes inherited from ACAPI::AddonServiceInterface
ACAPI::Error status
 The error status of the registration.
 
const API_Guid serviceIdentifier
 Identifier given by constructor.
 

Detailed Description

AttributeManagerImportCallback is responsible for registering and handling file types to the AttributeManager through API. You can make your own implementation to add the possibility to import attributes from your own file format.

Since
Archicad 29
Example
class AttributeManagerImportTestCallback : public ACAPI::AttributeManagerImportCallback {
public:
AttributeManagerImportTestCallback ()
: ACAPI::AttributeManagerImportCallback ("txt")
{}
~AttributeManagerImportTestCallback ()
{}
GSErrCode ImportAttributeProcess (const IO::Location& /*sourceFile*/, GS::Array<GS::Pair<API_Attribute, API_AttributeDefExt*>>& /*result*/) const override
{
return NoError;
}
API_AttributeManagerFormat GetFileTypeFormat () const override
{
return { 'TEXT', 'GSAC', "Test txt file", "txt" };
}
};
// AttributeManagerImportTestCallback instance;

Constructor & Destructor Documentation

◆ AttributeManagerImportCallback()

ACAPI::AttributeManagerImportCallback::AttributeManagerImportCallback ( const GS::UniString & fileExtension)

Constructs a new attribute manager callback.

Parameters
fileExtensionThe extension of the registered file type.

Member Function Documentation

◆ GetFileTypeFormat()

virtual API_AttributeManagerFormat ACAPI::AttributeManagerImportCallback::GetFileTypeFormat ( ) const
pure virtual

Provide the new file type, that should be registered on the AttributeManager dialog.

Returns
The new file type.

◆ ImportAttributeProcess()

virtual GSErrCode ACAPI::AttributeManagerImportCallback::ImportAttributeProcess ( const IO::Location & sourceFile,
GS::Array< GS::Pair< API_Attribute, API_AttributeDefExt * > > & result ) const
pure virtual

The import logic from the new file type.

Parameters
sourceFileSource File Location.
resultThe result array where the new attributes are inserted by the import process.
Returns
NoError, Cancel, or other Error code.