void buildVariableDict(ClassDef *inst, ClassDef *cl)
{
	 MemberList *instPort=NULL;
	 MemberList *classPort=NULL;
      
	  instPortDict.clear();
	  classPortDict.clear();
   
    if(inst!=NULL)
        instPort=inst->getMemberList(MemberListType_variableMembers); 
	 
	if(cl!=NULL)
	 classPort=cl->getMemberList(MemberListType_variableMembers); 


	  if(instPort)
		  {
            MemberListIterator mnii(*instPort);
            MemberDef *md;
			for (mnii.toFirst();(md=mnii.current());++mnii){
				//printf("\n Inst: %s %s %s",md->name().data(),md->getOutputFileBase().data(),md->getReference().data());
				 instPortDict.insert(md->name().data(),md);
				}
		  }

	  if(classPort)
		  {
             MemberListIterator mnii(*classPort);
			 MemberDef *md;
			 for (mnii.toFirst();(md=mnii.current());++mnii){
			//	 printf("\n Class: %s %s %s",md->name().data(),md->getOutputFileBase().data(),md->getReference().data());
				 classPortDict.insert(md->name().data(),md);
				 }
		  }
}//funct
예제 #2
0
void FileIn::bypass(Token & tk) {
  static QDict<char> bypassed;
  
  QCString s = tk.xmiType();
  
  if (s.isEmpty()) {
    QString k = QString(tk.what());
    
    if (bypassed[k] == 0) {
      warning("bypass &lt;" + tk.what() + "...&gt; (other cases not signaled)");
      bypassed.insert(k, "");
    }
  }
  else {
    QString k = QString(tk.what()) + " " + QString(s);
    
    if (bypassed[k] == 0) {
      warning("bypass &lt;" + tk.what() + 
	      " xmi:type=\"" + s + "\"...&gt; (other cases not signaled)");
      bypassed.insert(k, "");
    }
  }

  s = tk.xmiId();
  if (! s.isEmpty())
    BypassedIds.insert(QString(s), "");
    
  if (! tk.closed())
    finish(tk.what());

}
예제 #3
0
/*!
  Returns a list of names of all the available font families.
*/
QStringList FontDatabase::families() const
{
#ifndef QT_NO_FONTDATABASE
    return QFontDatabase::families();
#else

#ifndef QWS
   QStringList list;
   return list;
#else
    QStringList list;
    QDict<void> familyDict;
    QDiskFont *qdf;
    for ( qdf=qt_fontmanager->diskfonts.first(); qdf!=0;
            qdf=qt_fontmanager->diskfonts.next()) {
	QString familyname = qdf->name;
	if ( !familyDict.find( familyname ) ) {
	    familyDict.insert( familyname, (void *)1 );
	    list.append( familyname );
	}
    }

    QDir dir(fontDir(),"*.qpf");
    for (int i=0; i<(int)dir.count(); i++) {
	QString familyname = fontFamily(dir[i]);
	if ( !familyDict.find( familyname ) ) {
	    familyDict.insert( familyname, (void *)1 );
	    list.append( familyname );
	}
    }

    return list;
#endif
#endif
}
예제 #4
0
// return pixmap for zoom 100%
QPixmap * get_pixmap(const char * path)
{
  QPixmap * px = DiagramPixmap.find(path);
  
  if (px == 0) {
    QString abspath;
    
    if (!QDir::isRelativePath(path))
      abspath = path;
    else if ((UmlWindow::images_root_dir().isEmpty() ||
	      !QFile::exists(abspath = QDir::cleanDirPath(UmlWindow::images_root_dir() + '/' + path))) &&
	     !QFile::exists(abspath = path))
      abspath = BrowserView::get_dir().absFilePath(path);
    
    px = new QPixmap(abspath);
    
    DiagramPixmap.insert(path, px);
    
    if (px->isNull()) {
      msg_critical(TR("Error"),
		   QString(path) + TR("\ndoesn't exist or is not a know image format"));
      return 0;
    }
    
    DiagramScaledPixmap.insert(path, new QPtrDict<QPixmap>());
  }

  return (px->isNull()) ? 0 : px;
}
void buildVariableDict(ClassDef *cd)
{
   
if(cd==0) return;
variableDict.clear();

	MemberList* ml=cd->getMemberList(MemberListType_variableMembers); 
     if(ml)
		  {
             MemberListIterator mnii(*ml);
			 MemberDef *md;
             for (mnii.toFirst();(md=mnii.current());++mnii)
             {
               VerilogDocGen::adjustMemberName(md);
                variableDict.insert(md->name().data(),md);
              }
		 }

     ml=cd->getMemberList(MemberListType_pubMethods); 
	 if(ml)
		  {
             MemberListIterator mnii(*ml);
			 MemberDef *md;
             for (mnii.toFirst();(md=mnii.current());++mnii)
                variableDict.insert(md->name().data(),md);
		 }
}
예제 #6
0
void
Win32MakefileGenerator::processPrlFiles()
{
    QDict<void> processed;
    QPtrList<MakefileDependDir> libdirs;
    libdirs.setAutoDelete(TRUE);
    {
	QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
	for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) {
	    QString r = (*libpathit), l = r;
	    fixEnvVariables(l);
	    libdirs.append(new MakefileDependDir(r.replace("\"",""),
						 l.replace("\"","")));
	}
    }
    for(bool ret = FALSE; TRUE; ret = FALSE) {
	//read in any prl files included..
	QStringList l_out;
	QString where = "QMAKE_LIBS";
	if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
	    where = project->first("QMAKE_INTERNAL_PRL_LIBS");
	QStringList &l = project->variables()[where];
	for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
	    QString opt = (*it);
	    if(opt.startsWith("/")) {
		if(opt.startsWith("/LIBPATH:")) {
		    QString r = opt.mid(9), l = r;
		    fixEnvVariables(l);
		    libdirs.append(new MakefileDependDir(r.replace("\"",""),
							 l.replace("\"","")));
		}
	    } else {
		if(!processed[opt]) {
		    if(processPrlFile(opt)) {
			processed.insert(opt, (void*)1);
			ret = TRUE;
		    } else {
			for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
			    QString prl = mdd->local_dir + Option::dir_sep + opt;
			    if(processed[prl]) {
				break;
			    } else if(processPrlFile(prl)) {
				processed.insert(prl, (void*)1);
				ret = TRUE;
				break;
			    }
			}
		    }
		}
	    }
	    if(!opt.isEmpty())
		l_out.append(opt);
	}
	if(ret)
	    l = l_out;
	else
	    break;
    }
}
예제 #7
0
//=====================================
// XAccessX reset and switch to Intro
//-------------------------------------
void XAccessX::resetPage (int reload) {
	// ...
	// this function is called if the xaccess dialog is finished or canceled
	// AccessX is an X11 extension which need a seperate configuration file
	// which is outside of the normal configuration create via ISaX. Therefore
	// we don`t need to serialize any data here
	// ---
	if (reload == PAGE_RELOAD) {
	if (mEnable -> isChecked()) {
		QFile* mHandle = new QFile (
			"/usr/X11R6/lib/X11/xkb/X0-config.keyboard"
		);
		if (! mHandle -> open(IO_WriteOnly)) {
		log (L_ERROR,
			"XAccessX::open failed on: %s -> %s\n",
			mHandle->name().ascii(),strerror(errno)
		);
		}
		QString* speed = new QString();
		speed -> sprintf ( 
			"%d",mLCD -> intValue()
		);
		QDict<char> data;
		data.insert ("MouseKeysMaxSpeed=" , 
			speed->ascii()
		);
		data.insert ("MouseKeysDelay="    , "40");
		data.insert ("MouseKeysInterval=" , "10" );
		data.insert ("MouseKeysTimeToMax=", "1000" );
		data.insert ("MouseKeysCurve="    , "0"  );
		data.insert ("Controls+=","MouseKeysAccel");
		#if 0
		data.insert ("Controls+=",
			"MouseKeysAccel + AccessxKeys"
		);
		data.insert ("Feedback+=",
			"SlowKeysPress + SlowKeysAccept + StickyKeys + LatchToLock"
		);
		#endif
		QDictIterator<char> it (data);
		for (; it.current(); ++it) {
			QString line;
			line.sprintf ("%s %s\n",
				it.currentKey().ascii(),it.current()
			);
			mHandle -> writeBlock (
				line.ascii(),line.length()
			);
		}
		mHandle -> close();
	}
	}
	if (reload == PAGE_RELOAD) {
		slotApply();
	}
	mStatus -> clear();
	slotIntro (mIndex);
	XTemplate::resetPage ();
	mStack -> raiseWidget (Intro);
}
예제 #8
0
//====================================
// getOptions
//------------------------------------
QDict<QString> SaXManipulateCard::getOptions (void) {
	// .../
	//! retrieve an option list of all options set for the
	//! selected card. The storage is a dictionary saving the
	//! option name as key and the options value as value for
	//! this key. If there is no value set for the option
	//! (bool options) the value for the key is the (null) string
	// ----
	if (! mImport) {
		return QDict<QString>();
	}
	QDict<QString> result;
	QString stdOptions = mImport -> getItem ("Option");
	QString rawOptions = mImport -> getItem ("RawData");
	//====================================
	// remove commented options from data
	//------------------------------------
	rawOptions.replace(
		QRegExp("#Option  \"(.*)\" \"(.*)\""),""
	);
	//====================================
	// handle bool options
	//------------------------------------
	QStringList stdlist = QStringList::split ( ",", stdOptions );
	for ( QStringList::Iterator
		in = stdlist.begin(); in != stdlist.end(); ++in
	) {
		QString item (*in);
		result.insert (item,new QString);
	}
	//====================================
	// handle value added options
	//------------------------------------
	QStringList rawlist = QStringList::split ( "Option", rawOptions );
	for ( QStringList::Iterator
		in = rawlist.begin(); in != rawlist.end(); ++in
	) {
		QString item (*in);
		QRegExp itemExp ("\"(.*)\" \"(.*)\"");
		int pos = itemExp.search (item);
		if (pos >= 0) {
			QString key = itemExp.cap(1);
			QString* val = new QString (itemExp.cap(2));
			result.insert (key,val);
		}
	}
	return result;
}
예제 #9
0
//====================================
// getArrangement
//------------------------------------
QDict<QString> SCCMonitorArrange::getArrangement ( void ) {
	QDict<QString> result;
	QList<SCCLayoutLine> layout = mMatrix->getLayout();
	QListIterator<SCCLayoutLine> it (layout);
	for (; it.current(); ++it) {
		QString* key   = new QString();
		QString* value = new QString();
		SCCLayoutLine* l = it.current();
		int neighbour[4] = {l->mLeft,l->mRight,l->mTop,l->mBottom};
		key->sprintf("Screen:Screen[%d]",mCardID[l->ID]);
		for (int n=0;n<4;n++) {
		if (neighbour[n] == -1) {
			value->sprintf (
				"%s <none>",value->ascii()
			);
		} else {
			value->sprintf (
				"%s Screen[%d]",value->ascii(),neighbour[n]
			);
		}
		}
		*value = value->stripWhiteSpace();
		result.insert (
			*key,value
		);
	}
	return result;
}
예제 #10
0
파일: File.cpp 프로젝트: gregsmirnov/bouml
void File::readProperties(QDict<QCString> & d) {
    d.setAutoDelete(TRUE);

    read("(");
    read("list");
    read("Attribute_Set");

    for (;;) {
        QCString s;

        switch (read(s)) {
        case ')':
            return;
        case '(':
            read("object");
            read("Attribute");
            read("tool");

            if (read(s) != STRING)
                syntaxError(s, "the tool");

            read("name");
            {
                QCString s2;

                if (read(s2) != STRING)
                    syntaxError(s2, "the name");

                s += "/" + s2;

                read("value");

                switch (read(s2)) {
                case '(':
                    if ((read(s2) == ATOM) && (s2 == "value")) {
                        read("Text");
                        if (read(s2) != STRING)
                            syntaxError(s2, "the value");
                        read(")");
                    }
                    else
                        skipBlock();
                // no break !
                case STRING:
                case ATOM:
                    d.insert(s, new QCString(s2));
                    break;
                default:
                    syntaxError(s, "the value");
                }
            }

            read(")");
            break;
        default:
            syntaxError(s);
        }
    }

}
예제 #11
0
MimeTypeTree::MimeTypeTree(QWidget *parent)
	: KListView(parent)
{
	KMimeType::List list=KMimeType::allMimeTypes();
	QDict<QListViewItem> map;
	setRootIsDecorated(true);

	addColumn("-");
	header()->hide();
    QValueListIterator<KMimeType::Ptr> i(list.begin());
	for (; i != list.end(); ++i)
	{
		QString mimetype = (*i)->name();
		int slash = mimetype.find("/");
		QString major = mimetype.left(slash);
		
		// hide all and inode majors
		if (major == "all" || major=="inode")
			continue;

		QString minor = mimetype.mid(slash+1);
		QListViewItem *majorItem=map[major];
		if (!majorItem)
		{
			majorItem=addMajor(major);
			map.insert(major, majorItem);
		}
		
		new QListViewItem(majorItem, minor);
	}
}
void 
VerilogDocGen::buildGlobalVerilogVariableDict(const FileDef* fd,bool clear,int level)
{
   if(fd==0)return;
   
   if(clear)
   {
     globalMemDict.clear();
     classInnerDict.clear();
   }

 
   MemberDef *md=NULL;
   MemberList *ml=	fd->getMemberList(MemberListType_decVarMembers);
   if(ml!=NULL) 
   {
   MemberListIterator fmni(*ml);
      
	for (fmni.toFirst();(md=fmni.current());++fmni)
	{
		VerilogDocGen::adjustMemberName(md);
		//if(stricmp(md->typeString(),"include")==0)
		/*
	    if(!findIncludeName(md->name().data()))
		{
			//	printf("\n insert %s",md->name());	
			    includeMemList.append(md);
		}
		*/
   //		printf("\n %s ....  ",md->name().data());
   //		ClassDef *ch=md->getClassDef();
   //		if(ch==0)
		globalMemDict.insert(md->name().data(),md);
	}
   }

   ml=	fd->getMemberList( MemberListType_decFuncMembers);
   if(ml!=0)
   {
   MemberListIterator fmni(*ml);
   for (fmni.toFirst();(md=fmni.current());++fmni)
	{
		VerilogDocGen::adjustMemberName(md);
		globalMemDict.insert(md->name().data(),md);
	}
   }
  } 
