CMake file

Update to C++ 11: std::shared_ptr, for each loops
Update to wxWidgets 3.0+
This commit is contained in:
Twan van Laarhoven
2020-04-08 00:18:14 +02:00
parent aa39a9bc71
commit 35a89676b4
53 changed files with 343 additions and 415 deletions
+1 -14
View File
@@ -154,17 +154,8 @@ void Package::clearKeepFlag() {
// ----------------------------------------------------------------------------- : Package : inside
#if 0
/// Class that is a wxZipInputStream over a wxFileInput stream
/** Note that wxFileInputStream is also a base class, because it must be constructed first
* This class requires a patch in wxWidgets (2.5.4)
* change zipstrm.cpp line 1745:;
* if ((!m_ffile || AtHeader()));
* to:
* if ((AtHeader()));
* It seems that in 2.6.3 this is no longer necessary (TODO: test)
*
* NOTE: Not used with wx 2.6.3, since it doesn't support seeking
*/
class ZipFileInputStream : private wxFileInputStream, public wxZipInputStream {
public:
@@ -175,7 +166,6 @@ class ZipFileInputStream : private wxFileInputStream, public wxZipInputStream {
OpenEntry(*entry);
}
};
#endif
class BufferedFileInputStream_aux {
protected:
@@ -219,10 +209,7 @@ InputStreamP Package::openIn(const String& file) {
stream = shared(new BufferedFileInputStream(filename+_("/")+file));
} else if (wxFileExists(filename) && it != files.end() && it->second.zipEntry) {
// a file in a zip archive
// somebody in wx thought seeking was no longer needed, it now only works with the 'compatability constructor'
stream = shared(new wxZipInputStream(filename, it->second.zipEntry->GetInternalName()));
//stream = static_pointer_cast<wxZipInputStream>(
// shared(new ZipFileInputStream(filename, it->second.zipEntry)));
stream = static_pointer_cast<wxZipInputStream>(shared(new ZipFileInputStream(filename, it->second.zipEntry)));
} else {
// shouldn't happen, packaged changed by someone else since opening it
throw FileNotFoundError(file, filename);
+1 -1
View File
@@ -147,7 +147,7 @@ class Package : public IntrusivePtrVirtualBase {
protected:
// TODO: I dislike putting this here very much. There ought to be a better way.
virtual VCSP getVCS() { return intrusive(new VCS()); }
virtual VCSP getVCS() { return make_shared<VCS>(); }
/// true if this is a zip file, false if a directory
bool isZipfile() const { return !wxDirExists(filename); }
+3 -1
View File
@@ -402,7 +402,9 @@ template <> void Reader::handle(tribool& tb) {
// ----------------------------------------------------------------------------- : Handling less basic util types
template <> void Reader::handle(wxDateTime& date) {
if (!date.ParseDateTime(getValue().c_str())) {
auto str = getValue();
String::const_iterator end;
if (!date.ParseDateTime(str,&end) || end != str.end()) {
throw ParseError(_("Expected a date and time"));
}
}
+1 -1
View File
@@ -209,7 +209,7 @@ template <typename T> void update_index(T&, size_t index) {}
template <typename T>
void Reader::handle(const Char* name, vector<T>& vector) {
String vectorKey = singular_form(name);
while (enterBlock(vectorKey)) {
while (enterBlock(vectorKey.c_str())) {
vector.resize(vector.size() + 1);
handle_greedy(vector.back());
update_index(vector.back(), vector.size() - 1); // update index for IndexMap
+2 -1
View File
@@ -103,8 +103,9 @@ class Writer {
template <typename T>
void Writer::handle(const Char* name, const vector<T>& vec) {
String vectorKey = singular_form(name);
const Char* vectorKeyC = IF_UNICODE(vectorKey.wc_str(), vectorKey.c_str());
for (typename vector<T>::const_iterator it = vec.begin() ; it != vec.end() ; ++it) {
handle(vectorKey, *it);
handle(vectorKeyC, *it);
}
}