Example #1
0
QDataStream& luaEvent::getState(QDataStream& in, Subject *, int observerId, QStringList &  attribs)
#endif

{
    int obsCurrentState = 0; //serverSession->getState(observerId);
    QString content;

    switch (obsCurrentState)
    {
        case 0:
#ifdef TME_BLACK_BOARD
        content = getAll(in, observerId, observedAttribs);
#else
        content = getAll(in, observerId, attribs);
#endif
            break;
        case 1:
#ifdef TME_BLACK_BOARD
        content = getChanges(in, observerId, observedAttribs);
#else
        content = getChanges(in, observerId, attribs);
#endif
            break;
    }
    in << content;
    return in;
}
Example #2
0
const uintmax_t WsDirNode::getSize()
{
  if (WsGlobalProperties::instance()->get("global", "dir_size", "true") == "true")
    if (getAll().size() == 0)
      return m_size;
  return getAll().size();
}
Example #3
0
vector<Technology*> Technology::getSorted() {
  vector<Technology*> ret;
  while (ret.size() < getAll().size()) {
    append(ret, getNextTechs(ret));
  }
  return ret;
}
Example #4
0
void hack_draw (xstuff_t * XStuff, double currentTime, float frameTime)
{
	static double lastSettingsChange = -1;

	if (lastSettingsChange == -1)
		lastSettingsChange = currentTime;

	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity ();
	getAll ();

	glTranslatef(0.0, 0.0, -3.0f);

	glLineWidth (blurWidth * sqrt((GLfloat) (XStuff->windowWidth * XStuff->windowHeight) / (500 * 400)));
	glColor4f (blurColor[0], blurColor[1], blurColor[2], 0.2);
	drawAll ();

	glLineWidth(1);
	glColor4f (lineColor[0], lineColor[1], lineColor[2], 0.4);
	drawAll ();

	if (currentTime - lastSettingsChange > timeInterval) {
		lastSettingsChange = currentTime;

		changeSettings ();
	}

	equationBase += speed * (frameTime / (1.0 / 30.0));

	glFlush ();
}
void TransactionHistory::refresh(quint32 accountIndex)
{
    // rebuilding transaction list in wallet_api;
    m_pimpl->refresh();
    // copying list here and keep track on every item to avoid memleaks
    getAll(accountIndex);
}
Example #6
0
 /// \brief Tries to find the node under this \c FileMatchTrieNode that best
 /// matches 'FileName'.
 ///
 /// If multiple paths fit 'FileName' equally well, \c IsAmbiguous is set to
 /// \c true and an empty string is returned. If no path fits 'FileName', an
 /// empty string is returned. \c ConsumedLength denotes the number of
 /// \c Filename's trailing characters already consumed during recursion.
 ///
 /// To find the best matching node for a given path 'p', the
 /// \c findEquivalent() function is called recursively for each path segment
 /// (back to fron) of 'p' until a node 'n' is reached that does not ..
 /// - .. have children. In this case it is checked
 ///   whether the stored path is equivalent to 'p'. If yes, the best match is
 ///   found. Otherwise continue with the parent node as if this node did not
 ///   exist.
 /// - .. a child matching the next path segment. In this case, all children of
 ///   'n' are an equally good match for 'p'. All children are of 'n' are found
 ///   recursively and their equivalence to 'p' is determined. If none are
 ///   equivalent, continue with the parent node as if 'n' didn't exist. If one
 ///   is equivalent, the best match is found. Otherwise, report and ambigiuity
 ///   error.
 StringRef findEquivalent(const PathComparator& Comparator,
                          StringRef FileName,
                          bool &IsAmbiguous,
                          unsigned ConsumedLength = 0) const {
   if (Children.empty()) {
     if (Comparator.equivalent(StringRef(Path), FileName))
       return StringRef(Path);
     return StringRef();
   }
   StringRef Element(llvm::sys::path::filename(FileName.drop_back(
       ConsumedLength)));
   llvm::StringMap<FileMatchTrieNode>::const_iterator MatchingChild =
       Children.find(Element);
   if (MatchingChild != Children.end()) {
     StringRef Result = MatchingChild->getValue().findEquivalent(
         Comparator, FileName, IsAmbiguous,
         ConsumedLength + Element.size() + 1);
     if (!Result.empty() || IsAmbiguous)
       return Result;
   }
   std::vector<StringRef> AllChildren;
   getAll(AllChildren, MatchingChild);
   StringRef Result;
   for (unsigned i = 0; i < AllChildren.size(); i++) {
     if (Comparator.equivalent(AllChildren[i], FileName)) {
       if (Result.empty()) {
         Result = AllChildren[i];
       } else {
         IsAmbiguous = true;
         return StringRef();
       }
     }
   }
   return Result;
 }