예제 #13
0
파일: applnk.cpp 프로젝트: opieproject/opie
void DocLnkSet::findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth)
{
    depth++;
    if ( depth > 10 )
  return;

    QDir dir( dr );

    /* Opie got a different approach
     * I guess it's geek vs. consumer
     * in this case to be discussed
     */
    if ( dir.exists( ".Qtopia-ignore" ) )
  return;

    const QFileInfoList *list = dir.entryInfoList();
    if ( list ) {
  QFileInfo* fi;
  for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) {
      QString bn = fi->fileName();
      if ( bn[0] != '.' ) {
    if ( fi->isDir()  ) {
        if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" )
      findChildren(fi->filePath(), mimeFilters, reference, depth);
    } else {
        if ( fi->extension(FALSE) == "desktop" ) {
      DocLnk* dl = new DocLnk( fi->filePath() );
      QFileInfo fi2(dl->file());
      bool match = FALSE;
      if ( !fi2.exists() ) {
          dir.remove( dl->file() );
      }
      if ( mimeFilters.count() == 0 ) {
          add( dl );
          match = TRUE;
      } else {
          for( QValueList<QRegExp>::ConstIterator it = mimeFilters.begin(); it != mimeFilters.end(); ++ it ) {
        if ( (*it).match(dl->type()) >= 0 ) {
            add(dl);
            match = TRUE;
        }
          }
      }
      if ( !match )
          delete dl;
        } else {
      if ( !reference.find(fi->fileName()) )
          reference.insert(fi->filePath(), (void*)2);
        }
    }
      }
  }
    }
}
예제 #14
0
/** Callback function called for each include in a translation unit */
static void inclusionVisitor(CXFile includedFile,
                             CXSourceLocation* /*inclusionStack*/,
                             unsigned /*includeLen*/,
                             CXClientData clientData)
{
  QDict<void> *fileDict = (QDict<void> *)clientData;
  CXString incFileName = clang_getFileName(includedFile);
  //printf("--- file %s includes %s\n",fileName,clang_getCString(incFileName));
  fileDict->insert(clang_getCString(incFileName),(void*)0x8);
  clang_disposeString(incFileName);
}
예제 #15
0
LabelImage *readLabelFile(QString filename, GaMaskImage & mask, int &mask_x,
                          int &mask_y, int &mask_size_x, int &mask_size_y)
{
  LabelImage *im = labelImageDict[filename];
  if (im)
    return im;                  // image found in dictionary
  Image *image=imageDict[filename];
  im = new LabelImage();
  if (image)
    im->image=*image;
  else {
    printf("readLabelFile %s\n",filename.latin1());
    image=new Image();
    image->read(filename.latin1());
    imageDict.insert(filename,image);
    im->image=*image;
  }
  labelImageDict.insert(filename, im);
  maskLabelImage(*im, mask, mask_x, mask_y, mask_size_x, mask_size_y);
  return im;
}
예제 #16
0
SlaveConfigProtocol* SlaveConfigPrivate::readProtocolConfig(const QString &_protocol)
{
   SlaveConfigProtocol *scp = protocol.find(_protocol);
   if (!scp)
   {
      QString filename = KProtocolInfo::config(_protocol);
      scp = new SlaveConfigProtocol;
      scp->configFile = new KConfig(filename, true, false);
      protocol.insert(_protocol, scp);
   }
   // Read global stuff...
   readConfig(scp->configFile, "<default>", &(scp->global));
   return scp;
}
예제 #17
0
void DbPlugin::loadIndexData (QString &symbol, QDict<Bar> &lookup, QDateTime &startDate, float weight,
                           int barRange, BarData::BarLength barLength)
{
  QFileInfo fi(symbol);
  QString fn = fi.fileName();

  DbPlugin db;
  if (db.open(symbol, chartIndex))
  {
    qDebug("Index::getIndexHistory: cannot open symbol chart");
    return;
  }

  BarData *bar = new BarData(symbol);
  bar->setBarLength(barLength);
  db.setBarRange(barRange);
  db.getHistory(bar, startDate);
  db.close();
  
  int loop;
  for (loop = 0; loop < (int) bar->count(); loop++)
  {
    QDateTime dt;
    bar->getDate(loop, dt);
    QString s = dt.toString("yyyyMMddhhmmss");
    Bar *r = lookup.find(s);
    if (! r)
    {
      r = new Bar;
      r->setDate(dt);
      r->setOpen(bar->getOpen(loop) * weight);
      r->setHigh(bar->getHigh(loop) * weight);
      r->setLow(bar->getLow(loop) * weight);
      r->setClose(bar->getClose(loop) * weight);
      r->setOI(1);
      r->getDateTimeString(FALSE, s);
      lookup.insert(s, r);
    }
    else
    {
      r->setOpen(r->getOpen() + (bar->getOpen(loop) * weight));
      r->setHigh(r->getHigh() + (bar->getHigh(loop) * weight));
      r->setLow(r->getLow() + (bar->getLow(loop) * weight));
      r->setClose(r->getClose() + (bar->getClose(loop) * weight));
      r->setOI((int) r->getOI() + 1);
    }
  }

  delete bar;
}
예제 #18
0
파일: File.cpp 프로젝트: gregsmirnov/bouml
File::File(QString s, QString here) {
    for (;;)  {
        int index = 0;

        while ((index = s.find('\\', index)) != -1)
            s.replace(index++, 1, "/");

        int index0;

        if ((index0 = s.find('$')) == -1)
            break;

        if ((index = s.find('/', index0 + 1)) == -1)
            index = s.length();

        static QDict<char> alias;

        QString var = s.left(index);
        const char * val = alias[var];

        if (val == 0) {
            if ((val = getenv(var.mid(1))) == 0) {
                QString v = QInputDialog::getText("Unknown environment variable",
                                                  var.mid(1) + " : ");

                if (v.isEmpty())
                    throw 0;

                val = strdup((const char *) v);
            }
            else
                val = strdup(val);

            alias.insert(var, val);
        }

        if (*val == '&') {
            QFileInfo fi(here);

            s.replace(index0, index - index0, fi.dirPath(TRUE));
        }
        else
            s.replace(index0, index - index0, val);
    }

    setName(QDir::cleanDirPath(s));

    unread_k = -1;

}
예제 #19
0
static void addUnique(KService::List &lst, QDict< KService > &dict, const KService::List &newLst, bool lowPrio)
{
    QValueListConstIterator< KService::Ptr > it = newLst.begin();
    for(; it != newLst.end(); ++it)
    {
        KService *service = static_cast< KService * >(*it);
        if(dict.find(service->desktopEntryPath()))
            continue;
        dict.insert(service->desktopEntryPath(), service);
        lst.append(service);
        if(lowPrio)
            service->setInitialPreference(0);
    }
}
예제 #20
0
/** Inserts a package into the list */
void PackageList::insertPackage( OipkgPackage* pack )
{
	if (!pack) return;
  OipkgPackage* p = packageListAll->find( pack->name() );
  if ( p )
    {
      if ( (p->version() == pack->version())
//      		&& (p->dest() == pack->dest())
        	)
      {
	      p->copyValues( pack );
  	    delete pack;
    	  pack = p;
      } else {
      	QDict<OipkgPackage> *packver = p->getOtherVersions();
//       	p->setName( pack->name()+"["+p->version()+"]" );
				if (!packver)
    		{
    				packver = new QDict<OipkgPackage>();
		       	packver->insert( pack->name(), p );
          	p->setOtherVersions( packver );
        }
       	pack->setName( pack->name() );//+"["+pack->version()+"]" );
       	pack->setOtherVersions( packver );
       	packver->insert( pack->name(), pack );
				packageListAll->insert( pack->name(), pack );
				packageList.insert( pack->name(), pack );
      	origPackageList.insert( pack->name(), pack );
      }
    }else{
      packageListAll->insert( pack->name(), pack );
      packageList.insert( pack->name(), pack );
      origPackageList.insert( pack->name(), pack );
    };
  empty=false;
  updateSections( pack );
}
예제 #21
0
int main (void) {
	SaXException().setDebug (true);
	QDict<SaXImport> section;
	int importID[] = {
		SAX_POINTERS,
		SAX_LAYOUT
	};
	printf ("Importing data...\n");
	SaXConfig* config = new SaXConfig;
	for (int id=0; id<2; id++) {
		SaXImport* import = new SaXImport ( importID[id] );
		import -> setSource ( SAX_SYSTEM_CONFIG );
		import -> doImport();
		config -> addImport (import);
		section.insert (
			import->getSectionName(),import
		);
	}
	printf ("Adding new pointer device... ");
	SaXManipulateDevices dev (
		section["Pointers"],section["Layout"]
	);
	int tabletID = dev.addInputDevice (SAX_INPUT_TABLET);
	printf ("ID: %d is [SAX_INPUT_TABLET]: added\n",tabletID);

	printf ("Setting up tablet data... ");
	SaXManipulateTablets pointer (
		section["Pointers"],section["Layout"]
	);
	if (pointer.selectPointer (tabletID)) {
		QList<QString> tabletList = pointer.getTabletList();
		QList<QString> penList = pointer.getPenList();
		QString* myTablet = tabletList.at (3);
		QString* myPen = penList.at(3);
		pointer.setTablet( *myTablet );
		pointer.addPen ( *myPen );
		printf ("Tablet: [%s] with pen: [%s] configured\n",
			myTablet->ascii(),myPen->ascii()
		);
	}
	printf ("writing configuration\n");
	config -> setMode (SAX_MERGE);
	if ( ! config -> createConfiguration() ) {
		printf ("%s\n",config->errorString().ascii());
		printf ("%s\n",config->getParseErrorValue().ascii());
		return 1;
	}
	return (0);
}
예제 #22
0
/*! load filemap and make index.
 *  \param htmlDir of HTML directory generated by htags(1).
 *  \retval TRUE success
 *  \retval FALSE error
 */
