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


C++ Identity类代码示例

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


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

示例1: _mkSupernodeMap

static inline std::map< Identity,std::vector<InetAddress> > _mkSupernodeMap()
	throw(std::runtime_error)
{
	std::map< Identity,std::vector<InetAddress> > sn;
	Identity id;
	std::vector<InetAddress> addrs;

	// Nothing special about a supernode... except that they are
	// designated as such.

	// cthulhu.zerotier.com - New York, New York, USA
	addrs.clear();
	if (!id.fromString("271ee006a0:1:AgGXs3I+9CWrEmGMxc50x3E+trwtaa2ZMXDU6ezz92fFJXzlhRKGUY/uAToHDdH9XiLxtcA+kUQAZdC4Dy2xtqXxjw==:QgH5Nlx4oWEGVrwhNocqem+3VNd4qzt7RLrmuvqZvKPRS9R70LJYJQLlKZj0ri55Pzg+Mlwy4a4nAgfnRAWA+TW6R0EjSmq72MG585XGNfWBVk3LxMvxlNWErnVNFr2BQS9yzVp4pRjPLdCW4RB3dwEHBUgJ78rwMxQ6IghVCl8CjkDapg=="))
		throw std::runtime_error("invalid identity in Defaults");
	addrs.push_back(InetAddress("198.199.73.93",ZT_DEFAULT_UDP_PORT));
	sn[id] = addrs;

	// nyarlathotep.zerotier.com - San Francisco, California, USA
	addrs.clear();
	if (!id.fromString("fa9be4008b:1:AwCHXEi/PJuhtOPUZxnBSMiuGvj6XeRMWu9R9aLR3JD1qluADLQzUPSP2+81Dqvgi2wkQ2cqEpOlDPeUCvtlZwdXEA==:QgH4usG/wzsoUCtO2LL3qkwugtoXEz1PUJbmUzY8vbwzc5bckmVPjMqb4q2CF71+QVPV1K6shIV2EKkBMRSS/D/44EGEwC6tjFGZqmmogaC0P1uQeukTAF4qta46YgC4YQx54/Vd/Yfl8n1Bwmgm0gBB4W1ZQir3p+wp37MGlEN0rlXxqA=="))
		throw std::runtime_error("invalid identity in Defaults");
	addrs.push_back(InetAddress("198.199.97.220",ZT_DEFAULT_UDP_PORT));
	sn[id] = addrs;

	// shub-niggurath.zerotier.com - Amsterdam, Netherlands
	addrs.clear();
	if (!id.fromString("48099ecd05:1:AwHO7o1FdDj1nEArfchTDa6EG7Eh2GLdiH86BhcoNv0BHJN4tmrf0Y7/2SZiQFpTTwJf93iph84Dci5+k52u/qkHTQ==:QgGbir8CNxBFFPPj8Eo3Bnp2UmbnZxu/pOq3Ke0WaLBBhHzVuwM+88g7CaDxbZ0AY2VkFc9hmE3VG+xi7g0H86yfVUIBHZnb7N+DCtf8/mphZIHNgmasakRi4hU11kGyLi1nTVTnrmCfAb7w+8SCp64Q5RNvBC/Pvz7pxSwSdjIHkVqRaeo="))
		throw std::runtime_error("invalid identity in Defaults");
	addrs.push_back(InetAddress("198.211.127.172",ZT_DEFAULT_UDP_PORT));
	sn[id] = addrs;

	return sn;
}
开发者ID:Audiarto,项目名称:ZeroTierOne,代码行数:33,代码来源:Defaults.cpp

示例2: identityString

