Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
FileInterface Class Reference

Interface for editing files. More...

#include <FileInterface.h>

Inheritance diagram for FileInterface:
ParameterizableInterface NameGroupInterface CommonInterface

Public Member Functions

 FileInterface (QSharedPointer< FileValidator > validator, QSharedPointer< ExpressionParser > expressionParser, QSharedPointer< ExpressionFormatter > expressionFormatter)
 
virtual ~FileInterface ()=default
 
bool addDependency (std::string const &fileName, std::string const newDependency)
 
bool addExportedName (std::string const &fileName, std::string const newExportedName)
 
void addFile (int const &row, std::string const &newFileName=std::string(""))
 
void addFile (std::string const &newFileName=std::string(""))
 
bool addFileType (std::string const &fileName, std::string const newFileType)
 
bool addImageType (std::string const &fileName, std::string const newImageType)
 
bool addMultipleDependencies (std::string const &fileName, std::vector< std::string > const newDependencies)
 
bool addMultipleExportedNames (std::string const &fileName, std::vector< std::string > const newExportedNames)
 
bool addMultipleFileTypes (std::string const &fileName, std::vector< std::string > const newFileTypes)
 
bool addMultipleImageTypes (std::string const &fileName, std::vector< std::string > const newImageTypes)
 
void clearDependencies (std::string const &fileName)
 
void clearExportedNames (std::string const &fileName)
 
void clearFileTypes (std::string const &fileName)
 
void clearImageTypes (std::string const &fileName)
 
virtual int getAllReferencesToIdInItem (const std::string &fileName, std::string const &valueID) const override final
 
std::string getBuildCommandFlags (std::string const &fileName) const
 
std::string getBuildCommandReplaceDefaultFlagsExpression (std::string const &fileName) const
 
std::string getBuildCommandReplaceDefaultFlagsFormattedExpression (std::string const &fileName) const
 
std::string getBuildCommandReplaceDefaultFlagsValue (std::string const &fileName, int const &baseNumber=0) const
 
std::string getBuildCommandTarget (std::string const &fileName) const
 
std::string getBuildCommandText (std::string const &fileName) const
 
std::vector< std::string > getDependencies (std::string const &fileName) const
 
std::string getDescription (std::string const &itemName) const override
 
std::vector< std::string > getExportedNames (std::string const &fileName) const
 
std::vector< std::string > getExpressionsInSelectedFiles (std::vector< std::string > fileNames) const
 
std::vector< std::string > getFileTypes (std::string const &fileName) const
 
std::vector< std::string > getImageTypes (std::string const &fileName) const
 
std::string getIndexedItemName (int itemIndex) const final
 
virtual int getItemIndex (std::string const &itemName) const override final
 
virtual std::vector< std::string > getItemNames () const override final
 
std::string getLogicalName (std::string const &fileName) const
 
bool hasExternalDeclarations (std::string const &fileName) const
 
bool isIncludeFile (std::string const &fileName) const
 
bool isLogicalNameDefault (std::string const &fileName) const
 
bool isStructural (std::string const &fileName) const
 
virtual int itemCount () const override final
 
virtual bool itemHasValidName (std::string const &itemName) const override final
 
bool removeFile (std::string const &fileName)
 
bool setBuildCommand (std::string const &fileName, std::string const &newBuildCommand)
 
bool setBuildCommandFlags (std::string const &fileName, std::string const &newFlags)
 
bool setbuildCommandReplaceDefaultFlags (std::string const &fileName, std::string const &newReplaceDefaultFlags)
 
bool setBuildCommandTarget (std::string const &fileName, std::string const &newTarget)
 
bool setDescription (std::string const &itemName, std::string const &newDescription) override
 
bool setExternalDeclarations (std::string const &fileName, bool externalDeclarationsStatus)
 
void setFiles (QSharedPointer< QList< QSharedPointer< File > > > newFiles)
 
bool setFileTypes (std::string const &fileName, std::vector< std::string > const newFileTypes)
 
bool setIncludeFile (std::string const &fileName, bool includeFileStatus)
 
bool setLogicalName (std::string const &fileName, std::string newLogicalName)
 
