PROPERTY_MANAGER: added GetAllClasses and GetMatchingClasses methods
This commit is contained in:
parent
b82ec2161f
commit
4ffb82b4e3
|
@ -212,3 +212,39 @@ void PROPERTY_MANAGER::CLASS_DESC::collectPropsRecur( PROPERTY_LIST& aResult, PR
|
||||||
for( const auto& base : m_bases )
|
for( const auto& base : m_bases )
|
||||||
base.get().collectPropsRecur( aResult, aReplaced );
|
base.get().collectPropsRecur( aResult, aReplaced );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<TYPE_ID> PROPERTY_MANAGER::GetMatchingClasses( PROPERTY_BASE* aProperty )
|
||||||
|
{
|
||||||
|
std::vector<TYPE_ID> ids;
|
||||||
|
|
||||||
|
for( auto& cls : m_classes )
|
||||||
|
{
|
||||||
|
CLASS_INFO info;
|
||||||
|
|
||||||
|
for( auto prop : cls.second.m_allProperties )
|
||||||
|
info.properties.push_back(prop);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
PROPERTY_MANAGER::CLASSES_INFO PROPERTY_MANAGER::GetAllClasses()
|
||||||
|
{
|
||||||
|
CLASSES_INFO rv;
|
||||||
|
for( auto& cls : m_classes )
|
||||||
|
{
|
||||||
|
CLASS_INFO info;
|
||||||
|
|
||||||
|
info.type = cls.first;
|
||||||
|
info.name = m_classNames[cls.first];
|
||||||
|
|
||||||
|
for( auto prop : cls.second.m_allProperties )
|
||||||
|
info.properties.push_back(prop);
|
||||||
|
|
||||||
|
rv.push_back(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
|
@ -172,6 +172,19 @@ public:
|
||||||
*/
|
*/
|
||||||
void Rebuild();
|
void Rebuild();
|
||||||
|
|
||||||
|
struct CLASS_INFO
|
||||||
|
{
|
||||||
|
wxString name;
|
||||||
|
TYPE_ID type;
|
||||||
|
std::vector<PROPERTY_BASE*> properties;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<CLASS_INFO> CLASSES_INFO;
|
||||||
|
|
||||||
|
CLASSES_INFO GetAllClasses();
|
||||||
|
|
||||||
|
std::vector<TYPE_ID> GetMatchingClasses( PROPERTY_BASE* aProperty );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PROPERTY_MANAGER()
|
PROPERTY_MANAGER()
|
||||||
: m_dirty( false ), m_units( EDA_UNITS::MILLIMETRES )
|
: m_dirty( false ), m_units( EDA_UNITS::MILLIMETRES )
|
||||||
|
|
Loading…
Reference in New Issue