Example #7
0
QDataStream& luaNeighborhood::getState(QDataStream& in, Subject *, int observerId, QStringList &attribs)
{
#ifdef DEBUG_OBSERVER
    printf("\ngetState\n\nobsAttribs.size(): %i\n", obsAttribs.size());
    luaStackToQString(12);
#endif

    int obsCurrentState = 0; //serverSession->getState(observerId);
    QString content;

    switch(obsCurrentState)
    {
        case 0:
            content = getAll(in, observerId, attribs);
            // serverSession->setState(observerId, 1);
            // qWarning(QString("Observer %1 passou ao estado %2").arg(observerId).arg(1).toAscii().constData());
            break;

        case 1:
            content = getChanges(in, observerId, attribs);
            // serverSession->setState(observerId, 0);
            // qWarning(QString("Observer %1 passou ao estado %2").arg(observerId).arg(0).toAscii().constData());
            break;
    }
    // cleans the stack
    // lua_settop(L, 0);

    in << content;
    return in;
}
Example #8
0
uint8_t JSTK::getBtn()
{
	uint8_t recv[5];
	getAll(0,recv);

	return recv[4];
}
Example #9
0
const vector<Technology*> Technology::getAllowed() const {
  vector<Technology*> ret;
  for (Technology* t : getAll())
    if (contains(t->prerequisites, this))
      ret.push_back(t);
  return ret;
}
Example #10
0
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
	ui.setupUi(this);
	QObject::connect(ui.actionGetAll, SIGNAL(triggered()),
		this, SLOT(getAll()));
	QObject::connect(ui.action_Settings, SIGNAL(triggered()),
		this, SLOT(configDialog()));

	// add tab widgets
	auto logger = new LoggingMainWidget(this);
	ui.tabWidget->addTab(new SummaryMainWidget(), QIcon(":/icons/lazy"), 
		tr("&Summary"));
	ui.tabWidget->addTab(new MailMainWidget(), QIcon(":/icons/letter"), 
		tr("&Mail"));
	ui.tabWidget->addTab(new CalendarMainWidget(), QIcon(":/icons/book"), 
		tr("&Calendar"));
	ui.tabWidget->addTab(new ContactsMainWidget(), QIcon(":/icons/people"), 
		tr("C&ontacts"));
	ui.tabWidget->addTab(new InstantMainWidget(), QIcon(":/icons/hands"), 
		tr("&Instant"));
	ui.tabWidget->addTab(new IrcMainWidget(), QIcon(":/icons/trash"), 
		tr("I&rc"));
	auto rssWidget = new RssMainWidget(this);
	ui.tabWidget->addTab(rssWidget, QIcon(":/icons/rss"), tr("&RSS"));
	ui.tabWidget->addTab(new TodoMainWidget(), QIcon(":/icons/wrench"), 
		tr("&Todo"));
	ui.tabWidget->addTab(logger, QIcon(":/icons/dog"), tr("&Logggin"));
}
Example #11
0
Files Files::getAllByExtension(const std::string &t_ext) const
{
  try {
    return getAll(boost::bind(&Files::extensionCompare, t_ext, _1));
  } catch (const std::runtime_error &e) {
    throw std::runtime_error("getAllByExtension: " + std::string(e.what()) + ": " + t_ext);
  }
}
Example #12
0
ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, JSValue key, Optional<uint32_t> count)
{
    auto onlyResult = IDBKeyRange::only(execState, key);
    if (onlyResult.hasException())
        return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'getAll' on 'IDBIndex': The parameter is not a valid key.") };

    return getAll(execState, onlyResult.releaseReturnValue(), count);
}
Example #13
0
Files Files::getAllByKey(const std::string &t_key) const
{
  try {
    return getAll(boost::bind(&Files::keyCompare, t_key, _1));
  } catch (const std::runtime_error &e) {
    throw std::runtime_error("getAllByKey: " + std::string(e.what()) + ": " + t_key);
  }
}
Example #14
0
Files Files::getAllByRegex(const std::string &t_regex) const
{
  try {
    return getAll(boost::bind(&Files::regexCompare, QRegExp(toQString(t_regex), Qt::CaseInsensitive), _1));
  } catch (const std::runtime_error &e) {
    throw std::runtime_error("getLastByRegex: " + std::string(e.what()) + ": " + t_regex);
  }
}
Example #15
0
Files Files::getAllByFilename(const std::string &t_filename) const
{
  try {
    return getAll(boost::bind(&Files::filenameCompare, t_filename, _1));
  } catch (const std::runtime_error &e) {
    throw std::runtime_error("getAllByFilename: " + std::string(e.what()) + ": " + t_filename);
  }
}
Example #16
0
/// <summary>
/// Get thread by ID
/// </summary>
/// <param name="id">Thread ID</param>
/// <returns>Pointer to thread object, nullptr if failed</returns>
Thread* ProcessThreads::get( DWORD id )
{
    for(auto& thd : getAll())
        if (thd.id() == id)
            return &thd;

    return nullptr;
}
Example #17
0
/// <summary>
/// Get thread by ID
/// </summary>
/// <param name="id">Thread ID</param>
/// <returns>Pointer to thread object, nullptr if failed</returns>
Thread* ProcessThreads::get( DWORD id )
{
    getAll();
    auto iter = std::find_if( _threads.begin(), _threads.end(), [id]( const Thread& item ) { return item.id() == id; } );
    if (iter != _threads.end())
        return &*iter;

    return nullptr;
}
Example #18
0
void wiSPTree::getAll(Node* node, CulledList& objects){
	if(node != nullptr){
		objects.insert(node->objects.begin(),node->objects.end());
		if(node->count){
			for (unsigned int i = 0; i<node->children.size(); ++i)
				getAll(node->children[i],objects);
		}
	}
}
Example #19
0
  MX GetNonzeros::getGetNonzeros(const Sparsity& sp, const std::vector<int>& nz) const {
    // Get all the nonzeros
    vector<int> nz_all = getAll();

    // Eliminate recursive calls
    vector<int> nz_new(nz);
    for (vector<int>::iterator i=nz_new.begin(); i!=nz_new.end(); ++i) {
      if (*i>=0) *i = nz_all[*i];
    }
    return dep()->getGetNonzeros(sp, nz_new);
  }
