当前位置: 首页>>代码示例>>C++>>正文


C++ Version类代码示例

本文整理汇总了C++中Version的典型用法代码示例。如果您正苦于以下问题:C++ Version类的具体用法?C++ Version怎么用?C++ Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dprintf

/* Function   : onLeaderVersion
 * Arguments  : stream - socket, through which the data is received and sent
 * Description: handler of REPLICATION_LEADER_VERSION command; comparing the
 *				received version to the local one and downloading the replica
 *				from the remote replication daemon when the received version is
 *				better than the local one and there is no downloading
 *				'condor_transferer' running at the same time
 */
void
ReplicatorStateMachine::onLeaderVersion( Stream* stream )
{
    dprintf( D_ALWAYS, "ReplicatorStateMachine::onLeaderVersion started\n" );
    
    if( m_state != BACKUP ) {
        return ;
    }
	checkVersionSynchronization( );

    Version* newVersion = decodeVersionAndState( stream );
	// comparing the received version to the local one
    bool downloadNeeded = replicaSelectionHandler( *newVersion );
    // downloading the replica from the remote replication daemon, when the
	// received version is better and there is no running downloading
	// 'condor_transferers'  
    if( downloadTransferersNumber( ) == 0 && newVersion && downloadNeeded ) {
        dprintf( D_FULLDEBUG, "ReplicatorStateMachine::onLeaderVersion "
				"downloading from %s\n", 
				newVersion->getSinfulString( ).Value( ) );
        download( newVersion->getSinfulString( ).Value( ) );
    }
    // replication leader must not send a version which hasn't been updated
    //assert(downloadNeeded);
    //REPLICATION_ASSERT(downloadNeeded);
	delete newVersion;
}
开发者ID:Clusterforge,项目名称:htcondor,代码行数:35,代码来源:ReplicatorStateMachine.cpp

示例2: switch

// =============================================================================
Common::Result Client::handle_command(Protocol::Packet &packet, Common::ByteArray &payload,
                                      uint16_t offset)
{
   Common::Result result = Common::Result::OK;
   CMD cmd               = static_cast<CMD>(packet.message.itf.member);

   switch (cmd)
   {
      case NEW_VERSION_AVAILABLE_CMD /* CHECK_VERSION_CMD */:
      {
         if (packet.message.isCommand())
         {
            Version version;
            uint16_t size = version.unpack(payload, offset);
            /* *INDENT-OFF* */
            HF_ASSERT(size != 0, {result = Common::Result::FAIL_ARG;});
            /* *INDENT-ON* */

            auto code = new_version_available(packet.source, version);

            Protocol::Response response;
            response.code = static_cast<Common::Result>(code);
            Protocol::Message message(packet.message, response.size());
            response.pack(message.payload);

            send(packet.source, message);
         }
开发者ID:j0sete,项目名称:hanfun,代码行数:28,代码来源:suota_client.cpp

示例3: LoadVersionV1

void LoadVersionV1(TiXmlElement *verNode, Package *pkg)
{
  const char *name = verNode->Attribute("name");
  if(!name) name = "";

  Version *ver = new Version(name, pkg);
  unique_ptr<Version> ptr(ver);

  const char *author = verNode->Attribute("author");
  if(author) ver->setAuthor(author);

  const char *time = verNode->Attribute("time");
  if(time) ver->setTime(time);

  TiXmlElement *node = verNode->FirstChildElement("source");

  while(node) {
    LoadSourceV1(node, ver);
    node = node->NextSiblingElement("source");
  }

  node = verNode->FirstChildElement("changelog");

  if(node) {
    if(const char *changelog = node->GetText())
      ver->setChangelog(changelog);
  }

  if(pkg->addVersion(ver))
    ptr.release();
}
开发者ID:tomdkt,项目名称:reapack,代码行数:31,代码来源:index_v1.cpp

示例4: CDialog

UpdateCheckerDlg::UpdateCheckerDlg(Update_Status updateStatus, const Version& latestVersion, CWnd* pParent /*=nullptr*/)
    : CDialog(UpdateCheckerDlg::IDD, pParent)
    , m_updateStatus(updateStatus)
{
    switch (updateStatus) {
    case UPDATER_UPDATE_AVAILABLE:
    case UPDATER_UPDATE_AVAILABLE_IGNORED:
        m_text.Format(IDS_NEW_UPDATE_AVAILABLE,
                      latestVersion.ToString(),
                      UpdateChecker::MPC_HC_VERSION.ToString());
        break;
    case UPDATER_LATEST_STABLE:
        m_text.LoadString(IDS_USING_LATEST_STABLE);
        break;
    case UPDATER_NEWER_VERSION:
        m_text.Format(IDS_USING_NEWER_VERSION,
                      UpdateChecker::MPC_HC_VERSION.ToString(),
                      latestVersion.ToString());
        break;
    case UPDATER_ERROR:
        m_text.LoadString(IDS_UPDATE_ERROR);
        break;
    default:
        ASSERT(0); // should never happen
    }
}
开发者ID:Grimace1975,项目名称:mpc-hc,代码行数:26,代码来源:UpdateCheckerDlg.cpp

示例5:

Version::Version(const Version &other)
{
    m_major = other.getMajor();
    m_minor = other.getMinor();
    m_mini = other.getMini();
    m_build = other.getBuild();
}
开发者ID:Pigaco,项目名称:Console,代码行数:7,代码来源:Version.cpp

示例6: error

void UpdateChecker::finished(QNetworkReply* reply_){
    if(reply_->error() != QNetworkReply::NoError){
		emit error(reply_->errorString());
    }else{
		Version last = RaptorVersion;
        QDomDocument document;
        if(document.setContent(reply_->readAll())){
            const QDomNodeList entries = document.elementsByTagName("entry");
            
            for(int i = 0; i < entries.count(); i++) {
                const QDomElement element = entries.at(i).toElement();
				QDomNodeList nodes = element.elementsByTagName("title");
   
				for (int i = 0; i < nodes.count(); i++) {
					const QDomElement elem = nodes.at(i).toElement();
					QString filename = elem.firstChild().toText().data().trimmed();
					QRegExp rx("raptor-.*([\\d\\.\\d\\.\\d]{1,}).*");
					if(rx.exactMatch(filename)){
						Version found(rx.cap(1));
						if(last < found)
							last = found;
					}
				}
			}
		}
		emit lastVersion(last.getVersion());
	}
}
开发者ID:jzsun,项目名称:raptor,代码行数:28,代码来源:UpdateChecker.cpp

示例7: 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
开发者ID:flair2005,项目名称:inVRs,代码行数:31,代码来源:XmlConfigurationConverter.cpp

示例8:

	Bool Version::operator>(const Version& other) const
	{
		const auto shortes = __min(m_parts.size(), other.GetPartsCount());
		for (SizeT i = 0; i < shortes; i++)
		{
			if (m_parts[i] > other[i])
			{
				return True;
			}
			if (m_parts[i] < other[i])
			{
				return False;
			}
		}

		if (other.GetPartsCount() > m_parts.size())
		{
			return False;
		}

		for (SizeT i = shortes; i < m_parts.size(); i++)
		{
			if (m_parts[i] != 0)
			{
				return True;
			}
		}

		return False;
	}
开发者ID:alexander-borodulya,项目名称:WinToolsLib,代码行数:30,代码来源:Version.cpp

示例9: foreach

QList<Update *> AppcastMinSysUpdateFilter::filter(const QList<Update *> candidates)
{
    QList<Update *> filtered;
    foreach (Update *candidate, candidates) {
        AppcastUpdate *update = qobject_cast<AppcastUpdate *>(candidate);
        if (update) {
            Version systemVersion = d_ptr->sysVersion;
            Version minSystemVersion(update->minSysVersion());
            
            if (!systemVersion.isValid()) {
                // An unknown system is typically a newer version of the OS than
                // what was available at the time the application was built.
                // Assume compatiblity until proven otherwise.
                filtered.append(candidate);
                continue;
            }
            if (!minSystemVersion.isValid()) {
                // The minimum version was not specified, which means any
                // version is acceptable.
                filtered.append(candidate);
                continue;
            }
            
            if (systemVersion >= minSystemVersion) {
                filtered.append(candidate);
                continue;
            }
        } else {
            // This is not a type understood by this filter.  Let it through so
            // other filters in the chain get a chance to handle it.
            filtered.append(candidate);
            continue;
        }
    }
开发者ID:jaredhanson,项目名称:qtxupdate,代码行数:34,代码来源:appcastminsysupdatefilter.cpp

示例10: switch

Version Popt::getVersion(const Package &p, VersionFlag vf, bool versionMustExist) {
	if(_args.empty()) {
		switch(vf) {
			case NO_DEFAULT:
				// No default, skip to the popArg call below which
				// will trigger the appropriate error.
				break;
			case INSTALLED:
				if(p.isInstalled()) {
					return p.getInstalledVersion(); // exists per definition
				}
				break; // Fall through to popArg
			case INSTALLED_OR_CURRENT:
				if(p.isInstalled()) {
					return p.getInstalledVersion(); // exists per definition
				}
				// fall through to next case
			case CURRENT:
				if(p.hasVersions()) {
					return p.getRecentVersion(); // Exists per definition
				}
				break; // Fall through to popArg
			case NONE_NEEDED:
				// Ignores versionMustExist, caller has to handle this,
				// but at least we do not return an invalid version just an empty
				// one, the caller can easily distinct them.
				return Version::EMPTY_VERSION;
		}
	}
	const Version v(popArg("missing version"));
	if(v.isEmptyVersion() || versionMustExist) {
		p.checkVersionExists(v);
	}
	return v;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例11: Version

void VersionManager::addVersion_Click(){

    if (askSaveChangeds()){
        currentVersionChanged_ = false;
    } else {
        return;
    }

    bool ok;
    QString name;
    Version *vers = new Version();

    name = QInputDialog::getText(this, tr("Add version"),
                                 tr("Version name:"), QLineEdit::Normal,
                                 "", &ok);
    if (ok && !name.isEmpty()){
        vers->name_ = name;
        while (vers->load()){
            name = QInputDialog::getText(this, tr("Add version"),
                                         tr("Sorry. It seems that the version name already exists.<br>Please choose another version name."), QLineEdit::Normal,
                                         name, &ok);
            if (!ok || name.isEmpty())
                break;

            vers->clear();
            vers->name_ = name;
        }

        if (vers->save()){
            getVersions();
            setVersionFocus(vers->name_);
            currentVersionChanged_ = true;
        }
    }
}
开发者ID:Danielweber7624,项目名称:q4wine,代码行数:35,代码来源:versions.cpp

示例12: StringRef

bool Version::TryParse(const StringRef& versionString, Version& outVersion)
{
	outVersion = Version::Zero;
	List<HeapString> parts;
	StringParser::Split(versionString, StringRef("."), parts);

	uint length = (uint)parts.Count();
	RETURN_FALSE_IF(length < 2 || length>4);

	long outMajor;
	if (parts[0].TryParseInt(outMajor))
	{
		outVersion.SetMajor((uint)outMajor);
	}
	else
	{
		return false;
	}

	long outMinor;
	if (parts[1].TryParseInt(outMinor))
	{
		outVersion.SetMinor((uint)outMinor);
	}
	else
	{
		return false;
	}

	length -= 2;
	if (length > 0)
	{
		long outBuild;
		if (parts[2].TryParseInt(outBuild))
		{
			outVersion.SetBuild((uint)outBuild);
		}
		else
		{
			return false;
		}

		--length;
		if (length > 0)
		{
			long outRevision;
			if (parts[3].TryParseInt(outRevision))
			{
				outVersion.SetRevision((uint)outRevision);
			}
			else
			{
				return false;
			}
		}
	}

	return true;
}
开发者ID:fjz13,项目名称:Medusa,代码行数:59,代码来源:Version.cpp

示例13: QString

void PrefixSettings::txtRunString_Changed(){
    QString run_string = txtRunString->toPlainText().replace("\"", "\\\"");

    QString console_bin = CoreLib->getSetting("console", "bin").toString();
    QString console_args = CoreLib->getSetting("console", "args", false).toString();

    if (console_bin.split("/").last() == "konsole"){
        console_args.append(" /bin/sh -c ");
    }

    run_string.replace("%CONSOLE_BIN%", console_bin);
    run_string.replace("%CONSOLE_ARGS%", QString("%1 \"").arg(console_args));

    Version ver;
    if (!txtWineBin->text().isEmpty()){
        ver.wine_exec_ = txtWineBin->text();
        ver.wine_loader_ = txtWineLoaderBin->text();
        ver.wine_server_ = txtWineServerBin->text();
        ver.wine_dllpath32_ = txtWineLibs->text();
        ver.wine_dllpath64_ = txtWineLibs->text();
    } else {
        ver.clear();
        ver.name_ = comboVersionList->currentText();
        if (!ver.load()){
            QMessageBox::critical(this, tr("Error"), tr("Unable to load version by name: %1").arg(ver.name_));
            return;
        }
    }

    QString env;
    env.append(QString(" WINE='%1' ").arg(ver.wine_exec_));
    env.append(QString(" WINEPREFIX='%1' ").arg(txtPrefixPath->text()));
    env.append(QString(" WINESERVER='%1' ").arg(ver.wine_server_));
    env.append(QString(" WINELOADER='%1' ").arg(ver.wine_loader_));
    if (comboArchList->currentText()=="win64"){
        env.append(QString(" WINEDLLPATH='%1' ").arg(ver.wine_dllpath64_));
    } else if (comboArchList->currentText()=="win32"){
        env.append(QString(" WINEDLLPATH='%1' ").arg(ver.wine_dllpath32_));
    }
    env.append(QString(" WINEARCH='%1' ").arg(comboArchList->currentText()));
    env.append(QString(" WINEDEBUG='%1' ").arg("-all"));
    env.append(QString(" WINEDLLOVERRIDES='' "));
    env.append(QString(" LANG='' "));

    run_string.replace("%ENV_BIN%", CoreLib->getWhichOut("env"));
    run_string.replace("%ENV_ARGS%", env);

    run_string.replace("%WORK_DIR%", QString("cd \'%1\' &&").arg(QDir::homePath()));
    run_string.replace("%SET_NICE%", QString("%1 -n 10").arg(CoreLib->getSetting("system", "nice", false).toString()));

    run_string.replace("%WINE_BIN%", ver.wine_exec_);

    run_string.replace("%VIRTUAL_DESKTOP%", " explorer.exe /desktop=winecfg,800x600 ");
    run_string.replace("%PROGRAM_BIN%", "\'winecfg\'");
    run_string.replace("%PROGRAM_ARGS%", "-h");
    run_string.append(" \"");

    lblTemalate->setText(run_string);
}
开发者ID:kakurasan,项目名称:q4wine,代码行数:59,代码来源:prefixsettings.cpp

示例14: topLeft

Ref<DetectorResult> Detector::processFinderPatternInfo(Ref<FinderPatternInfo> info){
  Ref<FinderPattern> topLeft(info->getTopLeft());
  Ref<FinderPattern> topRight(info->getTopRight());
  Ref<FinderPattern> bottomLeft(info->getBottomLeft());

  float moduleSize = calculateModuleSize(topLeft, topRight, bottomLeft);
  if (moduleSize < 1.0f) {
    throw zxing::ReaderException("bad module size");
  }
  int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize);
  Version *provisionalVersion = Version::getProvisionalVersionForDimension(dimension);
  int modulesBetweenFPCenters = provisionalVersion->getDimensionForVersion() - 7;

  Ref<AlignmentPattern> alignmentPattern;
  // Anything above version 1 has an alignment pattern
  if (provisionalVersion->getAlignmentPatternCenters().size() > 0) {


    // Guess where a "bottom right" finder pattern would have been
    float bottomRightX = topRight->getX() - topLeft->getX() + bottomLeft->getX();
    float bottomRightY = topRight->getY() - topLeft->getY() + bottomLeft->getY();


    // Estimate that alignment pattern is closer by 3 modules
    // from "bottom right" to known top left location
    float correctionToTopLeft = 1.0f - 3.0f / (float)modulesBetweenFPCenters;
    int estAlignmentX = (int)(topLeft->getX() + correctionToTopLeft * (bottomRightX - topLeft->getX()));
    int estAlignmentY = (int)(topLeft->getY() + correctionToTopLeft * (bottomRightY - topLeft->getY()));


    // Kind of arbitrary -- expand search radius before giving up
    for (int i = 4; i <= 16; i <<= 1) {
      try {
        alignmentPattern = findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, (float)i);
        break;
      } catch (zxing::ReaderException const& re) {
        (void)re;
        // try next round
      }
    }
    if (alignmentPattern == 0) {
      // Try anyway
    }

  }

  Ref<PerspectiveTransform> transform = createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
  Ref<BitMatrix> bits(sampleGrid(image_, dimension, transform));
  ArrayRef< Ref<ResultPoint> > points(new Array< Ref<ResultPoint> >(alignmentPattern == 0 ? 3 : 4));
  points[0].reset(bottomLeft);
  points[1].reset(topLeft);
  points[2].reset(topRight);
  if (alignmentPattern != 0) {
    points[3].reset(alignmentPattern);
  }

  Ref<DetectorResult> result(new DetectorResult(bits, points));
  return result;
}
开发者ID:AkimF,项目名称:MeetupMobileQtQml,代码行数:59,代码来源:QRDetector.cpp

示例15:

Version::Version(const Version& val)
	:mMajor(val.Major()),
	mMinor(val.Minor()),
	mBuild(val.Build()),
	mRevision(val.Revision())
{

}
开发者ID:fjz13,项目名称:Medusa,代码行数:8,代码来源:Version.cpp


注:本文中的Version类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。