void FaceManagement::Recognizer::trainRecognitionDatabase(QPair<QString, QString> &tagData,
                                                          const QImage &image)
{
#ifdef HAVE_KFACE
    // Assemble an ID string for this tag
    QString fullNameString = identityString(tagData);

    // Check if we have an identity for this tag
    Identity identity = m_recognitionDatabase.findIdentity(
        QString::fromLatin1("fullName"), fullNameString
    );
    if (identity.isNull()) {
        // Add a new identity for this tag
        QMap<QString, QString> attributes;
        attributes[QString::fromLatin1("fullName")] = fullNameString;
        identity = m_recognitionDatabase.addIdentity(attributes);
    }

    // Train the database
    m_recognitionDatabase.train(identity, image, QString::fromLatin1("KPhotoAlbum"));
#else
    Q_UNUSED(tagData);
    Q_UNUSED(image);
#endif
}
开发者ID:Df458,项目名称:kphotoalbum-multitags-branch,代码行数:25,代码来源:Recognizer.cpp

示例3: _mkSupernodeMap

static inline std::map< Identity,std::vector<InetAddress> > _mkSupernodeMap()
{
	std::map< Identity,std::vector<InetAddress> > sn;
	Identity id;
	std::vector<InetAddress> addrs;

	// Nothing special about a supernode... except that they are
	// designated as such and trusted to provide WHOIS lookup.

	// cthulhu.zerotier.com - New York, New York, USA
	addrs.clear();
	if (!id.fromString("8acf059fe3:0:482f6ee5dfe902319b419de5bdc765209c0ecda38c4d6e4fcf0d33658398b4527dcd22f93112fb9befd02fd78bf7261b333fc105d192a623ca9e50fc60b374a5"))
		throw std::runtime_error("invalid identity in Defaults");
	addrs.push_back(InetAddress("162.243.77.111",ZT_DEFAULT_UDP_PORT));
	sn[id] = addrs;

	// nyarlathotep.zerotier.com - San Francisco, California, USA
	addrs.clear();
	if (!id.fromString("7e19876aba:0:2a6e2b2318930f60eb097f70d0f4b028b2cd6d3d0c63c014b9039ff35390e41181f216fb2e6fa8d95c1ee9667156411905c3dccfea78d8c6dfafba688170b3fa"))
		throw std::runtime_error("invalid identity in Defaults");
	addrs.push_back(InetAddress("198.199.97.220",ZT_DEFAULT_UDP_PORT));
	sn[id] = addrs;

	// shub-niggurath.zerotier.com - Amsterdam, Netherlands
	addrs.clear();
	if (!id.fromString("36f63d6574:0:67a776487a1a99b32f413329f2b67c43fbf6152e42c6b66e89043e69d93e48314c7d709b58a83016bd2612dd89400b856e18c553da94892f7d3ca16bf2c92c24"))
		throw std::runtime_error("invalid identity in Defaults");
	addrs.push_back(InetAddress("198.211.127.172",ZT_DEFAULT_UDP_PORT));
	sn[id] = addrs;

	return sn;
}
开发者ID:Tania188,项目名称:ZeroTierOne,代码行数:32,代码来源:Defaults.cpp

示例4: userKey

//
// Find and store database objects (primitive layer)
//
bool CodeSignatures::find(Identity &id, uid_t user)
{
	if (id.mState != Identity::untried)
		return id.mState == Identity::valid;
	try {
		DbKey userKey('H', id.getHash(), true, user);
		CssmData linkValue;
		if (mDb.get(userKey, linkValue)) {
			id.mName = string(linkValue.interpretedAs<const char>(), linkValue.length());
			IFDUMPING("equiv", id.debugDump("found/user"));
			id.mState = Identity::valid;
			return true;
		}
		DbKey sysKey('H', id.getHash());
		if (mDb.get(sysKey, linkValue)) {
			id.mName = string(linkValue.interpretedAs<const char>(), linkValue.length());
			IFDUMPING("equiv", id.debugDump("found/system"));
			id.mState = Identity::valid;
			return true;
		}
	} catch (...) {
		secdebug("codesign", "exception validating identity for %s - marking failed", id.path().c_str());
		id.mState = Identity::invalid;
	}
	return id.mState == Identity::valid;
}
开发者ID:Apple-FOSS-Mirror,项目名称:securityd,代码行数:29,代码来源:codesigdb.cpp

