HAL
hal::ActionCreateObject Class Reference

Create a new item. More...

#include <action_create_object.h>

Inheritance diagram for hal::ActionCreateObject:
Inheritance graph
Collaboration diagram for hal::ActionCreateObject:
Collaboration graph

Public Member Functions

 ActionCreateObject (UserActionObjectType::ObjectType type=UserActionObjectType::None, const QString &objName=QString())
 
bool exec () override
 
QString tagname () const override
 
void writeToXml (QXmlStreamWriter &xmlOut) const override
 
void readFromXml (QXmlStreamReader &xmlIn) override
 
void addToHash (QCryptographicHash &cryptoHash) const override
 
void setParentId (u32 pid)
 
void setLinkedObjectId (u32 lid)
 
- Public Member Functions inherited from hal::UserAction
virtual ~UserAction ()
 
virtual UserActionObject object () const
 
virtual void setObject (const UserActionObject &obj)
 
int compoundOrder () const
 
void setCompoundOrder (int cmpord)
 
qint64 timeStamp () const
 
QString cryptographicHash (int recordNo) const
 
UserActionundoAction () const
 
QString debugDump () const
 
void setObjectLock (bool lock)
 
void setParentObjectLock (bool lock)
 
bool hasProjectModified () const
 

Additional Inherited Members

- Protected Member Functions inherited from hal::UserAction
 UserAction ()
 
void writeParentObjectToXml (QXmlStreamWriter &xmlOut) const
 
void readParentObjectFromXml (QXmlStreamReader &xmlIn)
 
- Static Protected Member Functions inherited from hal::UserAction
static QString setToText (const QSet< u32 > &set)
 
static QSet< u32setFromText (const QString &s)
 
static QString gridToText (const QHash< hal::Node, QPoint > &grid)
 
static QHash< hal::Node, QPointgridFromText (const QString &txt)
 
- Protected Attributes inherited from hal::UserAction
UserActionObject mObject
 
UserActionObject mParentObject
 
int mCompoundOrder
 
UserActionmUndoAction
 
qint64 mTimeStamp
 
bool mObjectLock
 
bool mParentObjectLock
 
bool mProjectModified
 

Detailed Description

Create a new item.

Creates a new object with a given type and name.

Undo Action: ActionDeleteObject.

Definition at line 39 of file action_create_object.h.

Constructor & Destructor Documentation

◆ ActionCreateObject()

hal::ActionCreateObject::ActionCreateObject ( UserActionObjectType::ObjectType  type = UserActionObjectType::None,
const QString objName = QString() 
)

Action Constructor.

Parameters
type- The UserActionObjectType of the item that should be created (default type: None)
objName- The name of the object to create (default name: "").

Definition at line 26 of file action_create_object.cpp.

References hal::UserAction::setObject(), and type.

Member Function Documentation

◆ addToHash()

void hal::ActionCreateObject::addToHash ( QCryptographicHash cryptoHash) const
overridevirtual

Hook for derived classes to add parameter to cryptographic hash.

Parameters
cryptoHash- Additional hash data.

Reimplemented from hal::UserAction.

Definition at line 33 of file action_create_object.cpp.

References QCryptographicHash::addData(), and QString::toUtf8().

◆ exec()

bool hal::ActionCreateObject::exec ( )
overridevirtual

Executes user interaction and returns true on success. Note: Each implementation of exec() must include a call to the exec() method of base class to store the UserAction object in history and to transfer its ownership.

Returns
True on success, False otherwise.

Reimplemented from hal::UserAction.

Definition at line 60 of file action_create_object.cpp.

References hal::GroupingTableModel::addDefaultEntry(), hal::UserActionObjectType::ContextDir, hal::UserActionObjectType::ContextView, hal::Netlist::create_module(), hal::Netlist::create_net(), hal::GraphContextManager::createNewContext(), hal::GraphContextManager::createNewDirectory(), hal::UserAction::exec(), hal::gContentManager, hal::Grouping::get_id(), hal::Module::get_id(), hal::Netlist::get_module_by_id(), hal::Netlist::get_unique_module_id(), hal::ContentManager::getGroupingManagerWidget(), hal::GroupingManagerWidget::getModel(), hal::gGraphContextManager, hal::gNetlist, hal::UserActionObjectType::Grouping, hal::ContextDirectory::id(), hal::GraphContext::id(), hal::UserActionObject::id(), QString::isEmpty(), log_warning, hal::UserAction::mObject, hal::UserActionObjectType::Module, hal::UserAction::mUndoAction, test::n, hal::UserActionObjectType::Net, hal::GraphContextManager::nextDefaultName(), hal::GroupingTableModel::renameGrouping(), hal::GraphContextManager::setContextId(), hal::GraphContext::setExclusiveModuleId(), hal::ContextDirectory::setId(), hal::UserAction::setObject(), QString::toStdString(), and hal::UserActionObject::type().

Referenced by hal::NetlistRelay::addChildModuleDialog().

◆ readFromXml()

void hal::ActionCreateObject::readFromXml ( QXmlStreamReader xmlIn)
overridevirtual

Reads user interaction as well as arguments from xml macro file.

Parameters
xmlIn- The xml reader.

Reimplemented from hal::UserAction.

Definition at line 47 of file action_create_object.cpp.

References QXmlStreamReader::name(), QXmlStreamReader::readElementText(), QXmlStreamReader::readNextStartElement(), and QString::toInt().

◆ setLinkedObjectId()

void hal::ActionCreateObject::setLinkedObjectId ( u32  lid)
inline

Definition at line 60 of file action_create_object.h.

Referenced by hal::ActionDeleteObject::exec().

◆ setParentId()

void hal::ActionCreateObject::setParentId ( u32  pid)
inline

◆ tagname()

QString hal::ActionCreateObject::tagname ( ) const
overridevirtual

The xml tagname for the action is purely virtual and needs to be implemented in derived class.

Returns
The tagname.

Implements hal::UserAction.

Definition at line 21 of file action_create_object.cpp.

References hal::ActionCreateObjectFactory::sFactory, and hal::UserActionFactory::tagname().

◆ writeToXml()

void hal::ActionCreateObject::writeToXml ( QXmlStreamWriter xmlOut) const
overridevirtual

Persist user interaction in xml macro file.

Parameters
xmlOut- The xml writer.

Reimplemented from hal::UserAction.

Definition at line 40 of file action_create_object.cpp.

References QString::number(), and QXmlStreamWriter::writeTextElement().


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