Future release features
d1vanov opened this issue · comments
Dmitry Ivanov commented
It's not really an issue but rather the description of features which are already being prepared for some new future release. It's unspecified yet when this release would come out but nevertheless some features are already ready in branch feature/copy-on-write-types
. Here are some highlights:
- I got rid of custom
Optional
template class in favour ofstd::optional
from C++17 standard library. It's 2023 now and all major compilers out there support C++17 so there's no reason not to use good things from the updated standard library. - Types from Evernote's data model now implement Qt style copy on write. Previously such types were structs containing only fields but not methods. Now these are classes which provide const and non-const (mutable) getters to the data inside the class as well as setters. The use of non-const getters and setters may cause deep copy of the instance which is otherwise shallow copied around. Most behaviour-less classes in Qt implement the same kind of copy on write so it should feel quite convenient and natural in Qt applications.
- I've implemented serialization and deserialization to/from JSON format for types within QEverCloud library. Qt's facilities for JSON handling are used so this feature doesn't involve any additional dependencies. While it might feel like an unnecessary feature in a library such as QEverCloud, it was quite convenient to implement this feature within QEverCloud due to the fact that a large portion of QEverCloud source code is automatically generated via QEverCloudGenerator. JSON serialization/deserialization and unit tests for it are generated automatically as well.
- Each type from Evernote's data model in QEverCloud now has a corresponding builder class which is convenient especially for testing purposes if you want to quickly initialize the instance of a type containing particular values of some fields e.g.
auto myValue = MyValueBuilder{}.setField1(value1).setField2(value2).build();
The code supporting these builders was also generated automatically.
The corresponding branch in QEverCloudGenerator repo is also called feature/copy-on-write-types
.