-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract the xml parser from carddatabase #3223
Conversation
{ | ||
public: | ||
virtual ~ICardDatabaseParser() {} | ||
virtual bool getCanParseFile(const QString &name, QIODevice &device) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= 0;
vs = delete;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want a pure virtual function in order to make the class abstract (non-instanceable).
As far as I understand, with = delete
the method is not callable, but the class can still be instanced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://stackoverflow.com/questions/24958270/why-cant-i-declare-a-pure-virtual-function-with-delete Yeah you're right. Didn't realize we could create a fully abstract class in C++ :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, in any other language i'd use an interface
. In C++ you need some trickery to achieve the same result.
You'll want to run the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty excited about this. I'd like to explore auto-generating a parser from the XSD at some point down the line to reduce the amount of code we need to maintain
cockatrice/src/carddatabase.h
Outdated
@@ -398,11 +397,11 @@ class CardDatabase : public QObject | |||
|
|||
LoadStatus loadStatus; | |||
|
|||
/* | |||
* The available card database parsers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎 IMO we should avoid "what is this code" style comments unless it's very hard. In this case naming the variable availableParsers
would be enough.
public: | ||
CockatriceXml3Parser() {}; | ||
~CockatriceXml3Parser() {}; | ||
CockatriceXml3Parser(){}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=default; ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works leaving no changes to the files (Besides ordering, which is variable with XML anyway)
Related Ticket(s)
Short roundup of the initial problem
See #3201
What will change with this Pull Request?
The xml parser has been extracted from the card database.
The card database now supports querying multiple parsers; by now the only parser available is the "old" xml file parser.
There should be no user-noticeable difference in card parsing, loading or anything else.