Example #20
0
bool check()
{
    for(int i=0;i<4;i++)
    {
        if(getAll(3,i)&1)
        {
            return false;
        }
    }
    return true;
}
Example #21
0
uint16_t JSTK::getY()
{
	uint16_t yPos;
	uint8_t recv[5];
	getAll(0,recv);

	yPos = recv[2];
	yPos |= (recv[3] << 8);

	return yPos;
}
Example #22
0
uint16_t JSTK::getX()
{
	uint16_t xPos;
	uint8_t recv[5];
	getAll(0,recv);

	xPos = recv[0];
	xPos |= (recv[1] << 8);

	return xPos;	
}
Example #23
0
SDL_Texture* TileManager::get(int id0, int id1, int id2, int id3, SDL_Renderer *renderer) {
	if (id0 == TILE_MAX && id2 == TILE_MAX) {
		return getVert(id3, id1, renderer);
	}
	else if (id1 == TILE_MAX && id3 == TILE_MAX) {
		return getHori(id0, id2, renderer);
	}
	else {
		return getAll(id0, id1, id2, id3, renderer);
	}
}
Example #24
0
Master::tInfo
Master::getInfo(const Types::Keys& keys)
{
  if (keys.empty()) return getAll();

  std::ostringstream oss;

  oss << "SELECT * FROM " << fields.table()
      << " WHERE " << fields.key() << " IN (" << keys << ");";

  return getLike(oss.str());
}
Example #25
0
/// <summary>
/// Get random thread
/// </summary>
/// <returns>Pointer to thread object, nullptr if failed</returns>
Thread* ProcessThreads::getRandom()
{
    getAll();

    if (_threads.empty())
        return nullptr;

    static std::random_device rd;
    std::uniform_int_distribution<size_t> dist( 0, _threads.size() - 1 );

    return &_threads[dist(rd)];
}
Example #26
0
QDataStream& luaLocalAgent::getState(QDataStream& in, Subject *, int observerId, QStringList &  attribs)
#endif

