void TrafficMap::populateMap(){
	int range = 0;
	default_random_engine dre;
	uniform_int_distribution<int> uid(range,2*range);
	for(int i = 0; i < weight_map_.size(); i++)
		weight_map_[i] = uid(dre);
}
Ejemplo n.º 2
0
void Style::setParentStyle(const Uid & parentUid)
{
    if (!uid().isValid()) {
        return;
    }

    if (d->parentStyle != parentUid) {
        ConfigTransaction transaction(this);
        if (d->parentStyle.isValid()) {
            // disconnect all signals (e.g. changed())
            disconnect(d->parentStyle.entity(), nullptr, this, nullptr);

            // remove this in old parent's children list
            Q_ASSERT(d->parentStyle.entity<Style>()->d->children.contains(uid()));
            d->parentStyle.entity<Style>()->d->children.remove(d->parentStyle.entity<Style>()->d->children.indexOf(uid()));
        }
        d->parentStyle = parentUid;
        if (d->parentStyle.isValid()) {
            // forward changed() signal
            connect(d->parentStyle.entity(), SIGNAL(changed()), this, SIGNAL(changed()));

            // insert us into the new parent's children list
            Q_ASSERT(! d->parentStyle.entity<Style>()->d->children.contains(uid()));
            d->parentStyle.entity<Style>()->d->children.append(uid());
        }
    }
}
Ejemplo n.º 3
0
	template <class T> T generateNumber( T min, T max )
	{//Generate and returns a single random unsigned long between min and max. Assumes T is an interger-like variable, other object types will produce undefined behavior.
		std::uniform_int_distribution<T> uid(min, max);
		std::random_device rd;
		std::mt19937 generator(rd());
		
		return uid(generator);
	}