bool setLogicalNameDefault (std::string const &fileName, bool newLogicalDefault)
 
virtual bool setName (std::string const &currentName, std::string const &newName) override final
 
bool setStructural (std::string const &fileName, bool structuralStatus)
 
void swapFiles (int const &firstIndex, int const &secondIndex)
 
virtual bool validateItems () const override final
 
- Public Member Functions inherited from ParameterizableInterface
 ParameterizableInterface (const ParameterizableInterface &other)=delete
 No copying. No assignment.
 
 ParameterizableInterface (QSharedPointer< ExpressionParser > expressionParser, QSharedPointer< ExpressionFormatter > expressionFormatter)
 
virtual ~ParameterizableInterface ()=default
 
ParameterizableInterfaceoperator= (const ParameterizableInterface &other)=delete
 
- Public Member Functions inherited from NameGroupInterface
 NameGroupInterface ()
 
 NameGroupInterface (const NameGroupInterface &other)=delete
 No copying. No assignment.
 
virtual ~NameGroupInterface ()=default
 
virtual std::string getDisplayName (std::string const &itemName) const
 
virtual std::string getShortDescription (std::string const &itemName) const
 
NameGroupInterfaceoperator= (const NameGroupInterface &other)=delete
 
virtual bool setDisplayName (std::string const &itemName, std::string const &newDisplayName) const
 
bool setShortDescription (std::string const &itemName, std::string const &newShortDescription) const
 
- Public Member Functions inherited from CommonInterface
 CommonInterface ()=default
 
 CommonInterface (const CommonInterface &other)=delete
 No copying. No assignment.
 
virtual ~CommonInterface ()=default
 
CommonInterfaceoperator= (const CommonInterface &other)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from ParameterizableInterface
QString formattedValueFor (QString const &expression) const
 
QString parseExpressionToBaseNumber (QString const &expression, unsigned int const &baseNumber, bool *expressionIsValid=nullptr) const
 
QString parseExpressionToDecimal (QString const &expression, bool *expressionIsValid=nullptr) const
 
- Protected Member Functions inherited from CommonInterface
QString getUniqueName (std::string const &newName, std::string const &itemTypeName) const
 
bool nameHasChanged (std::string const &newName, std::string const &oldName) const
 

Detailed Description

Interface for editing files.

Definition at line 32 of file FileInterface.h.

Constructor & Destructor Documentation

◆ FileInterface()

FileInterface::FileInterface ( QSharedPointer< FileValidator > validator,
QSharedPointer< ExpressionParser > expressionParser,
QSharedPointer< ExpressionFormatter > expressionFormatter )

The constructor.

Parameters
[in]validatorValidator for files.
[in]expressionParserParser for expressions.
[in]expressionFormatterFormatter for expressions.

◆ ~FileInterface()

virtual FileInterface::~FileInterface ( )
virtualdefault

The destructor.

Member Function Documentation

◆ addDependency()

bool FileInterface::addDependency ( std::string const & fileName,
std::string const newDependency )

Add the selected dependency to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newDependencyThe new dependency.
Returns
True, if successful, false otherwise.

◆ addExportedName()

bool FileInterface::addExportedName ( std::string const & fileName,
std::string const newExportedName )

Add the selected exported name to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newExportedNameThe new exported name.
Returns
True, if successful, false otherwise.

◆ addFile() [1/2]

void FileInterface::addFile ( int const & row,
std::string const & newFileName = std::string("") )

Add a new file, inserting it to a specified position given by row.

Parameters
[in]rowRow of the new file.
[in]newFileNameName of the new file.

◆ addFile() [2/2]

void FileInterface::addFile ( std::string const & newFileName = std::string(""))

Add a new file. This overload should be preferred when using Python.

Parameters
[in]newFileNameName of the new file.

◆ addFileType()

bool FileInterface::addFileType ( std::string const & fileName,
std::string const newFileType )

Add the selected file type to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newFileTypeThe new file type.
Returns
True, if successful, false otherwise.

◆ addImageType()

bool FileInterface::addImageType ( std::string const & fileName,
std::string const newImageType )

Add the selected image type to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newImageTypeThe new image type.
Returns
True, if successful, false otherwise.