示例5: processSubscriptionDataEvent

    void processSubscriptionDataEvent(const Event &event)
    {
        MessageIterator msgIter(event);
        while (msgIter.next()) {
            Message msg = msgIter.message();
            Service service = msg.service();

            int index = (int)msg.correlationId().asInteger();
            std::string &topic = d_securities[index];
            if (!msg.hasElement(d_fieldName)) {
                continue;
            }
            std::cout << "\t" << topic << std::endl;
            Element field = msg.getElement(d_fieldName);
            if (!field.isValid()) {
                continue;
            }
            bool needsEntitlement = msg.hasElement(EID);
            for (size_t i = 0; i < d_identities.size(); ++i) {
                Identity *handle = &d_identities[i];
                if (!needsEntitlement ||
                        handle->hasEntitlements(service,
                                                msg.getElement(EID), 0, 0))
                {
                    std::cout << "User #" << (i+1) << " is entitled"
                              << " for " << field << std::endl;
                }
                else {
                    std::cout << "User #" << (i+1) << " is NOT entitled"
                              << " for " << d_fieldName << std::endl;
                }
            }
        }
    }
开发者ID:RTRindex,项目名称:bloombergscrape,代码行数:34,代码来源:EntitlementsVerificationSubscriptionTokenExample.cpp

示例6: oAuthDone

void AuthWidget::oAuthDone(OAuthProcess *oauth, const Identity& identity)
{
  /*
   * FIXME: perhaps consider moving this to the model with signals or
   * by passing the Login object ?
   */
  if (identity.isValid()) {
    LOG_SECURE(oauth->service().name() << ": identified: as "
	       << identity.id() << ", "
	       << identity.name() << ", " << identity.email());

    std::auto_ptr<AbstractUserDatabase::Transaction>
      t(model_->users().startTransaction());

    User user = model_->baseAuth()->identifyUser(identity, model_->users());
    if (user.isValid())
      login_.login(user);
    else
      registerNewUser(identity);

    if (t.get())
      t->commit();
  } else {
    LOG_SECURE(oauth->service().name() << ": error: " << oauth->error());
    displayError(oauth->error());
  }
}
开发者ID:913862627,项目名称:wt,代码行数:27,代码来源:AuthWidget.C

示例7: TEST_F

