1 // Copyright (c) 2012 Dennco Project
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // Created by tkawata on Sep-30, 2012.
19 #include "dccellcode.h"
21 #include "dcvccellcode.h"
22 #include "dccontainer.h"
23 #include "utils/dcutil.h"
25 DCCellCode::DCCellCode(DCContainer *container, std::string theName, std::string theCellAPIName)
26 : TKCellCode(theName, theCellAPIName), d_container(container)
30 DCCellCode::~DCCellCode()
34 QString DCCellCode::getOwnScript() const
36 return d_container->readCellCodeScriptFromFile(this);
39 QString DCCellCode::getWorkFilePathForCellCodeScript() const
41 DCContainer *container = dynamic_cast<DCContainer*>(getContainer());
44 return container->getWorkFilePathForCellCode(this);
49 bool DCCellCode::saveScript(const QString &script)
51 return d_container->saveClassScriptToWorkFile(this, script.toStdString());
54 DCVCPage* DCCellCode::getPageBelonging() const
56 return d_vComponent->getPageBelonging();
59 void DCCellCode::changeName(const QString &newName)
61 QString fqnString = DCUtil::getFQNPath(getPageBelonging()->getLocationPath(), newName);
62 mFQNName = fqnString.toStdString();
65 void DCCellCode::changePath(const QString& newPath)
67 QString name = DCUtil::getNameFromFQNPath(QString::fromStdString(mFQNName));
68 QString fqnString = DCUtil::getFQNPath(newPath, name);
69 mFQNName = fqnString.toStdString();
72 void DCCellCode::changeType(const QString &newType)
74 mCellAPIName = newType.toStdString();