Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-object.cpp File Reference

Go to the source code of this file.

Functions

SPObjectsp_object_ref (SPObject *object, SPObject *owner)
 Increase reference count of object, with possible debugging.
 
SPObjectsp_object_unref (SPObject *object, SPObject *owner)
 Decrease reference count of object, with possible debugging and finalization.
 
static SPObject const * AncestorSon (SPObject const *obj, SPObject const *ancestor)
 
int sp_object_compare_position (SPObject const *first, SPObject const *second)
 Compares height of objects in tree.
 
bool sp_object_compare_position_bool (SPObject const *first, SPObject const *second)
 
static SPObjectget_closest_child_by_repr (SPObject &obj, Inkscape::XML::Node *ref)
 Get closest child to a reference representation.
 
static gchar const * sp_xml_get_space_string (unsigned int space)
 Return string representation of space value.
 
std::ostream & operator<< (std::ostream &out, const SPObject &o)
 

Variables

static unsigned indent_level = 0
 

Function Documentation

◆ AncestorSon()

static SPObject const * AncestorSon ( SPObject const *  obj,
SPObject const *  ancestor 
)
static

Definition at line 341 of file sp-object.cpp.

References AncestorSon(), SPObject::parent, and result.

Referenced by AncestorSon(), and sp_object_compare_position().

◆ get_closest_child_by_repr()

static SPObject * get_closest_child_by_repr ( SPObject obj,
Inkscape::XML::Node ref 
)
static

Get closest child to a reference representation.

May traverse backwards until it finds a child SPObject node.

Parameters
objParent object
refReference node, may be NULL
Returns
Child, or NULL if not found

Definition at line 692 of file sp-object.cpp.

References SPObject::document, SPObject::get_child_by_repr(), SPDocument::getObjectByRepr(), ref, and result.

Referenced by SPObject::child_added(), and SPObject::order_changed().

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const SPObject o 
)

◆ sp_object_compare_position()

int sp_object_compare_position ( SPObject const *  first,
SPObject const *  second 
)

Compares height of objects in tree.

Works for different-parent objects, so long as they have a common ancestor.

Returns
*    0    positions are equivalent
*    1    first object's position is greater than the second
*   -1    first object's position is less than the second   

Definition at line 353 of file sp-object.cpp.

References AncestorSon(), SPObject::getRepr(), SPObject::nearestCommonAncestor(), SPObject::parent, result, and sp_repr_compare_position().

Referenced by sp_object_compare_position_bool().

◆ sp_object_compare_position_bool()

◆ sp_object_ref()

SPObject * sp_object_ref ( SPObject object,
SPObject owner = nullptr 
)

Increase reference count of object, with possible debugging.

Parameters
ownerIf non-NULL, make debug log entry.
Returns
object, NULL is error.
Precondition
object points to real object
Todo:
need to move this to be a member of SPObject.

Definition at line 240 of file sp-object.cpp.

Referenced by Inkscape::ObjectHierarchy::_attach(), SPSwitch::_childList(), Inkscape::Selection::_emitChanged(), Inkscape::SelTrans::_selChanged(), Inkscape::UI::Dialog::LayerPropertiesDialog::_setLayer(), Inkscape::ObjectHierarchy::_trim_for_release(), Inkscape::ObjectHierarchy::_trimAbove(), Inkscape::ObjectHierarchy::_trimBelow(), SPObject::attach(), SPObject::childList(), SPObject::cropToObject(), SPObject::deleteObject(), SPObject::emitModified(), LivePathEffectObject::fork_private_if_necessary(), Inkscape::SelTrans::grab(), GrDraggable::GrDraggable(), KnotHolder::KnotHolder(), SPFlowregion::modified(), SPFlowregionExclude::modified(), SPDefs::modified(), SPFlowdiv::modified(), SPFlowtspan::modified(), SPFlowpara::modified(), SPGradient::modified(), SPHatch::modified(), SPMeshpatch::modified(), SPMeshrow::modified(), SPText::modified(), SPTRef::modified(), SPUse::modified(), SPDocument::queueForOrphanCollection(), SPLPEItem::removeAllPathEffects(), SPObject::set(), Inkscape::XML::SignalObserver::set(), Inkscape::ObjectHierarchy::setBottom(), SPObject::setSuccessor(), SPObject::setTmpSuccessor(), Inkscape::BooleanBuilder::shape_commit(), sp_selection_delete_impl(), Inkscape::UI::Tools::sp_spray_dilate(), sp_tref_convert_to_tspan(), Inkscape::UI::Tools::spdc_apply_powerstroke_shape(), SPUse::unlink(), SPFlowdiv::update(), SPFlowtspan::update(), SPFlowpara::update(), SPFlowregion::update(), SPFlowregionExclude::update(), SPFlowtext::update(), SPHatch::update(), SPText::update(), and SPUse::update().