bool Htags::loadFilemap(const QCString &htmlDir)
{
  QCString fileMapName = htmlDir+"/HTML/FILEMAP";
  QFileInfo fi(fileMapName);
  /*
   * Construct FILEMAP dictionary using QDict.
   *
   * In FILEMAP, URL includes 'html' suffix but we cut it off according
   * to the method of FileDef class.
   *
   * FILEMAP format:
   * <NAME>\t<HREF>.html\n
   * QDICT:
   * dict[<NAME>] = <HREF>
   */
  if (fi.exists() && fi.isReadable())
  {
    QFile f(fileMapName);
    const int maxlen = 8192;
    QCString line(maxlen+1);
    line.at(maxlen)='\0';
    if (f.open(IO_ReadOnly))
    {
      int len;
      while ((len=f.readLine(line.rawData(),maxlen))>0)
      {
        line.resize(len+1);
        //printf("Read line: %s",line.data());
        int sep = line.find('\t');
        if (sep!=-1)
        {
          QCString key   = line.left(sep).stripWhiteSpace();
          QCString value = line.mid(sep+1).stripWhiteSpace();
          int ext=value.findRev('.');
          if (ext!=-1) value=value.left(ext); // strip extension
          g_symbolDict.setAutoDelete(TRUE);
          g_symbolDict.insert(key,new QCString(value));
          //printf("Key/Value=(%s,%s)\n",key.data(),value.data());
        }
      }
      return TRUE;
    }
    else
    {
      err("file %s cannot be opened\n",fileMapName.data()); 
    }
  }
  return FALSE;
}
예제 #23
0
    /*
     * We do simple ref counting... We will add the QLibrary again
     * and again to the dictionary and on deref we will pop and pop it
     * until there are no more library and we will unload and delete the library
     * luckily dlopen does some ref counting as well so we don't need
     * to hack QPEApplication
     */
    QLibrary* OPluginLibraryHolder::ref(const QString& str) {
        QLibrary *lib = m_libs[str];

        /* if not in the dict try to load it */
        if ( !lib ) {
            lib = new QLibrary( str, QLibrary::Immediately );
            if ( !lib->isLoaded() ) {
                delete lib;
                return 0l;
            }
        }

        /* now refcount one up */
        m_libs.insert( str, lib );
        return lib;
    }
