#include "dcvccellcode.h"
#include "dccontainer.h"
+#include "utils/dcutil.h"
-DCCellCode::DCCellCode(std::string theName, std::string theCellAPIName)
- : TKCellCode(theName, theCellAPIName)
+DCCellCode::DCCellCode(DCContainer *container, std::string theName, std::string theCellAPIName)
+ : TKCellCode(theName, theCellAPIName), d_container(container)
{
}
{
}
-QString DCCellCode::getOwnScript(DCContainer *container) const
+QString DCCellCode::getOwnScript() const
{
- return container->readCellCodeScriptFromFile(this);
+ return d_container->readCellCodeScriptFromFile(this);
}
-void DCCellCode::saveScript(DCContainer *container, const QString &script)
+bool DCCellCode::saveScript(const QString &script)
{
- container->saveClassScriptToWorkFile(this, script.toStdString());
+ return d_container->saveClassScriptToWorkFile(this, script.toStdString());
}
+
+DCVCPage* DCCellCode::getPageBelonging() const
+{
+ return d_vComponent->getPageBelonging();
+}
+
+void DCCellCode::changeName(const QString &newName)
+{
+ QString fqnString = DCUtil::getFQNPath(getPageBelonging()->getLocationPath(), newName);
+ mFQNName = fqnString.toStdString();
+}
+
+void DCCellCode::changePath(const QString& newPath)
+{
+ QString name = DCUtil::getNameFromFQNPath(QString::fromStdString(mFQNName));
+ QString fqnString = DCUtil::getFQNPath(newPath, name);
+ mFQNName = fqnString.toStdString();
+}
+
+void DCCellCode::changeType(const QString &newType)
+{
+ mCellAPIName = newType.toStdString();
+}
+