//* For RTConnHttp
void CRTConnection::OnLogin(const char* pUserid, const char* pPass, const char* pNname)
{
    bool ok = false;
    {
        //check & auth
#if 0
        std::string pass;
        RTHiredisRemote::Instance().CmdGet(pUserid, pass);
        if (pass.compare(pPass)!=0) {
            LE("OnLogin pass not same redis error\n");
            return;
        }
#endif
        m_userId = pUserid;
        m_token = pPass;
        m_nname = pNname;
    }
    //if (ok) {
    if (false) {
        std::string sid;
        //store userid & pass
        CRTConnManager::ConnectionInfo* pci = new CRTConnManager::ConnectionInfo();
        if (pci) {
            GenericSessionId(sid);
            m_connectorId = CRTConnManager::Instance().ConnectorId();
            pci->_connId = sid;
            pci->_connAddr = CRTConnManager::Instance().ConnectorIp();
            pci->_connPort = CRTConnManager::Instance().ConnectorPort();
            pci->_userId = pUserid;
            pci->_token = pPass;
            pci->_pConn = NULL;
            pci->_connType = CONNECTIONTYPE::_chttp;
            pci->_flag = 1;
            std::string uid(pUserid);
            CRTConnManager::Instance().AddUser(CONNECTIONTYPE::_chttp, uid, pci);
        } else {
            LE("new ConnectionInfo error!!!\n");
        }
    } else {
        std::string uid(pUserid);
        CRTConnManager::ConnectionInfo* pci = NULL;
        CRTConnManager::Instance().AddUser(CONNECTIONTYPE::_chttp, uid, pci);
    }
    {
        // send response
        rapidjson::Document     jsonDoc;
        rapidjson::StringBuffer jsonStr;
        rapidjson::Writer<rapidjson::StringBuffer>   jsonWriter(jsonStr);
        jsonDoc.SetObject();
        if (ok) {
            jsonDoc.AddMember("login", "success", jsonDoc.GetAllocator());
        } else {
            jsonDoc.AddMember("login", "failed", jsonDoc.GetAllocator());
        }
        jsonDoc.Accept(jsonWriter);
        SendResponse(HPS_OK, jsonStr.GetString());
    }
}
Ejemplo n.º 5
0
KUser::KUser(UIDMode mode) {
	long _uid = ::getuid(), _euid;
	if (mode == UseEffectiveUID && (_euid = ::geteuid()) != _uid )
		fillPasswd( ::getpwuid( _euid ) );
	else {
		fillName( ::getenv( "LOGNAME" ) );
		if (uid() != _uid) {
			fillName( ::getenv( "USER" ) );
			if (uid() != _uid)
				fillPasswd( ::getpwuid( _uid ) );
		}
	}
}
Ejemplo n.º 6
0
void LoginManager::processExistingAccountLogin(const QString& aLine, Client &aClient)
{
	auto account = Account::getAccountByName(aLine);
    if(!account)
    {
        aClient.printRawLine("Unknown account. Disconnecting...");
        aClient.setState(EClientStateQuit);
        return;
    }
    aClient.printRawLine("Password:");
    state_ = ELoginStatePassword;
    aClient.linkToAccount(world::World::instance()->objectFactory()->getPtr<Account>(account->uid()));
    account_ = account->uid();
}
Ejemplo n.º 7
0
KUser::KUser(UIDMode mode)
{
	uid_t _uid = ::getuid(), _euid;
	if (mode == UseEffectiveUID && (_euid = ::geteuid()) != _uid )
		d = new Private( ::getpwuid( _euid ) );
	else {
		d = new Private( qgetenv( "LOGNAME" ).constData() );
		if (uid() != _uid) {
			d = new Private( qgetenv( "USER" ).constData() );
			if (uid() != _uid)
				d = new Private( ::getpwuid( _uid ) );
		}
	}
}
Ejemplo n.º 8
0
QUrl QgsVirtualLayerDefinition::toUrl() const
{
  QUrl url;
  url.setPath( filePath() );

  foreach ( const QgsVirtualLayerDefinition::SourceLayer& l, sourceLayers() )
  {
    if ( l.isReferenced() )
      url.addQueryItem( "layer_ref", QString( "%1:%2" ).arg( l.reference(), l.name() ) );
    else
      url.addQueryItem( "layer", QString( "%1:%4:%2:%3" ) // the order is important, since the 4th argument may contain '%2' as well
                        .arg( l.provider(),
                              QString( QUrl::toPercentEncoding( l.name() ) ),
                              l.encoding(),
                              QString( QUrl::toPercentEncoding( l.source() ) ) ) );
  }

  if ( !query().isEmpty() )
  {
    url.addQueryItem( "query", query() );
  }

  if ( !uid().isEmpty() )
    url.addQueryItem( "uid", uid() );

  if ( geometryWkbType() == QgsWKBTypes::NoGeometry )
    url.addQueryItem( "nogeometry", "" );
  else if ( !geometryField().isEmpty() )
  {
    if ( hasDefinedGeometry() )
      url.addQueryItem( "geometry", QString( "%1:%2:%3" ).arg( geometryField() ). arg( geometryWkbType() ).arg( geometrySrid() ).toUtf8() );
    else
      url.addQueryItem( "geometry", geometryField() );
  }

  for ( int i = 0; i < fields().count(); i++ )
  {
    const QgsField& f = fields()[i];
    if ( f.type() == QVariant::Int )
      url.addQueryItem( "field", f.name() + ":int" );
    else if ( f.type() == QVariant::Double )
      url.addQueryItem( "field", f.name() + ":real" );
    else if ( f.type() == QVariant::String )
      url.addQueryItem( "field", f.name() + ":text" );
  }

  return url;
}
Ejemplo n.º 9
0
QUrl QgsVirtualLayerDefinition::toUrl() const
{
  QUrl url;
  if ( !filePath().isEmpty() )
    url = QUrl::fromLocalFile( filePath() );

  Q_FOREACH ( const QgsVirtualLayerDefinition::SourceLayer& l, sourceLayers() )
  {
    if ( l.isReferenced() )
      url.addQueryItem( QStringLiteral( "layer_ref" ), QStringLiteral( "%1:%2" ).arg( l.reference(), l.name() ) );
    else
      url.addEncodedQueryItem( "layer", QStringLiteral( "%1:%4:%2:%3" ) // the order is important, since the 4th argument may contain '%2' as well
                               .arg( l.provider(),
                                     QString( QUrl::toPercentEncoding( l.name() ) ),
                                     l.encoding(),
                                     QString( QUrl::toPercentEncoding( l.source() ) ) ).toUtf8() );
  }

  if ( !query().isEmpty() )
  {
    url.addQueryItem( QStringLiteral( "query" ), query() );
  }

  if ( !uid().isEmpty() )
    url.addQueryItem( QStringLiteral( "uid" ), uid() );

  if ( geometryWkbType() == QgsWkbTypes::NoGeometry )
    url.addQueryItem( QStringLiteral( "nogeometry" ), QLatin1String( "" ) );
  else if ( !geometryField().isEmpty() )
  {
    if ( hasDefinedGeometry() )
      url.addQueryItem( QStringLiteral( "geometry" ), QStringLiteral( "%1:%2:%3" ).arg( geometryField() ). arg( geometryWkbType() ).arg( geometrySrid() ).toUtf8() );
    else
      url.addQueryItem( QStringLiteral( "geometry" ), geometryField() );
  }

  Q_FOREACH ( const QgsField& f, fields() )
  {
    if ( f.type() == QVariant::Int )
      url.addQueryItem( QStringLiteral( "field" ), f.name() + ":int" );
    else if ( f.type() == QVariant::Double )
      url.addQueryItem( QStringLiteral( "field" ), f.name() + ":real" );
    else if ( f.type() == QVariant::String )
      url.addQueryItem( QStringLiteral( "field" ), f.name() + ":text" );
  }

  return url;
}
Ejemplo n.º 10
0
int SocketInfo::Create(const std::string& context) const {
    auto types = android::base::Split(type(), "+");
    int flags =
        ((types[0] == "stream" ? SOCK_STREAM : (types[0] == "dgram" ? SOCK_DGRAM : SOCK_SEQPACKET)));
    bool passcred = types.size() > 1 && types[1] == "passcred";
    return CreateSocket(name().c_str(), flags, passcred, perm(), uid(), gid(), context.c_str());
}
Ejemplo n.º 11
0
void LoginManager::processPasswordConfirmation(const QString& aLine, Client &aClient)
{
    auto account = getAccountOrDie(aClient);
    if(!account)
        return;
    QByteArray passwordBytes;
    passwordBytes.append(aLine);
    QString hash = QString(QCryptographicHash::hash(passwordBytes, QCryptographicHash::Md5).toHex());
    if(account->getPasswordHash() != hash)
    {
        aClient.printRawLine("Passwords do not match. Try again.");
        aClient.printRawLine("Enter a password for this account: ");
        state_ = ELoginStateNewPassword;
        return;
    }
    //passwords match, ok
    //creating a new character now
    account->confirmCreation();
    auto newCharacter = world::World::instance()->objectFactory()->createPtr<Person>(Person::TYPE);
	newCharacter->putInDefaultRoom();
	account->addCharacter(newCharacter->uid());	
    aClient.setState(EClientStateNormal);
    aClient.linkToPerson(newCharacter);
    auto room = newCharacter->getRoom();
    if(room)//first look around
        room->printDescription(*(newCharacter.get()), aClient);
}
Ejemplo n.º 12
0
  void testChown ()
  {
#ifndef WIN32
    list<string> filters;

    try
      {
        FilesUtility::deleteFile ("foo");
      }
    catch (...)
      {
      }


    lm->add (this, "test", "file://foo", filters, 0);
    ostringstream uidOss;
    uidOss << ::getuid ();
    string uid (uidOss.str ());

    ostringstream gidOss;
    gidOss << ::getuid ();
    string gid (gidOss.str ());

    CPPUNIT_ASSERT (!lm->chown (this, "test", "file://foo", uid, gid));
#endif
  }