예제 #24
0
QList<ArgDict>* readRegionFile(const char* filename)
{
  QList <ArgDict>* region=regionFileDict[filename];
  if (region) 
    return region;

  // read regionfile
//  QFile rfp("/project/geoaida/tmp/reglist.dest");
  QFile rfp(filename);
  if (!rfp.open(IO_ReadOnly)) {
    fprintf(stderr, "regionfile %s not found\n", filename);
    return 0;
  }
  // Read and process regions
  QList < ArgDict > *regionList=new QList < ArgDict >();
  regionList->setAutoDelete(true);
  MLParser parser(&rfp);
  QString keywords[] = { "region", "" };
  const MLTagTable nodeTagTable(keywords);
  const int TOK_REGION = 1;
  int tag;
  do {
    tag = parser.tag(nodeTagTable);
    ArgDict *args;
    switch (tag) {
    case TOK_REGION:{
        args = parser.args();
	regionList->append(args);
        break;
      }
    case -TOK_REGION:
      break;
    case MLParser::END_OF_FILE:
      break;
    default:{
        args = parser.args();
        delete args;
        qDebug("Unknown keyword %s in line %d", parser.lasttagstr().latin1(),
               parser.lineNumber());
        break;
      }
    }
  } while (tag != MLParser::END_OF_FILE);
  rfp.close();
  regionFileDict.insert(filename,regionList);
  return regionList;
}
예제 #25
0
bool CppRefType::add(const QCString & t, QList<CppRefType> & l, bool incl)
{
  if (t.isEmpty())
    return FALSE;

  static QDict<char> cpp_builtin_types;
  
  if (cpp_builtin_types.count() == 0) {
    cpp_builtin_types.insert("unsigned", " ");
    cpp_builtin_types.insert("signed", " ");
    cpp_builtin_types.insert("char", " ");
    cpp_builtin_types.insert("short", " ");
    cpp_builtin_types.insert("int", " ");
    cpp_builtin_types.insert("long", " ");
    cpp_builtin_types.insert("float", " ");
    cpp_builtin_types.insert("double", " ");
    cpp_builtin_types.insert("bool", " ");
    cpp_builtin_types.insert("void", " ");
  }
  
  if (cpp_builtin_types[t] != 0)
    return TRUE;
  
  CppRefType * ref;
  Weight w = (incl) ? Medium : Low;
  
  for (ref = l.first(); ref; ref = l.next()) {
    if (ref->type.toString() == t) {
      if (w > ref->weight)
	ref->included = incl;
      return TRUE;
    }
  }
  
  l.append(new CppRefType(t, incl, w));
  return TRUE;
}
예제 #26
0
int main (void) {
	SaXException().setDebug (true);
	QDict<SaXImport> section;
	int importID[] = {
		SAX_POINTERS,
		SAX_LAYOUT
	};
	printf ("Importing data...\n");
	SaXConfig* config = new SaXConfig;
	for (int id=0; id<2; id++) {
		SaXImport* import = new SaXImport ( importID[id] );
		import -> setSource ( SAX_SYSTEM_CONFIG );
		import -> doImport();
		config -> addImport (import);
		section.insert (
			import->getSectionName(),import
		);
	}
	printf ("Adding new pointer device... ");
	SaXManipulateDevices dev (
		section["Pointers"],section["Layout"]
	);
	int panelID = dev.addInputDevice (SAX_INPUT_TOUCHPANEL);
	printf ("ID: %d is [SAX_INPUT_TOUCHPANEL]: added\n",panelID);

	printf ("Setting up touchpanel data... ");
	SaXManipulateTouchscreens pointer (
		section["Pointers"]
	);
	if (pointer.selectPointer (panelID)) {
		QList<QString> panelList = pointer.getPanelList();
		QString* myPanel = panelList.at(0);
		pointer.setTouchPanel( *myPanel );
		printf ("TouchPanel: [%s] configured\n", myPanel->ascii());
	}
	printf ("writing configuration\n");
	config -> setMode (SAX_MERGE);
	if ( ! config -> createConfiguration() ) {
		printf ("%s\n",config->errorString().ascii());
		printf ("%s\n",config->getParseErrorValue().ascii());
		return 1;
	}
	return (0);
}
void GadGuiInitObjectTable()
{
  int size;
  int i;
  for (size = 0; !_gadguifunctable[size].name.isEmpty(); size++);
  QString *keyword = new QString[size + 1];
  for (i = 0; i < size; i++) {
    keyword[i] = _gadguifunctable[i].name;
    qDebug("GadGuiInitObjectTable %s\n",
           (const char *) _gadguifunctable[i].name);
    if ((void *) _gadguifunctable[i].func)
      _gadguitable.insert(_gadguifunctable[i].name,
                          (void *) _gadguifunctable[i].func);
  }
  keyword[size] = "";

  _gadguitagtable = new MLTagTable(keyword);

}
예제 #28
0
int main (void) {
    SaXException().setDebug (true);
    QDict<SaXImport> section;
    int importID[] = {
        SAX_CARD,
        SAX_POINTERS,
        SAX_KEYBOARD,
        SAX_LAYOUT,
        SAX_PATH
    };
    printf ("Importing data...\n");
    SaXConfig* config = new SaXConfig;
    for (int id=0; id<5; id++) {
        SaXImport* import = new SaXImport ( importID[id] );
        import -> setSource ( SAX_SYSTEM_CONFIG );
        import -> doImport();
        config -> addImport (import);
        section.insert (
            import->getSectionName(),import
        );
    }
    printf ("Exporting display for VNC access...\n");
    SaXManipulateVNC mVNC (
        section["Card"],section["Pointers"],section["Keyboard"],
        section["Layout"],section["Path"]
    );
    if (! mVNC.VNCEnabled()) {
        mVNC.enableVNC();
        mVNC.addVNCKeyboard();
        mVNC.addVNCMouse();
    }
    printf ("writing configuration\n");
    config -> setMode (SAX_MERGE);
    if ( ! config -> createConfiguration() ) {
        printf ("%s\n",config->errorString().ascii());
        printf ("%s\n",config->getParseErrorValue().ascii());
        return 1;
    }
    return (0);
}
예제 #29
0
파일: setup.cpp 프로젝트: icefox/kinkatta
/***************************************************************************
 * Returns a list of all the pounces of a user.
 ***************************************************************************/
