本文整理汇总了C++中DocumentObject::getNameInDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentObject::getNameInDocument方法的具体用法?C++ DocumentObject::getNameInDocument怎么用?C++ DocumentObject::getNameInDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentObject
的用法示例。
在下文中一共展示了DocumentObject::getNameInDocument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
bool ExpressionBinding::apply(const std::string & propName)
{
if (hasExpression()) {
DocumentObject * docObj = path.getDocumentObject();
if (!docObj)
throw Base::Exception("Document object not found.");
Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument('%s').%s.setExpression('%s', u'%s')",
docObj->getDocument()->getName(),
docObj->getNameInDocument(),
path.toEscapedString().c_str(),
getEscapedExpressionString().c_str());
return true;
}
else {
if (isBound()) {
DocumentObject * docObj = path.getDocumentObject();
if (!docObj)
throw Base::Exception("Document object not found.");
if (lastExpression)
Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument('%s').%s.setExpression('%s', None)",
docObj->getDocument()->getName(),
docObj->getNameInDocument(),
path.toEscapedString().c_str());
}
return false;
}
}
示例2: slotObjectRenamed
void PropertyExpressionEngine::slotObjectRenamed(const DocumentObject &obj)
{
#ifdef FC_PROPERTYEXPRESSIONENGINE_LOG
std::clog << "Object " << obj.getOldLabel() << " renamed to " << obj.Label.getValue() << std::endl;
#endif
DocumentObject * docObj = freecad_dynamic_cast<DocumentObject>(getContainer());
/* In a document object, and on undo stack? */
if (!docObj || docObj->getNameInDocument() == 0)
return;
RelabelDocumentObjectExpressionVisitor v(boost::bind( &PropertyExpressionEngine::aboutToSetValue, this),
boost::bind( &PropertyExpressionEngine::hasSetValue, this),
obj.getOldLabel(), obj.Label.getStrValue());
for (ExpressionMap::iterator it = expressions.begin(); it != expressions.end(); ++it) {
int changed = v.getChanged();
it->second.expression->visit(v);
if (changed != v.getChanged())
expressionChanged(it->first);
}
}
示例3: getName
Py::String DocumentObjectPy::getName(void) const
{
DocumentObject* object = this->getDocumentObjectPtr();
const char* internal = object->getNameInDocument();
if (!internal) {
throw Py::RuntimeError(std::string("This object is currently not part of a document"));
}
return Py::String(std::string(internal));
}
示例4: addObject
DocumentObject* GroupExtension::addObject(const char* sType, const char* pObjectName)
{
DocumentObject* obj = getExtendedObject()->getDocument()->addObject(sType, pObjectName);
if(!allowObject(obj)) {
getExtendedObject()->getDocument()->remObject(obj->getNameInDocument());
return nullptr;
}
if (obj) addObject(obj);
return obj;
}
示例5: Save
void PropertyLinkList::Save(Base::Writer &writer) const
{
writer.Stream() << writer.ind() << "<LinkList count=\"" << getSize() << "\">" << endl;
writer.incInd();
for (int i = 0; i<getSize(); i++) {
DocumentObject* obj = _lValueList[i];
if (obj)
writer.Stream() << writer.ind() << "<Link value=\"" << obj->getNameInDocument() << "\"/>" << endl;
else
writer.Stream() << writer.ind() << "<Link value=\"\"/>" << endl;
}
writer.decInd();
writer.Stream() << writer.ind() << "</LinkList>" << endl;
}
示例6: slotObjectDeleted
void PropertyExpressionEngine::slotObjectDeleted(const DocumentObject &obj)
{
DocumentObject * docObj = freecad_dynamic_cast<DocumentObject>(getContainer());
/* In a document object, and on undo stack? */
if (!docObj || docObj->getNameInDocument() == 0)
return;
ObjectDeletedExpressionVisitor v(&obj);
for (ExpressionMap::iterator it = expressions.begin(); it != expressions.end(); ++it) {
it->second.expression->visit(v);
if (v.isFound()) {
touch(); // Touch to force recompute; that will trigger a proper error
return;
}
}
}