Ejemplo n.º 13
0
// -----------------------------------------------------------------------------
// RDRMRightsClient::GetDbEntryL
// Get a single RO from the server.
// -----------------------------------------------------------------------------
//
EXPORT_C CDRMPermission* RDRMRightsClient::GetDbEntryL( const TDesC8& aContentID,
                                                 const TDRMUniqueID& aUniqueID )
    {
    DRMLOG( _L( "RDRMRightsClient::GetDbEntryL" ) );

    CDRMPermission* permission = NULL;
    TInt size = 0;
    TPckg<TInt> package( size );
    TPtrC8 uid( reinterpret_cast< TUint8* >( const_cast< TDRMUniqueID* >(
        &aUniqueID ) ), sizeof( TDRMUniqueID ) );

    User::LeaveIfError( SendReceive( DRMEngine::EGetDbEntry,
        TIpcArgs( &package, NULL, &uid, &aContentID ) ) );
    HBufC8* rightsData = HBufC8::NewMaxLC( size );
    TPtr8 objectPkg( const_cast< TUint8* >( rightsData->Ptr() ), size,
        size );
    User::LeaveIfError( SendReceive( DRMEngine::EGetPreparedData,
        TIpcArgs( &objectPkg) ) );

    permission = CDRMPermission::NewLC();
    permission->ImportL( rightsData->Des() );
    CleanupStack::Pop(); // permission
    CleanupStack::PopAndDestroy(); // Rights data

    DRMLOG( _L( "RDRMRightsClient::GetDbEntryL ok" ) );
    return permission;
    }