QDict<pounce> setup::readPounces(const QString &user){
	QDict<pounce> list;
	if(user.isEmpty() || (user == QString("<new user>")) )
		return list;

  QString settingsFileXml = KINKATTA_DIR;
  settingsFileXml += user.lower();
  settingsFileXml += ".xml";

	Preferences prefs(settingsFileXml, QString("kinkatta user prefs"), QString("1.0"));

	prefs.setGroup("pounces");

	pounce *p;
  int count = prefs.getNumber("pounce_count", 0);
	for(int i = 0; i < count; i++){
		p = new pounce;
		p->buddyName = prefs.getString(QString("pounce_%1").arg(i) + "_buddyName", QString(""));
		p->signOn = prefs.getBool(QString("pounce_%1").arg(i) + "_signOn",false);
		p->returnAway = prefs.getBool(QString("pounce_%1").arg(i) + "_returnAway", false);
		p->returnIdle = prefs.getBool(QString("pounce_%1").arg(i) + "_returnIdle", false);
		p->openChat = prefs.getBool(QString("pounce_%1").arg(i) + "_openChat", false);
		p->sendMessage = prefs.getBool(QString("pounce_%1").arg(i) + "_sendMessage", false);
		p->message = prefs.getString(QString("pounce_%1").arg(i) + "_message", QString(""));
		p->execCommand = prefs.getBool(QString("pounce_%1").arg(i) + "_execCommand", false);
		p->command = prefs.getString(QString("pounce_%1").arg(i) + "_command", QString(""));
		p->doNotRemove = true;

		p->hidden = prefs.getBool(QString("pounce_%1").arg(i) + "_hidden", false);
		p->ignoreSettings = prefs.getBool(QString("pounce_%1").arg(i) + "_ignoreSettings", false);
		p->signOnSound = prefs.getString(QString("pounce_%1").arg(i) + "_signOnSound", QString(""));
		p->signOffSound = prefs.getString(QString("pounce_%1").arg(i) + "_signOffSound", QString(""));

		list.insert(p->buddyName, p);
	}
	return list;

}
예제 #30
0
//=====================================
// XMouse virtual slots...
//-------------------------------------
bool XMouse::slotRun (int index) {
	if (XTemplate::slotRun (index)) {
	// log(L_INFO,"XMouse::slotRun() called: %d\n",index);
	// ...
	// this function is called if the mouse page is activated.
	// use this function to init the dialog with the current
	// setup of the mice
	// ---
	XWrapPointer< QDict<char> > mText (mTextPtr);	
	mStatus -> message (mText["RunXMouse"]);
	mFrame  -> nextButton() -> setText (mText["finish"]);

	// ...
	// get the mFiles pointer wrapper from the Intro
	// object which has read all the data files
	// ---
	QDict<XFile>* mFilePtr = mIntro->getFiles();
	XWrapFile < QDict<XFile> > mFiles (mFilePtr);

	// ...
	// fill the mouseList listbox with the 
	// configured simple pointer devices
	// --- 
	mouseList -> clear();
	mIndexList.clear();
	QString topic;
	XData* sysData;
	QDict<char> mouseInfo;
	int mice;
	mice = mFiles["sys_INPUT"]->getDeviceCount();
	int count = -1;
	for (int n=0; n<mice; n++) {
		count += 2;
		sysData = mFiles["sys_INPUT"] -> getDevice(count);
		if (! sysData) {
		continue;
		}
		mouseInfo = sysData -> getData();
		if (QString(mouseInfo["InputFashion"]).isNull()) {
			mouseInfo.insert ("InputFashion","Mouse");
		}
		if (QString(mouseInfo["InputFashion"]) != "Mouse") {
		continue;
		}
		QString topic (mouseInfo["Name"]);
		XStringList name (mouseInfo["Name"]);
		name.setSeperator (";");
		QList<char> mouseName = name.getList();
		if (mouseName.count() == 2) {
			topic.sprintf("%s %s",mouseName.at(0),mouseName.at(1));
		}
		QString topicStream;
		QTextOStream (&topicStream)
			<< topic << " ( " << mouseInfo["Protocol"] << " "
			<< mText["at"] << " " << mouseInfo["Device"] << " )";
		topic = topicStream;
		int* index = (int*) malloc (sizeof(int));
		*index = count;
		mIndexList.append (index);
		mouseList -> insertItem (
			QPixmap(PIXINTROMOUSE),topic
		);
	}
	// ...
	// enable/disable configure/remove buttons
	// and select first element of the listbox
	// ---
	if (mice > 0) {
		mDel   -> setDisabled ( false );
		mSetup -> setDisabled ( false );
		mouseList -> setCurrentItem ( 0 );
		mouseList -> setSelected    ( 0,true );
		mSelected = 0;
	} else {
		mDel   -> setDisabled ( true );
		mSetup -> setDisabled ( true );
	}
	}
	return (TRUE);
}