{
    int obsCurrentState = 0; //serverSession->getState(observerId);
    QString content;

    switch (obsCurrentState)
    {
    case 0:
#ifdef TME_BLACK_BOARD
        content = getAll(in, observerId, observedAttribs);
#else
        content = getAll(in, observerId, attribs);
#endif
        // serverSession->setState(observerId, 1);
        // if (execModes == Quiet)
        // qWarning(QString("Observer %1 passou ao estado %2").arg(observerId).arg(1).toAscii().constData());
        break;

    case 1:
#ifdef TME_BLACK_BOARD
        content = getChanges(in, observerId, observedAttribs);
#else
        content = getChanges(in, observerId, attribs);
#endif
        // serverSession->setState(observerId, 0);
        // if (execModes == Quiet)
        // qWarning(QString("Observer %1 passou ao estado %2").arg(observerId).arg(0).toAscii().constData());
        break;
    }
    // cleans the stack
    // lua_settop(L, 0);

    in << content;
    return in;
}
bool InstalledPackages::isInstalled(const Dependency& dep)
{
    QList<InstalledPackageVersion*> installed = getAll();
    bool res = false;
    for (int i = 0; i < installed.count(); i++) {
        InstalledPackageVersion* ipv = installed.at(i);
        if (ipv->package == dep.package &&
                dep.test(ipv->version)) {
            res = true;
            break;
        }
    }
    qDeleteAll(installed);
    return res;
}
Example #28
0
/// <summary>
/// Get least executed thread
/// </summary>
/// <returns>Pointer to thread object, nullptr if failed</returns>
Thread* ProcessThreads::getLeastExecuted()
{
    uint64_t mintime = MAXULONG64;
    Thread* pThread = nullptr;

    for (auto& thread : getAll())
    {
        uint64_t time = thread.execTime();

        if (time < mintime)
        {
            mintime = time;
            pThread = &thread;
        }
    }

    return pThread;
}
Example #29
0
/// <summary>
/// Get main process thread
/// </summary>
/// <returns>Pointer to thread object, nullptr if failed</returns>
Thread* ProcessThreads::getMain()
{
    uint64_t mintime = MAXULONG64;
    Thread* pMain = nullptr;

    for (auto& thread : getAll())
    {
        uint64_t time = thread.startTime();

        if (time < mintime)
        {
            mintime = time;
            pMain = &thread;
        }
    }

    return pMain;
}
Example #30
0
/// <summary>
/// Get most executed thread
/// </summary>
/// <returns>Pointer to thread object, nullptr if failed</returns>
Thread* ProcessThreads::getMostExecuted()
{
    uint64_t maxtime = 0;
    Thread* pThread = getMain();
    if (pThread->Suspended())
        pThread = nullptr;

    for (auto& thread : getAll( true ))
    {
        uint64_t time = thread.execTime();
        if (!thread.Suspended() && time > maxtime)
        {
            maxtime = time;
            pThread = &thread;
        }
    }

    return pThread;
}