◆ addMultipleDependencies()

bool FileInterface::addMultipleDependencies ( std::string const & fileName,
std::vector< std::string > const newDependencies )

Add multiple dependencies to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newDependenciesThe new dependencies.
Returns
True, if successful, false otherwise.

◆ addMultipleExportedNames()

bool FileInterface::addMultipleExportedNames ( std::string const & fileName,
std::vector< std::string > const newExportedNames )

Add multiple exported names to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newExportedNamesThe new exported names.
Returns
True, if successful, false otherwise.

◆ addMultipleFileTypes()

bool FileInterface::addMultipleFileTypes ( std::string const & fileName,
std::vector< std::string > const newFileTypes )

Add multiple file type to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newFileTypesThe new file types.
Returns
True, if successful, false otherwise.

◆ addMultipleImageTypes()

bool FileInterface::addMultipleImageTypes ( std::string const & fileName,
std::vector< std::string > const newImageTypes )

Add multiple image types to the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newImageTypesThe new image types.
Returns
True, if successful, false otherwise.

◆ clearDependencies()

void FileInterface::clearDependencies ( std::string const & fileName)

Clear all the dependencies on the selected file.

Parameters
[in]fileNameName of the selected file.

◆ clearExportedNames()

void FileInterface::clearExportedNames ( std::string const & fileName)

Clear all the exported names of the selected file.

Parameters
[in]fileNameName of the selected file.

◆ clearFileTypes()

void FileInterface::clearFileTypes ( std::string const & fileName)

Clear all the fileTypes and userFileTypes.

Parameters
[in]fileNameName of the selected file.

◆ clearImageTypes()

void FileInterface::clearImageTypes ( std::string const & fileName)

Clear all the image types on the selected file.

Parameters
[in]fileNameName of the selected file.

◆ getAllReferencesToIdInItem()

virtual int FileInterface::getAllReferencesToIdInItem ( const std::string & fileName,
std::string const & valueID ) const
finaloverridevirtual

Calculate all the references to the selected ID in the selected file.

Parameters
[in]fileNameName of the selected item.
[in]valueIDThe selected ID.
Returns
Number of references to the selected ID in the selected file.

Implements ParameterizableInterface.

◆ getBuildCommandFlags()

std::string FileInterface::getBuildCommandFlags ( std::string const & fileName) const

Get the build command flags of selected file.

Parameters
[in]fileNameName of the selected file.
Returns
Build command flags of the selected file.

◆ getBuildCommandReplaceDefaultFlagsExpression()

std::string FileInterface::getBuildCommandReplaceDefaultFlagsExpression ( std::string const & fileName) const

Get the build command replace default flags expression of the selected file.

Parameters
[in]fileNameName of the selected file.
Returns
Build command replace default flags expression of the selected file.

◆ getBuildCommandReplaceDefaultFlagsFormattedExpression()

std::string FileInterface::getBuildCommandReplaceDefaultFlagsFormattedExpression ( std::string const & fileName) const

Get the formatted build command replace default flags expression of the selected file.

Parameters
[in]fileNameName of the selected file.
Returns
Formatted build command replace default flags expression of the selected file.

◆ getBuildCommandReplaceDefaultFlagsValue()

std::string FileInterface::getBuildCommandReplaceDefaultFlagsValue ( std::string const & fileName,
int const & baseNumber = 0 ) const

Get the calculated build command replace default flags value of the selected file.

Parameters
[in]fileNameName of the selected file.
[in]baseNumberBase for displaying the value.
Returns
Calculated build command replace default flags value of the selected file.

◆ getBuildCommandTarget()

std::string FileInterface::getBuildCommandTarget ( std::string const & fileName) const

Get the build command target of selected file.

Parameters
[in]fileNameName of the selected file.
Returns
Build command target of the selected file.

◆ getBuildCommandText()

std::string FileInterface::getBuildCommandText ( std::string const & fileName) const

Get the build command of selected file.

Parameters
[in]fileNameName of the selected file.
Returns
Build command of the selected file.

◆ getDependencies()

std::vector< std::string > FileInterface::getDependencies ( std::string const & fileName) const

Get the dependencies of a file.