TEST_F(RotationDeathTest, SerializationError) {
  Identity<World, World> id;
  EXPECT_DEATH({
    serialization::LinearMap message;
    id.WriteToMessage(&message);
    Rot const r = Rot::ReadFromMessage(message);
  }, "HasExtension.*Rotation");
开发者ID:mkalte666,项目名称:Principia,代码行数:7,代码来源:rotation_test.cpp

示例8: setAccountIdentity

void AccountShared::load()
{
	if (!isValidStorage())
		return;

	Shared::load();

	Identity identity = IdentityManager::instance()->byUuid(loadValue<QString>("Identity"));
	if (identity.isNull() && !IdentityManager::instance()->items().isEmpty())
		identity = IdentityManager::instance()->items().at(0);

	setAccountIdentity(identity);

	ProtocolName = loadValue<QString>("Protocol");
	setId(loadValue<QString>("Id"));

	RememberPassword = loadValue<bool>("RememberPassword", true);
	HasPassword = RememberPassword;
	if (RememberPassword)
		Password = pwHash(loadValue<QString>("Password"));

	ProxySettings.setEnabled(loadValue<bool>("UseProxy"));
	ProxySettings.setAddress(loadValue<QString>("ProxyHost"));
	ProxySettings.setPort(loadValue<int>("ProxyPort"));
	ProxySettings.setRequiresAuthentication(loadValue<bool>("ProxyRequiresAuthentication"));
	ProxySettings.setUser(loadValue<QString>("ProxyUser"));
	ProxySettings.setPassword(loadValue<QString>("ProxyPassword"));

	PrivateStatus = loadValue<bool>("PrivateStatus", true);

	triggerAllProtocolsRegistered();
}
开发者ID:partition,项目名称:kadu,代码行数:32,代码来源:account-shared.cpp

示例9: foreach

QList<Identity> TrainingDB::identities() const
{
    QList<QVariant> ids;
    QList<Identity> results;
    d->db->execSql("SELECT id FROM Identities", &ids);

    foreach (const QVariant& v, ids)
    {
        QList<QVariant> values;
        Identity p;
        p.setId(v.toInt());
        d->db->execSql("SELECT attribute, value FROM IdentityAttributes WHERE id=?", p.id(), &values);

        for (QList<QVariant>::const_iterator it = values.constBegin(); it != values.constEnd();)
        {
            QString attribute = it->toString();
            ++it;
            QString value     = it->toString();
            ++it;

            p.setAttribute(attribute, value);
        }

        results << p;
    }
开发者ID:rickysarraf,项目名称:digikam,代码行数:25,代码来源:trainingdb.cpp

示例10: _type

Packet::Packet(Identity& id) : _type(Packet::Id)
{
    unsigned char *instr;
    unsigned char *port;
    char* _username;
    char* _ip;
    unsigned int _instruction;
    unsigned int _port;

    _instruction = id.getInstruct();
    _port = id.getPort();
    _username = id.getUsername();
    _ip = id.getIp();
    instr = reinterpret_cast<unsigned char *>(&_instruction);
    port = reinterpret_cast<unsigned char *>(&_port);

    for (unsigned int i = 0; i < 8; ++i)
        if (i < 4)
            _data.push_back(instr[i]);
        else
            _data.push_back(port[i - sizeof(int)]);

    for (unsigned int i = 0; i < 64; ++i)
        _data.push_back(_username[i]);

    for (unsigned int i = 0; i < 32; ++i)
        _data.push_back(_ip[i]);

    this->_encrypted = false;
}
开发者ID:Zaboon,项目名称:cpp_babel,代码行数:30,代码来源:Packet.cpp

示例11: TEST_F

TEST_F(PermutationDeathTest, SerializationError) {
  Identity<World1, World2> id;
  EXPECT_DEATH({
    serialization::LinearMap message;
    id.WriteToMessage(&message);
    Perm const p = Perm::ReadFromMessage(message);
  }, "HasExtension.*Permutation");
开发者ID:Wavechaser,项目名称:Principia,代码行数:7,代码来源:permutation_test.cpp

示例12: loadFromIdentity

void IdentityWidget::loadFromIdentity( const Identity &identity )
{
  mName->setText( identity.fullName() );
  mOrganisation->setText( identity.organization() );
  mEmail->setText( identity.primaryEmailAddress() );
  mReplyto->setText( identity.replyToAddr() );
  mMailcopiesto->setText( identity.property( "Mail-Copies-To" ).toString() );
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:8,代码来源:identity_widget.cpp

示例13: _saveIdentity

void Topology::_saveIdentity(const Identity &id)
{
	if (id) {
		char p[128];
		Utils::snprintf(p,sizeof(p),"iddb.d/%.10llx",(unsigned long long)id.address().toInt());
		RR->node->dataStorePut(p,id.toString(false),false);
	}
}
开发者ID:mwarning,项目名称:ZeroTierOne,代码行数:8,代码来源:Topology.cpp

示例14: referenceToProxy

IcmProxy::Object*
ProxyFactory::streamToProxy(InputStream* s) const
{
	Identity ident;
	ident.read(s);

	Reference* ref = mCommunicator->referenceFactory()->create(ident, s);
	return referenceToProxy(ref);
}
开发者ID:wuhua988,项目名称:icm,代码行数:9,代码来源:Proxy.cpp

示例15: parseIdentity

QPair<QString, QString> FaceManagement::Recognizer::recognizeFace(const QImage& image)
{
    if (! m_recognitionDatabase.isNull() && ! m_recognitionDatabase.allIdentities().isEmpty()) {
        Identity identity = m_recognitionDatabase.recognizeFace(image);
        if (! identity.isNull()) {
            return parseIdentity(identity);
        }
    }
    return QPair<QString, QString>();
}
开发者ID:KDE,项目名称:kphotoalbum,代码行数:10,代码来源:Recognizer.cpp


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