Repository: FreeCAD/FreeCAD
File: src/App/DocumentObject.h (C/C++)

Code before:
     * @param topParent: top parent of this subname path
     * @param child: the immediate child object in the path
     *
     * This function is called by tree view to generate a subname path when an
     * item is selected in the tree. Document object can use this function to
     * redirect the selection to some other objects.
     */
    virtual bool
    redirectSubName(std::ostringstream& ss, DocumentObject* topParent, DocumentObject* child) const;

    /** Special marker to mark the object as hidden
     *
     * It is used by Gui::ViewProvider::getElementColors(), but exposed here
     * for convenience
     */
    static const std::string& hiddenMarker();
    /// Check if the subname reference ends with hidden marker.
    static const char* hasHiddenMarker(const char* subname);

    /* Find the placement of a target object as seen from this.
    If no targetObj given, the last object found in the subname is used as target.
    */
    virtual Base::Placement getPlacementOf(const std::string& sub, DocumentObject* targetObj = nullptr);

    /* Returns the Placement property to use if any*/
    App::PropertyPlacement* getPlacementProperty() const;

protected:
    /// recompute only this object
    virtual App::DocumentObjectExecReturn* recompute();
    /** get called by the document to recompute this feature
     * Normally this method get called in the processing of
     * Document::recompute().
     * In execute() the output properties get recomputed
     * with the data from linked objects and objects own
     * properties.
     */
    virtual App::DocumentObjectExecReturn* execute();

    /**
     * Executes the extensions of a document object.
     */
    App::DocumentObjectExecReturn* executeExtensions();

    /** Status bits of the document object
     * The first 8 bits are used for the base system the rest can be used in
     * descendent classes to mark special statuses on the objects.
     * The bits and their meaning are listed below:
     *  0 - object is marked as 'touched'
     *  1 - object is marked as 'erroneous'
     *  2 - object is marked as 'new'

Review comment (suggestion):
I'd also consider adding `virtual Base::Placement getPlacement() const` which basically would be `getPlacementProperty()->getValue();` but would make code easier to read

Code after:
     * @param topParent: top parent of this subname path
     * @param child: the immediate child object in the path
     *
     * This function is called by tree view to generate a subname path when an
     * item is selected in the tree. Document object can use this function to
     * redirect the selection to some other objects.
     */
    virtual bool
    redirectSubName(std::ostringstream& ss, DocumentObject* topParent, DocumentObject* child) const;

    /** Special marker to mark the object as hidden
     *
     * It is used by Gui::ViewProvider::getElementColors(), but exposed here
     * for convenience
     */
    static const std::string& hiddenMarker();
    /// Check if the subname reference ends with hidden marker.
    static const char* hasHiddenMarker(const char* subname);

    /* Find the placement of a target object as seen from this.
    If no targetObj given, the last object found in the subname is used as target.
    */
    virtual Base::Placement getPlacementOf(const std::string& sub, DocumentObject* targetObj = nullptr);

    /* Returns the Placement property value if any.*/
    virtual Base::Placement getPlacement() const;

    /* Returns the Placement property to use if any*/
    virtual App::PropertyPlacement* getPlacementProperty() const;

protected:
    /// recompute only this object
    virtual App::DocumentObjectExecReturn* recompute();
    /** get called by the document to recompute this feature
     * Normally this method get called in the processing of
     * Document::recompute().
     * In execute() the output properties get recomputed
     * with the data from linked objects and objects own
     * properties.
     */
    virtual App::DocumentObjectExecReturn* execute();

    /**
     * Executes the extensions of a document object.
     */
    App::DocumentObjectExecReturn* executeExtensions();

    /** Status bits of the document object
     * The first 8 bits are used for the base system the rest can be used in
     * descendent classes to mark special statuses on the objects.
     * The bits and their meaning are listed below: