Example #1
0
void PstnPhoneBook::add( const QPhoneBookEntry& entry, const QString& store, bool flush )
{
    if ( store != "SM" ) {
        if ( flush )
            getEntries( store );
        return;
    }

    int index;
    for ( index = 0; index < ents.size(); ++index ) {
        if ( ents[index].number().isEmpty() )
            break;
    }

    QPhoneBookEntry newEntry( entry );
    newEntry.setIndex( (uint)index );

    if ( index < ents.size() ) {
        ents[index] = newEntry;
    } else {
        ents += newEntry;
    }

    if ( flush )
        getEntries( store );
}
std::vector<std::string> Filesystem::getProjects(const std::string prefix)
{
#ifdef WIN32
  return getEntries(std::string(File::getBHDir())
                    + "/Make/VS2010/" + prefix, true, false, ".vcxproj", false);
#else
  return getEntries(std::string(File::getBHDir())
                    + "/Make/Linux/" + prefix, true, false, ".make", false);
#endif
}
Example #3
0
void PstnPhoneBook::remove( uint index, const QString& store, bool flush )
{
    if ( store != "SM" ) {
        if ( flush )
            getEntries( store );
        return;
    }

    if ( ((int)index) < ents.size() ) {
        ents[(int)index].setNumber( "" );
    }

    if ( flush )
        getEntries( store );
}
Example #4
0
ConfEntry* ConfSection::getEntry(const std::string& key) {
    ConfEntryList* entryList = getEntries(key);

    if(entryList==0 || entryList->size()==0) return 0;

    return entryList->front();
}
Example #5
0
void KDir::updateFiltered()
{
    myFilteredNames.clear();
    myFilteredEntries.clear();

    if (myDirtyFlag) {
        myTmpEntries.clear();
        myEntries.clear();
        if (isBlocking)
            getEntries();
        else
            startLoading();
    } else {
        for (KFileInfo *i= myEntries.first(); i; i=myEntries.next()) {

            if (filterEntry(i)) {
                KFileInfo *fi= new KFileInfo(*i);
                CHECK_PTR(fi);

                myFilteredEntries.append(fi);
                myFilteredNames.append(fi->fileName());
            }
        }
    }
}
Example #6
0
void
FlowScene::
removeNode(QGraphicsItem* item)
{
  auto ngo = dynamic_cast<NodeGraphicsObject*>(item);

  std::shared_ptr<Node> const& node = ngo->node().lock();

  auto deleteConnections = [&node, this] (PortType portType)
  {
    auto nodeState = node->nodeState();
    auto const & nodeEntries = nodeState.getEntries(portType);

    for (std::weak_ptr<Connection> conn : nodeEntries)
    {
      if (auto c = conn.lock())
        this->deleteConnection(c);
    }
  };

  deleteConnections(PortType::In);
  deleteConnections(PortType::Out);

  _nodes.erase(node->id());
}
rspfNormalizedS16RemapTable::rspfNormalizedS16RemapTable()
   : rspfNormalizedRemapTable()
{
   if (!theTableIsInitialized)
   {
      const rspf_int32   ENTRIES     = getEntries();
      const rspf_float64 DENOMINATOR = getNormalizer();
      
      //---
      // Initialize the remap table.
      //
      // Specialized for elevation, make -32768 and -32767 map to 0 since
      // DTED NULL is -32767.
      //
      // NOTE: Zero will always remap back to -32768 with this hack.  This
      // could cause issues on writers that use pixFromNorm(). (drb)
      //---
      theTable[0] = 0.0; // Index zero always for null.
      theTable[1] = 0.0; // Specialized for DTED.

      for (rspf_int32 i = 2; i < ENTRIES; ++i)
      {
         theTable[i] = static_cast<rspf_float64>(i)/DENOMINATOR;
      }

      theTableIsInitialized = true;
   }
}
Example #8
0
int main() {
    auto opts = osvr::common::IPCRingBuffer::Options("Test");
    auto buf = osvr::common::IPCRingBuffer::find(opts);
    if (!buf) {
        std::cout << "Couldn't find it." << std::endl;
        return 1;
    }

    std::cout << "Capacity: " << buf->getEntries() << " entries.\n";
    std::cout << "Entry size: " << buf->getEntrySize() << " bytes per entry."
              << std::endl;

    osvr::common::IPCRingBuffer::sequence_type seq(0);
    while (true) {
        std::cin.ignore();
        std::cout << "Sequence number " << seq << ": ";
        auto res = buf->get(seq);
        if (res) {
            std::cout << (res.get())[0] << (res.get())[1] << (res.get())[2];
        } else {
            std::cout << "Not available";
        }
        std::cout << std::endl;
        seq++;
    }

    return 0;
}
int runtime::app::onCommand(const Glib::RefPtr<Gio::ApplicationCommandLine> &appCmdLine) {
  auto optDict = appCmdLine->get_options_dict();
  auto cmdOptions = getCmdOptions();
  for (auto &o : *(cmdOptions->getEntries())) {
    if (o.second.value.type == dataTypes::OptionArgumentText ||
        o.second.value.type == dataTypes::OptionArgumentFilename) {
      Glib::ustring tmp;
      if (!optDict->lookup_value(o.second.longName.c_str(), tmp))
        continue;
      o.second.value.textValue = tmp.c_str();
    } else if (o.second.value.type == dataTypes::OptionArgumentLogical) {
      bool tmp;
      if (!optDict->lookup_value(o.second.longName.c_str(), tmp))
        continue;
      o.second.value.logicalValue = tmp;
    } else if (o.second.value.type == dataTypes::OptionArgumentNumeric) {
      int tmp;
      if (!optDict->lookup_value(o.second.longName.c_str(), tmp))
        continue;
      o.second.value.numericValue = tmp;
    }

    if (o.second.callback) {
      int retval = -1; // continue
      if (!o.second.callback(o.second, &retval))
        return retval;
    }
  }

  optDict->lookup_value(G_OPTION_REMAINING, cmdOptions->pathArgs);

  _app->activate();
  return EXIT_SUCCESS;
}
Example #10
0
void ZipPlugin::getEntries(const KArchiveEntry *rootEntry)
{
    if (rootEntry->isFile()) {
        const KZipFileEntry *fileEntry = static_cast<const KZipFileEntry*>(rootEntry);

        m_entries << (QStringList() << m_currentPath + fileEntry->name()  // file name
                                    << KGlobal::locale()->formatByteSize(fileEntry->size()) // file size
                                    << KGlobal::locale()->formatByteSize(fileEntry->compressedSize()) // compressed size
                                    << QString::number(fileEntry->crc32(), 16) // crc
                                    << QString::number(fileEntry->encoding()) // method
                                    << fileEntry->user() // owner
                                    << fileEntry->group() // group
                                    << KArchiveUtils::self()->formatPermissions(fileEntry->permissions()) // permissions
                                    << KGlobal::locale()->formatDateTime(fileEntry->datetime())
        );
        return;
    }

    if (rootEntry->name() != "/") { // even on win32 the rootEntry is "/"
        m_currentPath.append(rootEntry->name() + QDir::separator());
    }

    const KArchiveDirectory *rootDir = static_cast<const KArchiveDirectory*>(rootEntry);

    foreach (const QString &entry, rootDir->entries()) {
        getEntries(rootDir->entry(entry));
    }

    m_currentPath.remove(rootDir->name() + QDir::separator());

}
Example #11
0
int main() {

    auto opts = osvr::common::IPCRingBuffer::Options("Test");
    auto buf = osvr::common::IPCRingBuffer::create(opts);
    if (!buf) {
        std::cout << "Couldn't create it." << std::endl;
        return 1;
    }
    std::cout << "Using backend: " << int(buf->getBackend()) << std::endl;

    std::cout << "Capacity: " << buf->getEntries() << " entries.\n";
    std::cout << "Entry size: " << buf->getEntrySize() << " bytes per entry."
              << std::endl;

    while (true) {
        // std::this_thread::sleep_for(std::chrono::milliseconds(100));
        std::string data;
        std::getline(std::cin, data);
        auto seq =
            buf->put(reinterpret_cast<const unsigned char *>(data.data()),
                     data.length());
        std::cout << "Sequence number " << seq << std::endl;
        // auto proxy = buf->put();
    }

    return 0;
}
Example #12
0
void KDir::timerEvent() {
    myTmpEntries.clear();
    if (myOpendir)
        getEntries();
    readFiles = 0;
    if (myTmpEntries.count())
        emit newFilesArrived(&myTmpEntries);
}
Example #13
0
void			CIDEEntry_PATH_Group::unload(void)
{
	for (CIDEEntry *pIDEEntry : getEntries())
	{
		pIDEEntry->unload();
		delete pIDEEntry;
	}
}
double getResults( TString filename, std::vector<TString> folders, TString hname, double scale ){
  TFile *f=new TFile( filename );

  vector<TH1D*> inh = getHists( f, folders, hname );
  cout<<"here6"<<endl;

  return getEntries( inh, scale );
}
Example #15
0
std::shared_ptr<Connection>
NodeState::
connection(PortType portType, PortIndex portIndex) const
{
  auto const &connections = getEntries(portType);

  return connections[portIndex].lock();
}
Example #16
0
QStringList CommandLineArgument::getEntryParameters(int entry) const {
	QList<QString> entries = getEntries();

	if(entry < 0 || entry >= entries.size()) {
		return QList<QString>();
	}
	return entries.at(entry).split(" ");
}
Example #17
0
std::set<std::string> EntryController::getDistinctCategories()
{
	std::set<std::string> categories = std::set<std::string>();
	for (auto entry : getEntries())
	{
		categories.insert(entry->category);
	}
	return categories;
}
// Gets the next value block from the operator 
Block* DictMultiWriter::getNextValBlock(int colIndex_) {
	if (colIndex_==0) {
		return getEntries();	
	}
	else if (colIndex_==1) {
		return getTable();	
	}
	else 
		return NULL;
}	
Example #19
0
/*********************************************************************
** METHOD  :
** PURPOSE :
** INPUT   :
** OUTPUT  :
** RETURN  :
** REMARKS :
*********************************************************************/
tools::misc::IProperties* TimeInfo::getProperties (const std::string& root)
{
    u_int32_t total = 0;

    /** We first compute the aggregated time. */
    std::map <std::string, u_int32_t>::const_iterator  it;
    for (it = getEntries().begin(); it != getEntries().end();  it++)   {  total += it->second;  }

    tools::misc::IProperties* props = new tools::misc::impl::Properties();

    props->add (0, root, "%.3f", (double)total/1000.0);

    for (it = getEntries().begin(); it != getEntries().end();  it++)
    {
        props->add (1, it->first.c_str(), "%.3f", (double)(it->second) / 1000.0);
    }

    return props;
}
Example #20
0
void updateDisplay() {
    erase();
    initWins();

    // Get files and directories
    getEntries();
    printHead();

    printMenus();
}
Example #21
0
void PstnPhoneBook::update( const QPhoneBookEntry& entry, const QString& store, bool flush )
{
    if ( store != "SM" ) {
        if ( flush )
            getEntries( store );
        return;
    }

    int index = (int)entry.index();
    if ( index < ents.size() ) {
        ents[index] = entry;
    } else {
        add( entry, store, flush );
        return;
    }

    if ( flush )
        getEntries( store );
}
Example #22
0
void
NodeState::
setConnection(PortType portType,
              PortIndex portIndex,
              std::shared_ptr<Connection> connection)
{
  auto &connections = getEntries(portType);

  connections[portIndex] = connection;
}
Example #23
0
void FsoPhoneBook::remove(uint index, const QString & store, bool flush)
{
    qDebug() << "FsoPhoneBook::remove index=" << index << "store=" << store <<
        "flush=" << flush;

    QFsoDBusPendingReply <> reply =
        service->gsmSim.DeleteEntry("contacts", index);

    checkReply(reply);
    getEntries(store);
}
Example #24
0
Entry* XDBF::getEntryById(long long identifier, int type)
{
    Entry *entries = getEntries();
    for(unsigned int i = 0; i < getHeader()->entryCount; i++)
        if(entries[i].identifier == identifier && entries[i].type == type)
        {
            return &entries[i];
        }

    return NULL;
}
Example #25
0
void FsoPhoneBook::update(const QPhoneBookEntry & entry, const QString & store,
                          bool flush)
{
    qDebug() << "FsoPhoneBook::update entry.text()=" << entry.text() << "store="
        << store << "flush=" << flush;

    QFsoDBusPendingReply <> reply =
        service->gsmSim.StoreEntry("contacts", entry.index(), entry.text(),
                                   entry.number());
    checkReply(reply);
    getEntries(store);
}
Example #26
0
QUuid const
NodeState::
connectionID(PortType portType, size_t nEntry) const
{
  std::vector<QUuid> const& entries =
    getEntries(portType);

  if (nEntry >= entries.size())
    return QUuid();

  return entries[nEntry];
}
Example #27
0
bool
ServerPasswd::getKeys(string_list_t& keys)
{
	map_array_t entries;
	if (getEntries(entries) && entries.size() > 0)
	{
		map_array_t::iterator it;
		for (it = entries.begin(); it != entries.end(); it++)
		{
			keys.push_back(it->second[SP_KEY].c_str() + 1);
		}
		return true;
	}
	return false;
}
void runtime::app::init(const std::string &name, int argc, char **argv) {
  auto cmdOptions = getCmdOptions();
  std::vector<GOptionEntry> entries;
  for (auto &o : *(cmdOptions->getEntries())) {
    entries.push_back({o.second.longName.c_str(), o.second.shortName, G_OPTION_FLAG_IN_MAIN,
                       convertOptionType(o.second.value.type), nullptr, o.second.description.c_str(),
                       o.second.argName.empty() ? nullptr : o.second.argName.c_str()});
    if (!o.second.callback) {
      switch (o.second.value.type) {
        case dataTypes::OptionArgumentNumeric:
          entries.back().arg_data = &o.second.value.numericValue;
          break;
        case dataTypes::OptionArgumentLogical:
          entries.back().arg_data = &o.second.value.logicalValue;
          break;
        case dataTypes::OptionArgumentFilename:
          entries.back().arg_data = &o.second.value.textValue;
          break;
        default:
          break;
      }
    }
  }

  entries.push_back({G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, nullptr, nullptr,"[PATH]"});

  entries.push_back({NULL, 0, 0, G_OPTION_ARG_NONE, nullptr, NULL, nullptr});
  _app = Gtk::Application::create(argc, argv, name, Gio::APPLICATION_HANDLES_COMMAND_LINE|Gio::APPLICATION_NON_UNIQUE);

  g_application_add_main_option_entries((GApplication *)_app->gobj(), entries.data());
  _app->signal_command_line().connect(sigc::mem_fun(this, &app::onCommand), false);

  _app->signal_activate().connect([&]() {
    bool activate = true;
    if (onBeforeActivate)
      activate = onBeforeActivate();

    if (!activate)
      return;

    _app->hold(); // we need to add additional app reference
                  // without it, the window will not be shown
    if (onActivate)
      onActivate();
  });
}
Example #29
0
int main(){
  auto reader = podio::ROOTReader();
  auto store = podio::EventStore();
  reader.openFile("example.root");
  store.setReader(&reader);

  bool verbose = true;

  unsigned nEvents = reader.getEntries();
  for(unsigned i=0; i<nEvents; ++i) {
    if(i%1000==0)
      std::cout<<"reading event "<<i<<std::endl;
    processEvent(store, true, reader);
    store.clear();
    reader.endOfEvent();
  }
  return 0;
}
Example #30
0
 foreach (AtariDirEntry e, entries) {
     if (e.attributes & AtariDirEntry::Directory) {
         QString newDir = target + "/" + e.niceName();
         if (!QDir(newDir).mkdir(newDir)) {
             QMessageBox::critical(m_image->editDialog(), tr("Atari file system error"), tr("Cannot create directory '%1'.").arg(e.niceName()));
             return false;
         }
         QList <AtariDirEntry> subs = getEntries(e.firstSector);
         bool res = extractRecursive(subs, newDir);
         if (!res) {
             return false;
         }
         continue;
     }
     if (!extract(e, target)) {
         return false;
     }
 }