24#ifndef KICAD_DIFF_PROPERTY_DIFF_H
25#define KICAD_DIFF_PROPERTY_DIFF_H
67 std::vector<PROPERTY_DELTA> deltas;
69 if( !aBefore || !aAfter ||
typeid( *aBefore ) !=
typeid( *aAfter ) )
73 std::vector<PROPERTY_BASE*> props = pm.
GetProperties( aBefore );
77 if( std::ranges::none_of( props,
80 return p->
Name() == dynAfter->Name();
83 props.push_back( dynAfter );
94 if( !prop || prop->IsHiddenFromPropertiesManager() )
105 wxAny beforeVal = mutBefore->
Get( prop );
106 wxAny afterVal = mutAfter->
Get( prop );
121 d.
name = prop->Name();
124 deltas.push_back( std::move( d ) );
128 std::sort( deltas.begin(), deltas.end(),
131 return aL.name < aR.name;
145 std::vector<PROPERTY_DELTA> deltas;
151 std::vector<PROPERTY_BASE*> props = pm.
GetProperties( aItem );
157 if( !prop || prop->IsHiddenFromPropertiesManager() )
174 d.
name = prop->Name();
181 deltas.push_back( std::move( d ) );
184 std::sort( deltas.begin(), deltas.end(),
187 return aL.name < aR.name;
215 INSPECTABLE* aTarget,
const std::vector<PROPERTY_RESOLUTION>& aProps,
220 if( !aTarget || aProps.empty() )
231 wxLogTrace(
traceDiffMerge, wxT(
"applier: property '%s' not found on target" ),
239 wxLogTrace(
traceDiffMerge, wxT(
"applier: property '%s' is read-only on target" ),
278 value =
const_cast<INSPECTABLE*
>( source )->Get( prop );
281 if( !aTarget->
Set( prop, value ) )
283 wxLogTrace(
traceDiffMerge, wxT(
"applier: Set failed for property '%s'" ),
Class that other classes need to inherit from, in order to be inspectable.
wxAny Get(PROPERTY_BASE *aProperty) const
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
virtual std::vector< PROPERTY_BASE * > GetDynamicProperties() const
Return dynamically-computed properties specific to this object instance (e.g.
A typed sum value used to carry the before/after of any single property.
wxString AsString() const
virtual bool Writeable(INSPECTABLE *aObject) const
const wxString & Name() const
Provide class metadata.Helper macro to map type hashes to names.
const std::vector< PROPERTY_BASE * > & GetProperties(TYPE_ID aType) const
Return all properties for a specific type.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
bool IsAvailableFor(TYPE_ID aItemClass, PROPERTY_BASE *aProp, INSPECTABLE *aItem)
Checks overriden availability and original availability of a property, returns false if the property ...
const wxChar *const traceDiffMerge
Flag to enable diff/merge engine and renderer debugging output.
std::vector< PROPERTY_DELTA > DiffItemProperties(const INSPECTABLE *aBefore, const INSPECTABLE *aAfter)
Enumerate the property deltas between two items of the same dynamic type.
bool DiffValueToWxAny(const DIFF_VALUE &aValue, wxAny &aOut)
Convert a DIFF_VALUE back into a wxAny a PROPERTY_BASE setter can consume.
std::vector< PROPERTY_DELTA > ItemProperties(const INSPECTABLE *aItem, bool aAsAfter)
List one item's properties as one-sided deltas for an added or removed item.
PROPERTY_APPLY_COUNTS ApplyPropertyResolutions(INSPECTABLE *aTarget, const std::vector< PROPERTY_RESOLUTION > &aProps, const INSPECTABLE *aOurs, const INSPECTABLE *aTheirs, const INSPECTABLE *aAncestor)
Apply per-property merge resolutions to aTarget, sourcing OURS/THEIRS/ANCESTOR values from the matchi...
DIFF_VALUE WxAnyToDiffValue(const wxAny &aValue, PROPERTY_BASE *aProperty)
Convert a wxAny value read from a PROPERTY_BASE getter into a DIFF_VALUE that the engine can store,...
Applied/failed tallies from ApplyPropertyResolutions, folded into a caller's report.
Single (name, before, after) triple for one mutated property on an item.
wxLogTrace helper definitions.
bool KiWxAnyEquals(const wxAny &aA, const wxAny &aB, const PROPERTY_BASE *aProperty)
Compare two wxAny values for equality across the KiCad property type set.