[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-edu-devel
Subject: D18420: Use enum to identify AbstractAspect
From: Alexander Semke <noreply () phabricator ! kde ! org>
Date: 2019-01-27 10:10:01
Message-ID: 28113e89d175ec4d8ee1abc96ff34c83 () localhost ! localdomain
[Download RAW message or body]
[Attachment #2 (text/plain)]
asemke added a comment.
In D18420#400631 <https://phabricator.kde.org/D18420#400631>, @croick wrote:
> If I had known in advance...
>
> I applied the `type()` identifier where I thought it reasonable.
> The naming is still a little unfortunate, but I cannot name the enum elements as their \
corresponding classes, because then the compiler doesn't know whether the enum type is meant or \
the class. Do you have a better idea than a "Type" suffix?
Yes, the naming is sub-optimal somehow... I think what we're trying to achieve here is kind \
of compile time reflection capabilities where c++ is lacking a lot of support for. And we're \
trying to add new stuff on top of Qt's meta-object system \
<http://doc.qt.io/qt-5/metaobjects.html> which already tries to overcome some of the \
limitations of the c++ language.
Should we try to utilize QMetaClassInfo <http://doc.qt.io/qt-5/qmetaclassinfo.html> and \
simply set a new property "classtype" to the corresponding value of the new enum you \
introduced? With this we'd only need to add a Q_CLASSINFO line in every header and don't need \
to touch the constructors and the cpp files. At run-time, we read this value out of \
QMetaClassInfo, cast it to the enum and use it in the switch-case block.
> In some place there are checks for a non-existant "FileDataSource". I deleted those for \
now, since I don't know what they are referring to. Is that called "LiveDataSource" now?
Yes, FileDataSource was renamed to LiveDataSource later. Thanks for cleaning up here.
REPOSITORY
R262 LabPlot
REVISION DETAIL
https://phabricator.kde.org/D18420
To: croick, #labplot
Cc: asemke, kde-edu, narvaez, apol
[Attachment #3 (text/html)]
<table><tr><td style="">asemke added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: \
#464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: \
linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid \
rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18420">View \
Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8; \
color: #6B748C; font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D18420#400631" \
style="background-color: #e7e7e7; border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">D18420#400631</a>, <a \
href="https://phabricator.kde.org/p/croick/" style=" border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@croick</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><p>If I had known in advance...</p>
<p>I applied the <tt style="background: #ebebeb; font-size: 13px;">type()</tt> identifier where \
I thought it reasonable.<br /> The naming is still a little unfortunate, but I cannot name the \
enum elements as their corresponding classes, because then the compiler doesn't know \
whether the enum type is meant or the class. Do you have a better idea than a "Type" \
suffix?</p></div> </blockquote>
<p>Yes, the naming is sub-optimal somehow... I think what we're trying to achieve here is \
kind of compile time reflection capabilities where c++ is lacking a lot of support for. And \
we're trying to add new stuff on top of <a href="http://doc.qt.io/qt-5/metaobjects.html" \
class="remarkup-link" target="_blank" rel="noreferrer">Qt's meta-object system</a> which \
already tries to overcome some of the limitations of the c++ language.</p>
<p>Should we try to utilize <a href="http://doc.qt.io/qt-5/qmetaclassinfo.html" \
class="remarkup-link" target="_blank" rel="noreferrer">QMetaClassInfo</a> and simply set a new \
property "classtype" to the corresponding value of the new enum you introduced? With \
this we'd only need to add a Q_CLASSINFO line in every header and don't need to touch \
the constructors and the cpp files. At run-time, we read this value out of QMetaClassInfo, cast \
it to the enum and use it in the switch-case block.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: \
4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>In some place there are checks \
for a non-existant "FileDataSource". I deleted those for now, since I don't know \
what they are referring to. Is that called "LiveDataSource" now?</p></blockquote>
<p>Yes, FileDataSource was renamed to LiveDataSource later. Thanks for cleaning up \
here.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R262 \
LabPlot</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a \
href="https://phabricator.kde.org/D18420">https://phabricator.kde.org/D18420</a></div></div><br \
/><div><strong>To: </strong>croick, LabPlot<br /><strong>Cc: </strong>asemke, kde-edu, narvaez, \
apol<br /></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic