Skip to content

Commit

Permalink
Added implicit conversion to std::string and QString from Vector
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Dec 27, 2019
1 parent 99e42ab commit 9adfa57
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/PluginComponents.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

#include <stdint.h>
#include <stddef.h>
#include <string>

#ifdef QT_VERSION
#include <QString>
#endif

#if defined(_MSC_VER)
#define PLUGIN_CALLING_CONVENTION __cdecl
Expand Down Expand Up @@ -91,6 +96,16 @@ struct Version {
bool operator==(const Version& other) const {
return this->major == other.major && this->minor == other.minor && this->patch == other.patch;
}

operator std::string() const {
return std::string("v") + std::to_string(this->major) + std::to_string(this->minor) + std::to_string(this->patch);
}

#ifdef QT_VERSION
operator QString() const {
return QString::fromLatin1("v%0.%1.%2").arg(this->major).arg(this->minor).arg(this->patch);
}
#endif
#endif
};

Expand Down

0 comments on commit 9adfa57

Please sign in to comment.