| 473 | } |
| 474 | |
| 475 | ObjectIdentifier PropertyExpressionEngine::canonicalPath(const ObjectIdentifier& oid) const |
| 476 | { |
| 477 | DocumentObject* docObj = freecad_cast<DocumentObject*>(getContainer()); |
| 478 | |
| 479 | // Am I owned by a DocumentObject? |
| 480 | if (!docObj) { |
| 481 | throw Base::RuntimeError("PropertyExpressionEngine must be owned by a DocumentObject."); |
| 482 | } |
| 483 | |
| 484 | int ptype; |
| 485 | Property* prop = oid.getProperty(&ptype); |
| 486 | |
| 487 | // oid pointing to a property...? |
| 488 | if (!prop) { |
| 489 | throw Base::RuntimeError(oid.resolveErrorString().c_str()); |
| 490 | } |
| 491 | |
| 492 | if (ptype || prop->getContainer() != getContainer()) { |
| 493 | return oid; |
| 494 | } |
| 495 | |
| 496 | // In case someone calls this with p pointing to a PropertyExpressionEngine for some reason |
| 497 | if (prop->isDerivedFrom(PropertyExpressionEngine::classTypeId)) { |
| 498 | return oid; |
| 499 | } |
| 500 | |
| 501 | // Dispatch call to actual canonicalPath implementation |
| 502 | return oid.canonicalPath(); |
| 503 | } |
| 504 | |
| 505 | size_t PropertyExpressionEngine::numExpressions() const |
| 506 | { |
no test coverage detected