本文整理汇总了C++中Version::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ Version::toString方法的具体用法?C++ Version::toString怎么用?C++ Version::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Version
的用法示例。
在下文中一共展示了Version::toString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateDocument
bool XmlConfigurationConverter::updateDocument(XmlDocument* document, std::string dtd,
const Version& version, std::string rootElementName) {
// update root element name
XmlElement* root = document->getRootElement();
if (!root) {
return false;
} // if
root->setName(rootElementName);
// update version entry in root element
if (root->hasAttribute("version")) {
root->getAttribute("version")->setValue(version.toString());
} // if
else {
XmlAttribute* versionAttribute = new XmlAttribute("version", version.toString());
root->addAttribute(versionAttribute);
} // else
// update dtd reference
XmlDtdReference* dtdRef = document->getDtd();
if (!dtdRef) {
dtdRef = new XmlDtdReference(rootElementName, dtd);
document->setDtd(dtdRef);
} else {
dtdRef->setName(rootElementName);
dtdRef->setDtd(dtd);
} // else
return true;
} // updateRootElement
示例2: QDialog
UpdateDialog::UpdateDialog(QWidget *parent, const Version &local,
const Version &remote) : QDialog(parent),
ui(new Ui::UpdateDialog) {
ui->setupUi(this);
m_remoteVersion = remote.toString().c_str();
ui->versionLabel->setText(QApplication::translate("UpdateDialog",
"Version %1 has been released (you are using %2). Would you like to visit the download page?",
0, QApplication::UnicodeUTF8).arg(m_remoteVersion).arg(local.toString().c_str()));
ui->changeView->setHtml("Loading change log ..");
m_networkManager = new QNetworkAccessManager(this);
connect(m_networkManager, SIGNAL(finished(QNetworkReply *)),
this, SLOT(onNetworkFinished(QNetworkReply *)));
m_networkReply = m_networkManager->get(QNetworkRequest(QUrl("http://www.mitsuba-renderer.org/changelog.html")));
}
示例3: remove_version
void Api::remove_version(const Remote &r, ProjectPath p, const Version &v)
{
check_relative(r, p);
ptree request;
request.put("project", p.toString());
request.put("version", v.toString());
api_call(r, "remove_version", request);
}
示例4: displayTooOldEnviromentError
void VersionsConverterManager::displayTooOldEnviromentError(Version const &saveVersion)
{
QString const errorMessage = QObject::tr("The save you are trying to open is made by version %1 of editor, "\
"whitch is newer than currently installed enviroment. "\
"Update your version before opening this save.").arg(saveVersion.toString());
showError(errorMessage);
}
示例5: restore
void Settings::restore()
{
QString version;
Version appVersion;
version = d->settings.value("Version", appVersion.toString()).toString();
Version settingsVersion(version);
if (settingsVersion < appVersion) {
#ifdef DEBUG
qDebug("Settings::restore: app version: %s, settings version: %s, conversion might be necessary!",
qPrintable(appVersion.toString()), qPrintable(settingsVersion.toString()));
/*!\todo Settings conversion as necessary */
#endif
}
d->maximumImagePointSize = d->settings.value("Scene/MaximumImagePointSize", SettingsPrivate::DefaultMaximumImagePointSize).toSize();
d->templateSize = d->settings.value("Scene/TemplateSize", SettingsPrivate::DefaultTemplateSize).toSize();
d->settings.beginGroup("Paths");
{
d->lastImageDirectoryPath = d->settings.value("LastImageDirectoryPath", SettingsPrivate::DefaultLastImageDirectoryPath).toString();
d->lastExportDirectoryPath = d->settings.value("LastExportDirectoryPath", SettingsPrivate::DefaultLastExportDirectoryPath).toString();
d->lastDocumenDirectoryPath = d->settings.value("LastDocumentDirectoryPath", SettingsPrivate::DefaultLastDocumentDirectoryPath).toString();
}
d->settings.endGroup();
d->settings.beginGroup("UI");
{
d->editRenderQuality = static_cast<EditRenderQuality>(d->settings.value("EditRenderQuality", static_cast<std::underlying_type<Settings::EditRenderQuality>::type>(SettingsPrivate::DefaultEditRenderQuality)).toInt());
d->toolBarVisible = d->settings.value("ToolBarVisible", SettingsPrivate::DefaultToolBarVisible).toBool();
d->sidePanelVisible = d->settings.value("SidePanelVisible", SettingsPrivate::DefaultSidePanelVisible).toBool();
d->settings.beginGroup("Gestures");
{
d->rotationGestureSensitivity = d->settings.value("RotationSensitivity", SettingsPrivate::DefaultRotationGestureSensitivity).toReal();
d->distanceGestureSensitivity = d->settings.value("DistanceSensitivity", SettingsPrivate::DefaultDistanceGestureSensitivity).toReal();
}
d->settings.endGroup();
}
d->settings.endGroup();
d->settings.beginGroup("i18n");
{
d->locale = QLocale(d->settings.value("Locale", SettingsPrivate::DefaultLocale.name()).toString());
d->systemLocaleEnabled = d->settings.value("SystemLocaleEnabled", SettingsPrivate::DefaultSystemLocaleEnabled).toBool();
}
d->settings.endGroup();
}
示例6: displayTooOldSaveError
void VersionsConverterManager::displayTooOldSaveError(Version const &saveVersion)
{
bool const showVersionDetails = saveVersion.isValid();
QString const reason = showVersionDetails
? QObject::tr("This project was created by version %1 of the editor.").arg(saveVersion.toString())
: QObject::tr("This project was created by too old version of the editor.");
QString const errorMessage = reason + QObject::tr(" It is now considered outdated and cannot be opened.");
showError(errorMessage);
}
示例7: main
int main(int, char * [])
{
// enlist all versions
std::cout << std::endl << std::endl << "[VERSIONS]" << std::endl << std::endl;
std::cout << "# Versions: " << Meta::versions().size() << std::endl << std::endl;
for (Version v : Meta::versions())
std::cout << v.toString() << std::endl;
// enlist all enums
std::cout << std::endl << std::endl << "[ENUMS]" << std::endl << std::endl;
if (Meta::stringsByGL())
{
std::cout << "# Enums: " << Meta::enums().size() << std::endl << std::endl;
for (GLenum e : Meta::enums()) // c++ 14 ...
std::cout << " (" << std::hex << std::showbase << std::internal << std::setfill('0') << std::setw(8)
<< static_cast<std::underlying_type<GLenum>::type>(e) << ") " << Meta::getString(e) << std::dec << std::endl;
std::cout << std::dec;
}
else
std::cout << std::endl << "warning: Enums cannot be enlisted since the glbinding used was compiled without GL_BY_STRINGS support." << std::endl;
// enlist all extensions
std::cout << std::endl << std::endl << "[EXTENSIONS]" << std::endl << std::endl;
if (Meta::stringsByGL())
{
std::cout << " # Extensions: " << Meta::extensions().size() << std::endl << std::endl;
for (GLextension e : Meta::extensions())
{
const Version v = Meta::getRequiringVersion(e);
std::cout << " " << Meta::getString(e) << " " << (v.isNull() ? "" : v.toString()) << std::endl;
}
}
else
std::cout << std::endl << "warning: EXTENSIONS cannot be enlisted since the glbinding used was compiled without GL_BY_STRINGS support." << std::endl;
// print some gl infos (query)
std::cout << std::endl
<< "OpenGL Revision: " << Meta::glRevision() << " (gl.xml)" << std::endl << std::endl;
return 0;
}
示例8: convertProject
bool VersionsConverterManager::convertProject(Version const &enviromentVersion
, Version const &saveVersion
, QList<ProjectConverter> const &converters)
{
// Stage I: Sorting converters by versions
QList<ProjectConverter> sortedConverters = converters;
qSort(sortedConverters.begin(), sortedConverters.end()
, [=](ProjectConverter const &converter1, ProjectConverter const &converter2)
{
return converter1.fromVersion() < converter2.fromVersion();
});
// Stage II: Checking that versions are not overlapped
for (int index = 0; index < sortedConverters.count() - 1; ++index) {
if (sortedConverters[index].toVersion() > sortedConverters[index + 1].fromVersion()) {
qDebug() << "Converter versions are overlapped!";
return false;
}
}
bool converterApplied = false;
// Stage III: Sequentially applying converters
for (ProjectConverter &converter : sortedConverters) {
if (converter.fromVersion() >= saveVersion && converter.toVersion() <= enviromentVersion) {
ProjectConverter::ConvertionResult const result = converter.convert(
mMainWindow.models()->graphicalModelAssistApi()
, mMainWindow.models()->logicalModelAssistApi());
switch (result) {
case ProjectConverter::Success:
converterApplied = true;
break;
case ProjectConverter::NoModificationsMade:
break;
case ProjectConverter::SaveInvalid:
displayCannotConvertError();
return false;
case ProjectConverter::VersionTooOld:
displayTooOldSaveError(saveVersion);
return false;
}
}
}
// Stage IV: Notifying user
if (converterApplied) {
mMainWindow.errorReporter()->addInformation(QObject::tr("Project was automaticly converted to version %1."\
" Please check its contents.").arg(enviromentVersion.toString()));
}
return true;
}
示例9: updateExtension
bool IExtensionsExtension::updateExtension(shared_ptr<Portal> portal, shared_ptr<IPortalDatabase> db, const Version &version)
{
OS_ASSERT(portal != nullptr);
//shared_ptr<IPortalDatabase> db = portal->getDatabase();
OS_EXCEPT_IF(db == nullptr, "Invalid database");
DbSqlValues values;
values.set(DBTABLES::EXTENSIONS::VERSION, static_cast<String>(version.toString()));
String sql = db->getConnection()->prepare_update(DBTABLES::EXTENSIONS_TABLE, values, DBTABLES::EXTENSIONS::ID, Convert::toSQL(getID().toUTF16()));
return db->getConnection()->executeStatement(sql, values);
}
示例10: while
// inserting/replacing version from specific remote replication daemon
// into/in 'm_versionsList'
void
AbstractReplicatorStateMachine::updateVersionsList( Version& newVersion )
{
Version* oldVersion;
// TODO: Atomic operation
m_versionsList.Rewind( );
while( m_versionsList.Next( oldVersion ) ) {
// deleting all occurences of replica belonging to the same host name
if( oldVersion->getHostName( ) == newVersion.getHostName( ) ) {
delete oldVersion;
m_versionsList.DeleteCurrent( );
}
}
dprintf( D_FULLDEBUG,
"AbstractReplicatorStateMachine::updateVersionsList appending %s\n",
newVersion.toString( ).Value( ) );
m_versionsList.Append( &newVersion );
m_versionsList.Rewind( );
// End of TODO: Atomic operation
}
示例11: run
bool SunJVMLauncher::run(ResourceManager& resource, const string& origin, bool justInstanciate)
{
DEBUG("Running now " + this->toString() + ", instanciate=" + (justInstanciate?"yes":"no"));
Version max(resource.getProperty(ResourceManager:: KEY_MAXVERSION));
Version min(resource.getProperty(ResourceManager:: KEY_MINVERSION));
// patch proposed by zregvart: if you're using bundeled JVM, you
// apriori know the version bundled and we can trust. The version
// check is therefore unrequired.
if (origin != "bundled") {
if (VmVersion.isValid() == false)
{
DEBUG("No version identified for " + toString());
SunJVMExe exe(this->JavaHome);
VmVersion = exe.guessVersion();
DEBUG("Version found: " + VmVersion.toString());
}
if (VmVersion.isValid() == false)
{
DEBUG("No version found, can't instanciate DLL without it");
return false;
}
if (min.isValid() && (VmVersion < min))
return false;
if (max.isValid() && (max < VmVersion))
return false;
}
DEBUG("Launching " + toString());
//
// search for the dll if it's not set in the registry, or if the
// file doesn't exist
//
if ( (this->JavaHome.size()>0)
&& ((this->RuntimeLibPath.size() == 0) || (!FileUtils::fileExists(this->RuntimeLibPath))) )
{
std::string assump = FileUtils::concFile(this->JavaHome, "jre\\bin\\jvm.dll");
std::string assump2 = FileUtils::concFile(this->JavaHome, "jre\\bin\\server\\jvm.dll"); // for JRE 1.5+
std::string assump3 = FileUtils::concFile(this->JavaHome, "jre\\bin\\client\\jvm.dll"); // for JRE 1.5+
std::string assump4 = FileUtils::concFile(this->JavaHome, "bin\\javai.dll"); // For JRE 1.1
if (FileUtils::fileExists(assump))
this->RuntimeLibPath = assump;
else if (FileUtils::fileExists(assump2))
this->RuntimeLibPath = assump2;
else if (FileUtils::fileExists(assump3))
this->RuntimeLibPath = assump3;
else if (FileUtils::fileExists(assump4))
this->RuntimeLibPath = assump4;
else
{
vector<string> dlls = FileUtils::recursiveSearch(this->JavaHome, string("jvm.dll"));
if (dlls.size() > 0)
this->RuntimeLibPath = dlls[0];
}
}
if (FileUtils::fileExists(this->RuntimeLibPath))
{
DEBUG("RuntimeLibPath used: " + this->RuntimeLibPath);
Version v = this->VmVersion;
if (!v.isValid())
{
v = min;
if (!v.isValid())
v = Version("1.2.0");
DEBUG("No version, trying with " + v.toString());
}
m_dllrunner = new SunJVMDLL(this->RuntimeLibPath, v);
// set up the vm parameters...
setupVM(resource, m_dllrunner);
if (justInstanciate)
return m_dllrunner->instanciate();
else
return m_dllrunner->run(resource.getProperty(ResourceManager::KEY_MAINCLASSNAME),
true);
}
return false;
}
示例12: newVersionAvailable
void BluecherryApp::newVersionAvailable(const Version &newVersion)
{
QMessageBox messageBox(mainWindow);
messageBox.setWindowTitle(tr("Bluecherry"));
messageBox.setText(tr("A new Bluecherry client update is available"));
messageBox.setInformativeText(tr("Would you like to download version %2 now?").arg(newVersion.toString()));
messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel | QMessageBox::Discard);
messageBox.button(QMessageBox::Ok)->setText(tr("Download"));
messageBox.button(QMessageBox::Cancel)->setText(tr("Remind Me Later"));
messageBox.button(QMessageBox::Discard)->setText(tr("Do Not Show Again"));
int result = messageBox.exec();
if (result == QMessageBox::Ok)
{
qDebug() << Q_FUNC_INFO << "Upgrading";
QDesktopServices::openUrl(QString::fromLatin1("http://www.bluecherrydvr.com/downloads/?v=%1").arg(QApplication::applicationVersion()));
}
if (result == QMessageBox::Discard)
{
stopUpdateChecker();
QSettings settings;
settings.setValue(QLatin1String("ui/disableUpdateNotifications"), true);
}
}
示例13: main
int main(int, char * [])
{
// enlist all versions
std::cout << std::endl << std::endl << "[VERSIONS]" << std::endl << std::endl;
std::cout << "# Versions: " << aux::Meta::versions().size() << std::endl << std::endl;
for (Version v : aux::Meta::versions())
std::cout << v.toString() << std::endl;
// enlist all enums
std::cout << std::endl << std::endl << "[ENUMS]" << std::endl << std::endl;
std::cout << "# Enums: " << aux::Meta::enums().size() << std::endl << std::endl;
for (GLenum e : aux::Meta::enums()) // c++ 14 ...
std::cout << " (" << std::hex << std::showbase << std::internal << std::setfill('0') << std::setw(8)
<< static_cast<std::underlying_type<GLenum>::type>(e) << ") " << aux::Meta::getString(e) << std::dec << std::endl;
std::cout << std::dec;
// enlist all extensions
std::cout << std::endl << std::endl << "[EXTENSIONS]" << std::endl << std::endl;
std::cout << " # Extensions: " << aux::Meta::extensions().size() << std::endl << std::endl;
for (GLextension extension : aux::Meta::extensions())
{
const Version v = aux::Meta::version(extension);
std::cout << " " << aux::Meta::getString(extension) << " " << (v.isNull() ? "" : v.toString()) << std::endl;
}
// print some gl infos (query)
std::cout << std::endl
<< "OpenGL Revision: " << aux::Meta::glRevision() << " (gl.xml)" << std::endl << std::endl;
return 0;
}
示例14: dprintf
bool
ReplicatorStateMachine::replicaSelectionHandler( Version& newVersion )
{
REPLICATION_ASSERT( m_state == VERSION_DOWNLOADING || m_state == BACKUP );
dprintf( D_ALWAYS, "ReplicatorStateMachine::replicaSelectionHandler "
"started with my version = %s, #versions = %d\n",
m_myVersion.toString( ).Value( ), m_versionsList.Number( ) );
List<Version> actualVersionsList;
Version myVersionCopy = m_myVersion;
utilCopyList( actualVersionsList, m_versionsList );
// in BACKUP state compares the received version with the local one
if( m_state == BACKUP ) {
// compares the versions, taking only 'gid' and 'logicalClock' into
// account - this is the reason for making the states equal
myVersionCopy.setState( newVersion );
return ! newVersion.isComparable( myVersionCopy ) ||
newVersion > myVersionCopy;
}
/* in VERSION_DOWNLOADING state selecting the best version from the list of
* received versions according to the policy defined by
* 'replicaSelectionHandler', i.e. selecting the version with greatest
* 'logicalClock' value amongst a group of versions with the same gid
*/
actualVersionsList.Rewind( );
if( actualVersionsList.IsEmpty( ) ) {
return false;
}
Version version;
Version bestVersion;
// taking the first actual version as the best version in the meantime
actualVersionsList.Next( bestVersion );
dprintf( D_ALWAYS, "ReplicatorStateMachine::replicaSelectionHandler best "
"version = %s\n", bestVersion.toString( ).Value( ) );
while( actualVersionsList.Next( version ) ) {
dprintf( D_ALWAYS, "ReplicatorStateMachine::replicaSelectionHandler "
"actual version = %s\n", version.toString( ).Value( ) );
if( version.isComparable( bestVersion ) && version > bestVersion ) {
bestVersion = version;
}
}
actualVersionsList.Rewind( );
// compares the versions, taking only 'gid' and 'logicalClock' into
// account - this is the reason for making the states equal
myVersionCopy.setState( bestVersion );
// either when the versions are incomparable or when the local version
// is worse, the remote version must be downloaded
if( myVersionCopy.isComparable( bestVersion ) &&
myVersionCopy >= bestVersion ) {
return false;
}
newVersion = bestVersion;
dprintf( D_ALWAYS, "ReplicatorStateMachine::replicaSelectionHandler "
"best version selected: %s\n", newVersion.toString().Value());
return true;
}