Doc: Improve App::ObjectIdentifier docs

This commit is contained in:
Pieter Hijma
2025-04-29 21:10:42 +02:00
parent 295e9636a0
commit a51c72729c
5 changed files with 911 additions and 154 deletions

View File

@@ -442,7 +442,7 @@ std::string ObjectIdentifier::toEscapedString() const
return Base::Tools::escapedUnicodeFromUtf8(toString().c_str());
}
bool ObjectIdentifier::updateLabelReference(App::DocumentObject* obj,
bool ObjectIdentifier::updateLabelReference(const App::DocumentObject* obj,
const std::string& ref,
const char* newLabel)
{
@@ -574,7 +574,6 @@ ObjectIdentifier::Component::Component(String&& _name,
, step(_step)
{}
size_t ObjectIdentifier::Component::getIndex(size_t count) const
{
if (begin >= 0) {
@@ -1412,7 +1411,7 @@ std::string ObjectIdentifier::String::toString(bool toPython) const
void ObjectIdentifier::String::checkImport(const App::DocumentObject* owner,
const App::DocumentObject* obj,
String* objName)
const String* objName)
{
if (owner && owner->getDocument() && !str.empty()
&& ExpressionParser::ExpressionImporter::reader()) {
@@ -1454,7 +1453,7 @@ void ObjectIdentifier::String::checkImport(const App::DocumentObject* owner,
}
Py::Object
ObjectIdentifier::access(const ResolveResults& result, Py::Object* value, Dependencies* deps) const
ObjectIdentifier::access(const ResolveResults& result, const Py::Object* value, Dependencies* deps) const
{
if (!result.resolvedDocumentObject || !result.resolvedProperty
|| (!subObjectName.getString().empty() && !result.resolvedSubObject)) {
@@ -1886,7 +1885,7 @@ void ObjectIdentifier::resolveAmbiguity()
resolveAmbiguity(result);
}
void ObjectIdentifier::resolveAmbiguity(ResolveResults& result)
void ObjectIdentifier::resolveAmbiguity(const ResolveResults& result)
{
if (!result.resolvedDocumentObject) {

File diff suppressed because it is too large Load Diff

View File

@@ -406,7 +406,7 @@ void PropertyExpressionEngine::buildGraphStructures(
* @return New ObjectIdentifier
*/
ObjectIdentifier PropertyExpressionEngine::canonicalPath(const ObjectIdentifier& p) const
ObjectIdentifier PropertyExpressionEngine::canonicalPath(const ObjectIdentifier& oid) const
{
DocumentObject* docObj = freecad_cast<DocumentObject*>(getContainer());
@@ -416,24 +416,24 @@ ObjectIdentifier PropertyExpressionEngine::canonicalPath(const ObjectIdentifier&
}
int ptype;
Property* prop = p.getProperty(&ptype);
Property* prop = oid.getProperty(&ptype);
// p pointing to a property...?
// oid pointing to a property...?
if (!prop) {
throw Base::RuntimeError(p.resolveErrorString().c_str());
throw Base::RuntimeError(oid.resolveErrorString().c_str());
}
if (ptype || prop->getContainer() != getContainer()) {
return p;
return oid;
}
// In case someone calls this with p pointing to a PropertyExpressionEngine for some reason
if (prop->isDerivedFrom(PropertyExpressionEngine::classTypeId)) {
return p;
return oid;
}
// Dispatch call to actual canonicalPath implementation
return p.canonicalPath();
return oid.canonicalPath();
}
/**

View File

@@ -189,7 +189,7 @@ void PropertyLinkBase::checkLabelReferences(const std::vector<std::string>& subs
std::string PropertyLinkBase::updateLabelReference(const App::DocumentObject* parent,
const char* subname,
App::DocumentObject* obj,
const App::DocumentObject* obj,
const std::string& ref,
const char* newLabel)
{

View File

@@ -583,7 +583,7 @@ public:
*/
static std::string updateLabelReference(const App::DocumentObject* linked,
const char* subname,
App::DocumentObject* obj,
const App::DocumentObject* obj,
const std::string& ref,
const char* newLabel);
//@}