Skip to content

Commit

Permalink
- Moved getClaasRestriction & getParameterNames to ModelicaBuiltin.mo.
Browse files Browse the repository at this point in the history
- updated getClaasRestriction to scripting API. Removed some unused APIs from OMCProxy.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24482 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Feb 9, 2015
1 parent 35a59d9 commit 8ecb212
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 64 deletions.
74 changes: 13 additions & 61 deletions OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -1172,18 +1172,6 @@ bool OMCProxy::isWhat(StringHandler::ModelicaClasses type, QString className)
return StringHandler::unparseBool(getResult());
}

/*!
Checks whether the class parameter is protected or not.
\param className - is the name of the class.
\param parameter - is the parameter to check.
\return true if the parameter is protected otherwise false
*/
bool OMCProxy::isProtected(QString parameter, QString className)
{
sendCommand("isProtected(" + parameter + "," + className + ")", true, className);
return StringHandler::unparseBool(getResult());
}

/*!
Checks whether the nested class is protected or not.
\param className - is the name of the class.
Expand Down Expand Up @@ -1212,57 +1200,37 @@ bool OMCProxy::isPartial(QString className)
*/
StringHandler::ModelicaClasses OMCProxy::getClassRestriction(QString className)
{
sendCommand("getClassRestriction(" + className + ")", true, className);
QString result = mpOMCInterface->getClassRestriction(className);

if (getResult().toLower().contains("model"))
if (result.toLower().contains("model"))
return StringHandler::Model;
else if (getResult().toLower().contains("class"))
else if (result.toLower().contains("class"))
return StringHandler::Class;
//! @note Also handles the expandable connectors i.e we return StringHandler::CONNECTOR for expandable connectors.
else if (getResult().toLower().contains("connector"))
else if (result.toLower().contains("connector"))
return StringHandler::Connector;
else if (getResult().toLower().contains("record"))
else if (result.toLower().contains("record"))
return StringHandler::Record;
else if (getResult().toLower().contains("block"))
else if (result.toLower().contains("block"))
return StringHandler::Block;
else if (getResult().toLower().contains("function"))
else if (result.toLower().contains("function"))
return StringHandler::Function;
else if (getResult().toLower().contains("package"))
else if (result.toLower().contains("package"))
return StringHandler::Package;
else if (getResult().toLower().contains("type"))
else if (result.toLower().contains("type"))
return StringHandler::Type;
else if (getResult().toLower().contains("operator"))
else if (result.toLower().contains("operator"))
return StringHandler::Operator;
else if (getResult().toLower().contains("operator record"))
else if (result.toLower().contains("operator record"))
return StringHandler::OperatorRecord;
else if (getResult().toLower().contains("operator function"))
else if (result.toLower().contains("operator function"))
return StringHandler::OperatorFunction;
else if (getResult().toLower().contains("optimization"))
else if (result.toLower().contains("optimization"))
return StringHandler::Optimization;
else
return StringHandler::Model;
}

/*!
Gets the parameter names.
\param className - is the name of the class whose parameter names are retrieved.
\return the list of parameter names.
*/
QStringList OMCProxy::getParameterNames(QString className)
{
QString result;
QString expression = "getParameterNames(" + className + ")";
sendCommand(expression, true, className);
result = StringHandler::removeFirstLastCurlBrackets(getResult());
if (result.isEmpty())
return QStringList();
else
{
QStringList list = result.split(",", QString::SkipEmptyParts);
return list;
}
}

/*!
Gets the parameter value.
\param className - is the name of the class whose parameter value is retrieved.
Expand All @@ -1278,22 +1246,6 @@ QString OMCProxy::getParameterValue(QString className, QString parameter)
}
}

/*!
Sets the parameter value.
\param className - is the name of the class whose parameter value is set.
\param parameter - is the name of the parameter whose value is set.
\param value - is the value to set.
\return true on success
*/
bool OMCProxy::setParameterValue(QString className, QString parameter, QString value)
{
sendCommand("setParameterValue(" + className + "," + parameter + "," + value + ")");
if (getResult().contains("Ok"))
return true;
else
return false;
}

/*!
Gets the list of component modifier names.
\param className - is the name of the class whose modifier names are retrieved.
Expand Down
3 changes: 0 additions & 3 deletions OMEdit/OMEditGUI/OMC/OMCProxy.h
Expand Up @@ -133,13 +133,10 @@ class OMCProxy : public QObject
bool isBuiltinType(QString typeName);
QString getBuiltinType(QString typeName);
bool isWhat(StringHandler::ModelicaClasses type, QString className);
bool isProtected(QString parameter, QString className);
bool isProtectedClass(QString className, QString nestedClassName);
bool isPartial(QString className);
StringHandler::ModelicaClasses getClassRestriction(QString className);
QStringList getParameterNames(QString className);
QString getParameterValue(QString className, QString parameter);
bool setParameterValue(QString className, QString parameter, QString value);
QStringList getComponentModifierNames(QString className, QString name);
QString getComponentModifierValue(QString className, QString name);
bool setComponentModifierValue(QString className, QString name, QString modifierValue);
Expand Down

0 comments on commit 8ecb212

Please sign in to comment.