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 ) )
82 if( !prop || prop->IsHiddenFromPropertiesManager() )
93 wxAny beforeVal = mutBefore->
Get( prop );
94 wxAny afterVal = mutAfter->
Get( prop );
109 d.
name = prop->Name();
112 deltas.push_back( std::move( d ) );
116 std::sort( deltas.begin(), deltas.end(),
119 return aL.name < aR.name;
133 std::vector<PROPERTY_DELTA> deltas;
145 if( !prop || prop->IsHiddenFromPropertiesManager() )
162 d.
name = prop->Name();
169 deltas.push_back( std::move( d ) );
172 std::sort( deltas.begin(), deltas.end(),
175 return aL.name < aR.name;
203 INSPECTABLE* aTarget,
const std::vector<PROPERTY_RESOLUTION>& aProps,
208 if( !aTarget || aProps.empty() )
219 wxLogTrace(
traceDiffMerge, wxT(
"applier: property '%s' not found on target type" ),
227 wxLogTrace(
traceDiffMerge, wxT(
"applier: property '%s' is read-only on target" ),
266 value =
const_cast<INSPECTABLE*
>( source )->Get( prop );
269 if( !aTarget->
Set( prop, value ) )
271 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)
A typed sum value used to carry the before/after of any single property.
wxString AsString() const
virtual bool Writeable(INSPECTABLE *aObject) 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.