Browse Source

PROPERTY_MANAGER: added GetAllClasses and GetMatchingClasses methods

pull/16/head
Tomasz Wlostowski 5 years ago
parent
commit
4ffb82b4e3
  1. 36
      common/property_mgr.cpp
  2. 13
      include/property_mgr.h

36
common/property_mgr.cpp

@ -212,3 +212,39 @@ void PROPERTY_MANAGER::CLASS_DESC::collectPropsRecur( PROPERTY_LIST& aResult, PR
for( const auto& base : m_bases )
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;
}

13
include/property_mgr.h

@ -172,6 +172,19 @@ public:
*/
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:
PROPERTY_MANAGER()
: m_dirty( false ), m_units( EDA_UNITS::MILLIMETRES )

Loading…
Cancel
Save