Ejemplo n.º 14
0
/*!
  Change the file owner for the log locations.
 */
void XmlVhostHandler::changeLocationsOwner ()
{
  if (Server::getInstance ()->getUid ()
      || Server::getInstance ()->getGid ())
    {
      string uid (Server::getInstance ()->getUid ());
      string gid (Server::getInstance ()->getGid ());

      /*
       *Change the log files owner if a different user or group
       *identifier is specified.
       */
      for (vector<Vhost*>::iterator it = hosts.begin (); it != hosts.end (); it++)
        {
          int err;
          Vhost* vh = *it;

          /* Chown the log files.  */
          err = logManager->chown (vh, "ACCESSLOG", uid, gid);
          if (err)
            Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
                    _("Error while changing accesses log owner"));

          err = logManager->chown (vh, "WARNINGLOG", uid, gid);
          if (err)
            Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
                    _("Error while changing warnings log owner"));
        }
    }
}
Ejemplo n.º 15
0
static VertexLoader* RefreshLoader(int vtx_attr_group, CPState* state)
{
	VertexLoader* loader;
	if (state->attr_dirty[vtx_attr_group])
	{
		VertexLoaderUID uid(state->vtx_desc, state->vtx_attr[vtx_attr_group]);
		std::lock_guard<std::mutex> lk(s_vertex_loader_map_lock);
		VertexLoaderMap::iterator iter = s_vertex_loader_map.find(uid);
		if (iter != s_vertex_loader_map.end())
		{
			loader = iter->second.get();
		}
		else
		{
			loader = new VertexLoader(state->vtx_desc, state->vtx_attr[vtx_attr_group]);
			s_vertex_loader_map[uid] = std::unique_ptr<VertexLoader>(loader);
			INCSTAT(stats.numVertexLoaders);
		}
		state->vertex_loaders[vtx_attr_group] = loader;
		state->attr_dirty[vtx_attr_group] = false;
	} else {
		loader = state->vertex_loaders[vtx_attr_group];
	}
	return loader;
}
Ejemplo n.º 16
0
AccessControlDataBackendManager::AccessControlDataBackendManager( PluginManager& pluginManager ) :
	m_backends(),
	m_defaultBackend( nullptr ),
	m_configuredBackend( nullptr )
{
	for( auto pluginObject : pluginManager.pluginObjects() )
	{
		auto pluginInterface = qobject_cast<PluginInterface *>( pluginObject );
		auto accessControlDataBackendInterface = qobject_cast<AccessControlDataBackendInterface *>( pluginObject );

		if( pluginInterface && accessControlDataBackendInterface )
		{
			m_backends[pluginInterface->uid()] = accessControlDataBackendInterface;

			if( pluginInterface->flags().testFlag( Plugin::ProvidesDefaultImplementation ) )
			{
				m_defaultBackend = accessControlDataBackendInterface;
			}
		}
	}

	if( m_defaultBackend == nullptr )
	{
		qCritical( "AccessControlDataBackendManager: no default plugin available!" );
	}

	reloadConfiguration();
}
void CSVPHostMountCB::ReadUidL(const TDesC& aName,TEntry& anEntry) const
	{
        DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::ReadUidL()"));
	TBuf<KMaxPath> name;
	TUint driveNumber = Drive().DriveNumber();
	CanonicalizePathname(aName, driveNumber, name);
	TSVPHostFsFileOpenInfo fileOpenInfo(driveNumber, name,EFileRead,EFileOpen);
	TInt err = SVP_HOST_FS_DEVICE().FileOpen(fileOpenInfo);

	User::LeaveIfError(err);

	TBuf8<sizeof(TCheckedUid)> uidBuf;
	uidBuf.SetLength(sizeof(TCheckedUid));

	TSVPHostFsFileReadInfo fileReadInfo(driveNumber, fileOpenInfo.iHandle,sizeof(TCheckedUid),0,(char*)uidBuf.Ptr());

	if (KErrNone != SVP_HOST_FS_DEVICE().FileRead(fileReadInfo))
		User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle));

	DP(_L("** (SVPHOSTMNT) CSVPHostFileCB::ReadUidL sizeof(TCheckedUid) %d fileOpenInfo.iLength %d "), sizeof(TCheckedUid), fileReadInfo.iLength);

	if (fileReadInfo.iLength!=sizeof(TCheckedUid))
	        User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle));

	TCheckedUid uid(uidBuf);
	anEntry.iType=uid.UidType();

	User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle));
	}