◆ sp_object_unref()

SPObject * sp_object_unref ( SPObject object,
SPObject owner = nullptr 
)

Decrease reference count of object, with possible debugging and finalization.

Parameters
ownerIf non-NULL, make debug log entry.
Returns
always NULL
Precondition
object points to real object
Todo:
need to move this to be a member of SPObject.

Definition at line 251 of file sp-object.cpp.

References SPObject::refCount.

Referenced by Inkscape::ObjectHierarchy::_detach(), Inkscape::Selection::_releaseContext(), Inkscape::SelTrans::_selChanged(), Inkscape::UI::Dialog::LayerPropertiesDialog::_setLayer(), Inkscape::ObjectHierarchy::_trim_for_release(), Inkscape::ObjectHierarchy::_trimAbove(), Inkscape::ObjectHierarchy::_trimBelow(), SPLPEItem::applyToClipPath(), SPLPEItem::applyToMask(), SPObject::build(), SPObject::child_added(), SPDocument::collectOrphans(), SPObject::cropToObject(), SPObject::deleteObject(), SPObject::detach(), SPObject::emitModified(), LivePathEffectObject::fork_private_if_necessary(), SPUse::href_changed(), SPTagUse::href_changed(), SPFlowregion::modified(), SPFlowregionExclude::modified(), SPFeDiffuseLighting::modified(), SPFeSpecularLighting::modified(), SPClipPath::modified(), SPMask::modified(), SPPattern::modified(), SPDefs::modified(), SPFlowdiv::modified(), SPFlowtspan::modified(), SPFlowpara::modified(), SPGradient::modified(), SPHatch::modified(), SPGroup::modified(), SPMeshpatch::modified(), SPMeshrow::modified(), SPText::modified(), SPTRef::modified(), SPUse::modified(), SPLPEItem::removeAllPathEffects(), SPLPEItem::resetClipPathAndMaskLPE(), SPObject::set(), Inkscape::XML::SignalObserver::set(), Inkscape::ObjectHierarchy::setBottom(), Inkscape::BooleanBuilder::shape_commit(), sp_lpe_item_cleanup_original_path_recursive(), sp_lpe_item_create_original_path_recursive(), Inkscape::UI::Tools::SelectTool::sp_select_context_abort(), sp_selection_delete_impl(), Inkscape::UI::Tools::sp_spray_dilate(), sp_tref_convert_to_tspan(), sp_tref_update_text(), Inkscape::UI::Tools::spdc_apply_powerstroke_shape(), Inkscape::SelTrans::ungrab(), SPUse::unlink(), SPObject::unsetTmpSuccessor(), SPClipPath::update(), SPMask::update(), SPPattern::update(), SPDefs::update(), SPFlowdiv::update(), SPFlowtspan::update(), SPFlowpara::update(), SPFlowregion::update(), SPFlowregionExclude::update(), SPFlowtext::update(), SPHatch::update(), SPGroup::update(), SPText::update(), SPUse::update(), GrDraggable::~GrDraggable(), KnotHolder::~KnotHolder(), Inkscape::UI::Tools::SelectTool::~SelectTool(), Inkscape::SelTrans::~SelTrans(), SPDocument::~SPDocument(), and SPObject::~SPObject().

◆ sp_xml_get_space_string()

static gchar const * sp_xml_get_space_string ( unsigned int  space)
static

Return string representation of space value.

Definition at line 1170 of file sp-object.cpp.

References SP_XML_SPACE_DEFAULT, and SP_XML_SPACE_PRESERVE.

Referenced by SPObject::write().

Variable Documentation

◆ indent_level

unsigned indent_level = 0
static