Dave 5a9475
#pragma once
Dave 5a9475
Dave 5a9475
#ifndef TVER_INCLUDED
Dave 5a9475
#define TVER_INCLUDED
Dave 5a9475
Dave 5a9475
namespace TVER {
Dave 5a9475
Dave 5a9475
class ToonzVersion {
Dave 5a9475
public:
Dave 5a9475
  std::string getAppName(void);
Dave 5a9475
  float getAppVersion(void);
Dave 5a9475
  float getAppRevision(void);
13b034
  std::string getAppNote(void);
13b034
  bool hasAppNote(void);
Dave 5a9475
  std::string getAppVersionString(void);
Dave 5a9475
  std::string getAppRevisionString(void);
Dave 5a9475
  std::string getAppVersionInfo(std::string msg);
Dave 5a9475
Dave 5a9475
private:
Dave 5a9475
  const char *applicationName     = "OpenToonz";
shun-iwasawa 3e9334
  const float applicationVersion  = 1.3;
shun-iwasawa 3e9334
  const float applicationRevision = 0;
13b034
  const char *applicationNote     = "";
Dave 5a9475
};
Dave 5a9475
Dave 5a9475
std::string ToonzVersion::getAppName(void) {
Dave 5a9475
  std::string appname = applicationName;
Dave 5a9475
  return appname;
Dave 5a9475
}
Dave 5a9475
float ToonzVersion::getAppVersion(void) {
Dave 5a9475
  float appver = applicationVersion;
Dave 5a9475
  return appver;
Dave 5a9475
}
Dave 5a9475
float ToonzVersion::getAppRevision(void) {
Dave 5a9475
  float apprev = applicationRevision;
Dave 5a9475
  return apprev;
Dave 5a9475
}
13b034
std::string ToonzVersion::getAppNote(void) {
13b034
  std::string appnote = applicationNote;
13b034
  return appnote;
13b034
}
13b034
bool ToonzVersion::hasAppNote(void) {
13b034
  return *applicationNote != 0;
13b034
}
Dave 5a9475
std::string ToonzVersion::getAppVersionString(void) {
Dave 5a9475
  char buffer[50];
Dave 5a9475
  sprintf(buffer, "%.1f", applicationVersion);
Dave 5a9475
  std::string appver = std::string(buffer);
Dave 5a9475
  return appver;
Dave 5a9475
}
Dave 5a9475
std::string ToonzVersion::getAppRevisionString(void) {
Dave 5a9475
  char buffer[50];
Dave 5a9475
  sprintf(buffer, "%g", applicationRevision);
Dave 5a9475
  std::string apprev = std::string(buffer);
Dave 5a9475
  return apprev;
Dave 5a9475
}
Dave 5a9475
std::string ToonzVersion::getAppVersionInfo(std::string msg) {
Dave 5a9475
  std::string appinfo = std::string(applicationName);
Dave 5a9475
  appinfo += " " + msg + " v";
Dave 5a9475
  appinfo += getAppVersionString();
Dave 5a9475
  appinfo += "." + getAppRevisionString();
13b034
  if (hasAppNote())
13b034
    appinfo += " " + std::string(applicationNote);
Dave 5a9475
  return appinfo;
Dave 5a9475
}
Dave 5a9475
Dave 5a9475
}  // namespace TVER
Dave 5a9475
Dave 5a9475
#endif  // TVER_INCLUDED