Ejemplo n.º 18
0
unit_ptr unit_map::extract(const map_location &loc) {
	self_check();
	t_lmap::iterator i = lmap_.find(loc);
	if (i == lmap_.end()) { return unit_ptr(); }

	t_umap::iterator uit(i->second);

	unit_ptr u = uit->second.unit;
	size_t uid( u->underlying_id() );

	DBG_NG << "Extract unit " << uid << " - " << u->id()
			<< " from location: (" << loc << ")\n";

	assert(uit->first == uit->second.unit->underlying_id());
	if(uit->second.ref_count == 0){
		umap_.erase(uit);
	} else {
		//Soft extraction keeps the old lit item if any iterators reference it
		uit->second.unit.reset();
	}

	lmap_.erase(i);
	self_check();

	return u;
}
Ejemplo n.º 19
0
unit *unit_map::extract(const map_location &loc) {
	self_check();
	t_lmap::iterator i = lmap_.find(loc);
	if (i == lmap_.end()) { return NULL; }

	t_ilist::iterator lit(i->second);

	unit *u = lit->unit;
	size_t uid( u->underlying_id() );

	DBG_NG << "Extract unit " << uid << " - " << u->id()
			<< " from location: (" << loc << ")\n";

	if(lit->ref_count == 0){
		assert(lit != the_end_);
		if(umap_.erase(uid) != 1){
			error_recovery_externally_changed_uid(lit); }
		ilist_.erase( lit );
	} else {
		//Soft extraction keeps the old lit item if any iterators reference it
		lit->unit = NULL;
		lit->deleted_uid = uid;
		assert( uid != 0);
	}

	lmap_.erase(i);
	self_check();

	return u;
}
Ejemplo n.º 20
0
void tst_storage::tst_alldayUtc()
{
  // test event saved with UTC time
  auto event = KCalCore::Event::Ptr(new KCalCore::Event);
  QDate startDate(2013, 12, 1);
  event->setDtStart(KDateTime(startDate, QTime(), KDateTime::UTC));
  event->setAllDay(true);
  event->setSummary("test event utc");

  QCOMPARE(event->allDay(), true);

  m_calendar->addEvent(event, NotebookId);
  m_storage->save();
  QString uid = event->uid();
  reloadDb();

  auto fetchedEvent = m_calendar->event(uid);
  QVERIFY(fetchedEvent.data());
  QVERIFY(fetchedEvent->dtStart().isUtc());

  KDateTime localStart = fetchedEvent->dtStart().toLocalZone();
  QVERIFY(localStart.time() == QTime(2, 0));

  KDateTime localEnd = fetchedEvent->dtEnd().toLocalZone();
  QVERIFY(localEnd.time() == QTime(2, 0));

  QCOMPARE(localEnd.date(), localStart.date().addDays(1));
}
Ejemplo n.º 21
0
void tst_storage::tst_rawEvents()
{
  // TODO: Should split tests if making more cases outside storage
  auto event = KCalCore::Event::Ptr(new KCalCore::Event);
  // NOTE: no other events should be made happening this day
  QDate startDate(2010, 12, 1);
  event->setDtStart(KDateTime(startDate, QTime(12, 0), KDateTime::ClockTime));
  event->setDtEnd(KDateTime(startDate, QTime(13, 0), KDateTime::ClockTime));

  KCalCore::Recurrence *recurrence = event->recurrence();
  recurrence->setDaily(1);
  recurrence->setStartDateTime(event->dtStart());

  m_calendar->addEvent(event, NotebookId);
  m_storage->save();
  QString uid = event->uid();
  reloadDb();

  auto fetchEvent = m_calendar->event(uid);
  QVERIFY(fetchEvent);
  KCalCore::Recurrence *fetchRecurrence = fetchEvent->recurrence();
  QVERIFY(fetchRecurrence);

  // should return occurrence for both days
  mKCal::ExtendedCalendar::ExpandedIncidenceList events
      = m_calendar->rawExpandedEvents(startDate, startDate.addDays(1), false, false, KDateTime::Spec(KDateTime::LocalZone));

  QCOMPARE(events.size(), 2);
}
Ejemplo n.º 22
0
QVariant FeedItem::data(int role) const
{
    switch(role) {
    case UidRole:
        return uid();
    case TitleRole:
        return title();
    case ContentRole:
        return content();
    case LinkRole:
        return link();
    case UrlRole:
        return url();
    case IconRole:
        return icon();
    case StreamIdRole:
        return streamId();
    case UnreadRole:
        return unread();
    case ReadRole:
        return read();
    case ReadlaterRole:
        return readlater();
    case FreshRole:
        return fresh();
    default:
        return QVariant();
    }
}
Ejemplo n.º 23
0
QDir
IPod::saveDir() const 
{
    QDir d = lastfm::dir::runtimeData().filePath( "devices/" + uid() );
    d.mkpath( "." );
    return d;
}
Ejemplo n.º 24
0
int UserInfo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 27)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 27;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 27)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 27;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = firstName(); break;
        case 1: *reinterpret_cast< QString*>(_v) = lastName(); break;
        case 2: *reinterpret_cast< QString*>(_v) = title(); break;
        case 3: *reinterpret_cast< int*>(_v) = clockedin(); break;
        case 4: *reinterpret_cast< int*>(_v) = cashedin(); break;
        case 5: *reinterpret_cast< int*>(_v) = uid(); break;
        case 6: *reinterpret_cast< int*>(_v) = level(); break;
        case 7: *reinterpret_cast< double*>(_v) = bank(); break;
        case 8: *reinterpret_cast< int*>(_v) = merchant(); break;
        case 9: *reinterpret_cast< int*>(_v) = cashier(); break;
        case 10: *reinterpret_cast< int*>(_v) = staff_bank(); break;
        case 11: *reinterpret_cast< int*>(_v) = active_sales(); break;
        case 12: *reinterpret_cast< double*>(_v) = total_sales(); break;
        case 13: *reinterpret_cast< double*>(_v) = pending_sales(); break;
        case 14: *reinterpret_cast< double*>(_v) = cash_tendered(); break;
        case 15: *reinterpret_cast< double*>(_v) = cash_received(); break;
        case 16: *reinterpret_cast< double*>(_v) = credit_received(); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::WriteProperty) {
        _id -= 17;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 17;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 17)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 17;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Ejemplo n.º 25