Parameters
[in]fileNameName of the selected file.
Returns
Dependencies of the selected file.

◆ getDescription()

std::string FileInterface::getDescription ( std::string const & itemName) const
overridevirtual

Get the description of the selected item. Can't inherit this function from NameGroupInterface, as File doesn't inherit from NameGroup.

Parameters
[in]itemNameName of the selected item.
Returns
Description of the selected item.

Reimplemented from NameGroupInterface.

◆ getExportedNames()

std::vector< std::string > FileInterface::getExportedNames ( std::string const & fileName) const

Get the exported names of a file.

Parameters
[in]fileNameName of the selected file.
Returns
Exported names of the selected file.

◆ getExpressionsInSelectedFiles()

std::vector< std::string > FileInterface::getExpressionsInSelectedFiles ( std::vector< std::string > fileNames) const

Get the expressions in the selected files.

Parameters
[in]fileNamesNames of the selected files.
Returns
The expressions of the selected files.

◆ getFileTypes()

std::vector< std::string > FileInterface::getFileTypes ( std::string const & fileName) const

Get the file types of the selected file.

Parameters
[in]fileNameName of the selected file.
Returns
List containing the file types.

◆ getImageTypes()

std::vector< std::string > FileInterface::getImageTypes ( std::string const & fileName) const

Get the image types of a file.

Parameters
[in]fileNameName of the selected file.
Returns
Image types of the selected file.

◆ getIndexedItemName()

std::string FileInterface::getIndexedItemName ( int itemIndex) const
finalvirtual

Get name of the indexed item.

Parameters
[in]itemIndexIndex of the selected item.
Returns
Name of the selected item.

Implements NameGroupInterface.

◆ getItemIndex()

virtual int FileInterface::getItemIndex ( std::string const & itemName) const
finaloverridevirtual

Get index of the selected item.

Parameters
[in]itemNameName of the selected item.
Returns
Index of the selected item.

Implements NameGroupInterface.

◆ getItemNames()

virtual std::vector< std::string > FileInterface::getItemNames ( ) const
finaloverridevirtual

Get the names of the available items.

Returns
Names of the available items.

Implements CommonInterface.

◆ getLogicalName()

std::string FileInterface::getLogicalName ( std::string const & fileName) const

Get the logical name of a file.

Parameters
[in]fileNameName of the selected file.
Returns
Logical name of the selected file.

◆ hasExternalDeclarations()

bool FileInterface::hasExternalDeclarations ( std::string const & fileName) const

Get attribute value of external declarations.

Parameters
[in]fileNameName of the selected file.
Returns
True of the file has external declarations, otherwise false.

◆ isIncludeFile()

bool FileInterface::isIncludeFile ( std::string const & fileName) const

Get the isIncludeFile setting.

Parameters
[in]fileNameName of the selected file.
Returns
True if the file is an include file, otherwise false.

◆ isLogicalNameDefault()

bool FileInterface::isLogicalNameDefault ( std::string const & fileName) const

Get the default-attribute value of the logicalName element.

Parameters
[in]fileNameName of the selected file.
Returns
True of the logical name is default, otherwise false.

◆ isStructural()

bool FileInterface::isStructural ( std::string const & fileName) const

Check if the file contains a structural RTL or not.

Parameters
[in]fileNameName of the selected file.
Returns
True, if the file contains a structural RTL, false otherwise.

◆ itemCount()

virtual int FileInterface::itemCount ( ) const
finaloverridevirtual

Get the number of available items.

Returns
Number of available items.

Implements CommonInterface.

◆ itemHasValidName()

virtual bool FileInterface::itemHasValidName ( std::string const & itemName) const
finaloverridevirtual

Check if the selected item has a valid name.

Parameters
[in]itemNameName of the selected item.
Returns
True, if the name is valid, false otherwise.

Implements NameGroupInterface.

◆ removeFile()

bool FileInterface::removeFile ( std::string const & fileName)

Remove the selected file.

Parameters
[in]fileNameName of the selected file.
Returns
True, if successful, false otherwise.

◆ setBuildCommand()

bool FileInterface::setBuildCommand ( std::string const & fileName,
std::string const & newBuildCommand )

