D18420: Use enum to identify AbstractAspect

Alexander Semke noreply at phabricator.kde.org
Fri May 10 09:25:42 BST 2019


asemke added inline comments.

INLINE COMMENTS

> AbstractAspect.h:49
> +/// enum values are chosen such that @verbatim inherits(base)@endverbatim
> +/// returns true iff the class inherits from @verbatim base at endverbatim.
> +///

small typo  - it should be "if".

> AbstractAspect.h:142
>  
> +	AspectType type() const {
> +		return m_type;

we moved all small and one-line functions except of the tempate functions into the cpp file to keep the header more clean. The compiler will manage to inline these one-liners :-)

> AspectTreeModel.cpp:276
>  	if (!m_selectableAspects.isEmpty()) {
> -		foreach (const char* classString, m_selectableAspects) {
> -			if (aspect->inherits(classString)) {
> +		foreach (AspectType type, m_selectableAspects) {
> +			if (aspect->inherits(type)) {

will the range-based for loop work here, too?

> LabPlotProjectParser.cpp:40
>  LabPlotProjectParser::LabPlotProjectParser() : ProjectParser() {
> -	m_topLevelClasses<<"Folder"<<"Workbook"<<"Spreadsheet"<<"Matrix"<<"Worksheet"<<"CantorWorksheet"<<"Datapicker"<<"LiveDataSource";
> +	m_topLevelClasses << AspectType::Folder << AspectType::Workbook
> +	                  << AspectType::Spreadsheet << AspectType::Matrix

list initialization also here as you did in AxisDock::setModel()?

> OriginProjectParser.cpp:63
>  OriginProjectParser::OriginProjectParser() : ProjectParser() {
> -	m_topLevelClasses << "Folder" << "Workbook" << "Spreadsheet" << "Matrix" << "Worksheet" << "Note";
> +	m_topLevelClasses << AspectType::Folder << AspectType::Workbook
> +	                  << AspectType::Spreadsheet << AspectType::Matrix

list initialization also here as you did in AxisDock::setModel()?

REPOSITORY
  R262 LabPlot

REVISION DETAIL
  https://phabricator.kde.org/D18420

To: croick, #labplot
Cc: asemke, kde-edu, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20190510/fa55608c/attachment-0001.html>


More information about the kde-edu mailing list