0
 void CProfileRepoServerClb::getManifest(const RepoRequest * req, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize)
 {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
    UID uid(bufferToString(req->data));
    std::string strRes = mProfileDB.getManifest(uid);
    stringToBuffer(strRes,pResponseBuffer);
    bufferSize = stringInBufSize(strRes);
 }
Ejemplo n.º 26
0
bool KUser::operator ==(const KUser& user) const {
    if (isValid() != user.isValid())
	return false;
    if (isValid())
	return uid() == user.uid();
    else
	return true;
}
Ejemplo n.º 27
0
void CatActionList::onSelectionChange(int idx)
{
	if(idx != -1)
	{
		QUuid uid(ui.actionList->itemData(idx).toString());
		setDescription(myDescriptions.value(uid,""));
	}
}
Ejemplo n.º 28
0
 void CProfileRepoServerClb::removeProfile(const RepoRequest * req, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize)
 {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
    UID uid(bufferToString(req->data));
    CError err = mApiDB.removeProfileApi(uid);
    UInt32 code = err.getCode();
    memcpy (pResponseBuffer, &code,4);
    bufferSize = 4;
 }
Ejemplo n.º 29
0
LOCAL_C void Test2()
//
// Test RFs::ReadFileSection() on UID reads
//
	{

	
	test.Next(_L("Use RFs::ReadFileSection() to read UIDs from files"));

	TBuf8<sizeof(TCheckedUid)> uidBuf(sizeof(TCheckedUid));
	TPtr uidPtr((TText*)uidBuf.Ptr(),sizeof(TCheckedUid),sizeof(TCheckedUid));
	
	TInt r=TheFs.ReadFileSection(_L("\\F32-TST\\UIDCHK.BLG"),0,uidPtr,sizeof(TCheckedUid));
	test_KErrNone(r);
	TCheckedUid uid(uidBuf);
	TUidType uidType=uid.UidType();
	test(uidType.IsValid());
	
	test(uidType[0]==TUid::Uid('U') && uidType[1]==TUid::Uid('I') && uidType[2]==TUid::Uid('D'));

	r=TheFs.ReadFileSection(_L("\\F32-TST\\UIDCHK.MSG"),0,uidBuf,sizeof(TCheckedUid));
	test_KErrNone(r);
	uid.Set(uidBuf);
	uidType=uid.UidType();
	test(uidType.IsValid());
	test(uidType[0]==TUid::Uid('X') && uidType[1]==TUid::Uid('Y') && uidType[2]==TUid::Uid('Z'));
	
	
	// Test for Null File length
	TBuf8<256> testDesN;
	test.Next(_L("Check for null file name"));
 	r=TheFs.ReadFileSection(_L(""),0,testDesN,26);
 	test_Value(r, r == KErrBadName);
 	
	// Check the lentgh of descriptor.	
 	TInt x = testDesN.Length();
 	test ( x == 0);
 	
 	test.Next(_L("Check for non existing file"));
	r=TheFs.ReadFileSection(_L("sdfsd.dfg"),0,testDesN,26);
 	test.Printf(_L("Return %d"),r);
 	test_Value(r, (r == KErrNotFound) || (r == KErrPathNotFound));
 	
	// Check the lentgh of descriptor.	
 	x = testDesN.Length();
	test ( x == 0);
	
	r=TheFs.ReadFileSection(_L("\\F32-TST\\UIDCHK.DAT"),0,uidBuf,sizeof(TCheckedUid));
	test_KErrNone(r);
	uid.Set(uidBuf);
	uidType=uid.UidType();
	test(uidType.IsValid());
	test(uidType[0]==TUid::Uid('D') && uidType[1]==TUid::Uid('A') && uidType[2]==TUid::Uid('T'));
	

	}
Ejemplo n.º 30
0
void Win32PeperoniDevice::open()
{
    qDebug() << Q_FUNC_INFO;

    if (isOpen() == true)
        return;

    if (m_usbdmx->open(m_id, &m_handle) == TRUE)
    {
        /* DMX512 specifies 0 as the official startcode */
        if (m_usbdmx->tx_startcode_set(m_handle, 0) == FALSE)
            qWarning() << "Unable to set DMX startcode on device with UID:" << uid();
    }
    else
    {
        qWarning() << "Unable to open device with UID:" << uid();
        m_handle = NULL;
    }
}