Set the build command for the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newBuildCommandThe new build command.
Returns
True, if successful, false otherwise.

◆ setBuildCommandFlags()

bool FileInterface::setBuildCommandFlags ( std::string const & fileName,
std::string const & newFlags )

Set the build flags for the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newFlagsThe new flags.
Returns
True, if successful, false otherwise.

◆ setbuildCommandReplaceDefaultFlags()

bool FileInterface::setbuildCommandReplaceDefaultFlags ( std::string const & fileName,
std::string const & newReplaceDefaultFlags )

Set a new build command replace default flags value for the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newReplaceDefaultFlagsNew build command replace default flags value.
Returns
True, if successful, false otherwise.

◆ setBuildCommandTarget()

bool FileInterface::setBuildCommandTarget ( std::string const & fileName,
std::string const & newTarget )

Set the build target for the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newTargetThe new target.
Returns
True, if successful, false otherwise.

◆ setDescription()

bool FileInterface::setDescription ( std::string const & itemName,
std::string const & newDescription )
overridevirtual

Set a new description for the selected item. Can't inherit this function from NameGroupInterface, as File doesn't inherit from NameGroup.

Parameters
[in]itemNameName of the selected item.
[in]newDescriptionNew description.
Returns
True, if successful, false otherwise.

Reimplemented from NameGroupInterface.

◆ setExternalDeclarations()

bool FileInterface::setExternalDeclarations ( std::string const & fileName,
bool externalDeclarationsStatus )

Set the externalDeclarations setting

Parameters
[in]fileNameName of the selected file.
[in]externalDeclarationsStatusBoolean value to be set.
Returns
True, if successful, false otherwise.

◆ setFiles()

void FileInterface::setFiles ( QSharedPointer< QList< QSharedPointer< File > > > newFiles)

Set available files.

Parameters
[in]newFilesThe new files.

◆ setFileTypes()

bool FileInterface::setFileTypes ( std::string const & fileName,
std::vector< std::string > const newFileTypes )

Set file types for the selected file.

Parameters
[in]fileNameName of the selected file.
[in]newFileTypesThe new file types.
Returns
True, if successful, false otherwise.

◆ setIncludeFile()

bool FileInterface::setIncludeFile ( std::string const & fileName,
bool includeFileStatus )

Set the isIncludeFile setting for this file.

Parameters
[in]fileNameName of the selected file.
[in]includeFileStatusBoolean value to be set.
Returns
True, if successful, false otherwise.

◆ setLogicalName()

bool FileInterface::setLogicalName ( std::string const & fileName,
std::string newLogicalName )

Set a new logical name.

Parameters
[in]fileNameName of the selected file.
[in]newLogicalNameThe new logical name.
Returns
True, if successful, false otherwise.

◆ setLogicalNameDefault()

bool FileInterface::setLogicalNameDefault ( std::string const & fileName,
bool newLogicalDefault )

Set the logical name attribute default.

Parameters
[in]fileNameName of the selected file.
[in]newLogicalDefaultBoolean value of the attribute.
Returns
True, if successful, false otherwise.

◆ setName()

virtual bool FileInterface::setName ( std::string const & currentName,
std::string const & newName )
finaloverridevirtual

Set a new name for the selected item.

Parameters
[in]currentNameName of the selected item.
[in]newNameNew name for the item.
Returns
True, if successful, false otherwise.

Implements NameGroupInterface.

◆ setStructural()

bool FileInterface::setStructural ( std::string const & fileName,
bool structuralStatus )

Set the file to contain structural RTL.

Parameters
[in]fileNameName of the selected file.
[in]structuralStatusThe new structural status.
Returns
True, if successful, false otherwise.

◆ swapFiles()

void FileInterface::swapFiles ( int const & firstIndex,
int const & secondIndex )

Swap the positions of the selected files.

Parameters
[in]firstIndexIndex of the first file.
[in]secondIndexIndex of the second file.

◆ validateItems()

virtual bool FileInterface::validateItems ( ) const
finaloverridevirtual

Validates the contained items.

Returns
True, if all the ports are valid, false otherwise.

Implements CommonInterface.


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