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


C++ QStrList::at方法代码示例

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


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

示例1: QObject

KIconTemplateContainer::KIconTemplateContainer() : QObject()
{
  QString path;
  instances++;
  debug("KIconTemplateContainer: instances %d", instances);
  if(templatelist)
    return;

  debug("KIconTemplateContainer: Creating templates");

  templatelist = new QList<KIconTemplate>;
  templatelist->setAutoDelete(true);

  QStrList names;
  KConfig *k = kapp->getConfig();
  k->setGroup("Templates");
  k->readListEntry("Names", names);
  for(int i = 0; i < (int)names.count(); i++)
  {
    KIconTemplate *it = new KIconTemplate;
    it->path = k->readEntry(names.at(i));
    it->title = names.at(i);
    //debug("Template: %s\n%s", names.at(i), path.data());
    templatelist->append(it);
  }

  if(templatelist->count() == 0)
  {
    createStandardTemplates(templatelist);
  }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:31,代码来源:knew.cpp

示例2: readRating

void Board::readRating(KConfig *config)
{
  QStrList list;
  QString tmp;

  if (config->readListEntry("StoneValues", list)) {
    stoneValue[0] = 0;
    for(int i=1;i<6;i++)
      stoneValue[i] = (tmp = list.at(i-1)).toInt();
  }

  if (config->readListEntry("MoveValues", list)) {
    for(int i=0;i<5;i++)
      moveValue[i] = (tmp = list.at(i)).toInt();
  }

  if (config->readListEntry("RingValues", list)) {
    for(int i=0;i<5;i++)
      ringValue[i] = (tmp = list.at(i)).toInt();
  }

  if (config->readListEntry("RingDiffs", list)) {
    for(int i=0;i<5;i++)
      ringDiff[i] = (tmp = list.at(i)).toInt();
  }

  setFieldValues();
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:28,代码来源:Board.cpp

示例3: cddb_playlist_decode

bool cddb_playlist_decode(QStrList& list, QString& str){
 
    bool isok = true;
    int pos1, pos2;
    pos1 = 0;
    pos2 = 0;

    list.clear();

    while((pos2 = str.find(",",pos1,true)) != -1){

	if(pos2 > pos1){
	    list.append(str.mid(pos1,pos2 - pos1));
	}
    
	pos1 = pos2 + 1;
    }
  
    if(pos1 <(int) str.length())
	list.append(str.mid(pos1,str.length()));

    QString check;
    bool 	ok1;
    int   num;

    for(uint i = 0; i < list.count(); i++){
	check = list.at(i);
	check = check.stripWhiteSpace();

	if(check.isEmpty()){
	    list.remove(i);
	    i--;
	    continue;
	}

	if(check == QString (",")){
	    list.remove(i);
	    i--;
	    continue;
	}
    
	num = check.toInt(&ok1);
	if(!ok1 || num < 1){
	    list.remove(i);
	    i--;
	    isok = false;
	    continue;
	}
    
	list.remove(i);
	list.insert(i, check);

    }

    /*  for(uint i = 0; i < list.count(); i++){
	printf("playlist %d=%s\n",i,list.at(i));
	}*/
    return isok;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:59,代码来源:cddb.cpp

示例4: cddb_playlist_encode

void cddb_playlist_encode(QStrList& list,QString& playstr){

    playstr = "";
    for( uint i = 0; i < list.count(); i++){
	playstr += list.at(i);
	if(i < list.count() -1)
	    playstr += ",";
    }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:9,代码来源:cddb.cpp

示例5: readDateTimeEntry

// ### currentDateTime() as fallback ? (Harri)
QDateTime KConfigBase::readDateTimeEntry(const char *pKey, const QDateTime *pDefault) const
{
    if(!hasKey(pKey))
    {
        if(pDefault)
            return *pDefault;
        else
            return QDateTime::currentDateTime();
    }

    QStrList list;
    int count = readListEntry(pKey, list, ',');
    if(count == 6)
    {
        QDate date(atoi(list.at(0)), atoi(list.at(1)), atoi(list.at(2)));
        QTime time(atoi(list.at(3)), atoi(list.at(4)), atoi(list.at(5)));

        return QDateTime(date, time);
    }

    return QDateTime::currentDateTime();
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:23,代码来源:kconfigbase.cpp

示例6: contentsDropEvent

void DirectoryView::contentsDropEvent( QDropEvent *e )
{
    autoopen_timer->stop();

    if ( !QUriDrag::canDecode(e) ) {
        e->ignore();
        return;
    }

    QListViewItem *item = itemAt( contentsToViewport(e->pos()) );
    if ( item ) {

        QStrList lst;

        QUriDrag::decode( e, lst );

        QString str;

        switch ( e->action() ) {
            case QDropEvent::Copy:
            str = "Copy";
            break;
            case QDropEvent::Move:
            str = "Move";
            e->acceptAction();
            break;
            case QDropEvent::Link:
            str = "Link";
            e->acceptAction();
            break;
            default:
            str = "Unknown";
        }

        str += "\n\n";

        e->accept();

        for ( uint i = 0; i < lst.count(); ++i ) {
            QString filename = lst.at( i );
            str += filename + "\n";
        }
        str += QString( "\nTo\n\n   %1" )
               .arg( fullPath(item) );

        QMessageBox::information( this, "Drop target", str, "Not implemented" );
    } else
        e->ignore();

}
开发者ID:BackupTheBerlios,项目名称:kinneret,代码行数:50,代码来源:dirview.cpp

示例7: queryCD

void CDDB::queryCD(unsigned long _magicID,QStrList& querylist)
{
//    if(state == DO_NOTHING)
//        return;
//    state = DO_NOTHING;
    if((sock == 0L || sock->socket() < 0) && protocol==CDDBP)
	return;

    QString str;
    title = "";
    category = "";
    magicID = _magicID;

    str = str.sprintf("cddb query %08lx %u ",magicID,querylist.count()-1);
    for(int i = 0; i <(int) querylist.count(); i++) 
    {
	str += querylist.at(i);
	str += " ";
    }

    if(protocol==CDDBHTTP)
    {
	cddb_connect_internal();
	if(connected)
	{
	    QString param = str;
	    send_http_command(param);
	    if(use_http_proxy)
	    {
		saved_state = QUERY;
		state       = HTTP_REQUEST;
	    } else {
		state  = QUERY;
	    }
	}
    }
    else
    {
	// CDDB
	timeouttimer.stop();
	timeouttimer.start(timeout*1000,TRUE);
	str += "\n";
	if(debugflag)
		fprintf(stderr, "strdata: %s\n", str.data());
	write(sock->socket(),str.data(),str.length());
        state  = QUERY;
    }

  
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:50,代码来源:cddb.cpp

示例8: f_executeSlot

static ParseNode f_executeSlot(Parser* parser, const ParameterList& params)
{
  ParameterList::ConstIterator it = params.begin(); 
  QString slotName = (*it).toString()+"("; 
  ++it;
  QString widgetName = (*it).toString();
  KommanderWidget* widget = parser->currentWidget();
  if (!widget)
    return ParseNode::error("unknown widget");
  widget = widget->widgetByName(widgetName);
  if (!widget)
    return ParseNode::error("unknown widget");
  QObject *object = widget->object();
  if (!object)
    return ParseNode::error("unknown widget");
  QStrList slotSignatures = object->metaObject()->slotNames(true);
  QStringList slotNames = QStringList::fromStrList(slotSignatures);
  int slotNum = -1;
  uint i = 0;
  while (i < slotNames.count())
  {
    if (slotNames[i].startsWith(slotName))
    {
      slotNum = i;
      break;
    }  
    i++;
  }
  if (slotNum == -1)
    return ParseNode::error("unknown function");
  QStringList args;
  ++it;   // skip widget
  while (it != params.end())
  {
    args += (*it).toString(); 
    ++it;
  }
  InvokeClass* inv = new InvokeClass(0);
  inv->invokeSlot(object, slotSignatures.at(slotNum), args);
  inv->deleteLater();

  return ParseNode();
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:43,代码来源:functionlib.cpp

示例9: setHistoryList

void KmConfig::setHistoryList(QStrList &list)
{
	QString path = QDir::homeDirPath() + "/.kde/share/apps/kmap/history";
        QFile file(path);
	
	// Open file
	if (!file.open(IO_WriteOnly | IO_Truncate))
	{
		warning("Unable to open history file: %s", path.data() );
		return;
	}

	// Write strings
	QString text;

	for (uint i = 0; i < list.count(); i++)
	{
		text += list.at(i);
		text += "\n";
	}

	if (text.isEmpty())
	{
		file.close(); // truncated
		return;
	}

	if (!file.writeBlock(text.data(), text.length()))
	{
		warning("Write error to history file: %s", path.data() );
		file.close();
		return;
	}

	file.close();
}
开发者ID:hiamitbhardwaj,项目名称:ianzepp,代码行数:36,代码来源:kmconfig.cpp

示例10: if

KArchie::KArchie(const char *name)
  : KTopLevelWidget (name),
    queryResult( 0 )//,   downloadTmpFileList( 0 )
{
  setMinimumSize(420,200);
  config = KApplication::getKApplication()->getConfig();
  QString currenthost;
  QStrList archiehostlist;
  //  int archiehostlistnumber = 
  KConfigGroupSaver *saveGroup = new KConfigGroupSaver( config, "HostConfig" );

  config->readListEntry( "Hosts", archiehostlist );
  //  QString currenthost = config->readEntry( "CurrentHost", "archie.sura.net" );
  uint currentHostId = config->readUnsignedNumEntry( "CurrentHostId", 0 );
  QString defaulthost = "archie.sura.net" ;
  if ( archiehostlist.isEmpty() ) {
    archiehostlist.append( defaulthost );
    currentHostId = 0;
    //    archiehostlistnumber++;
  }
  else if (archiehostlist.count() < currentHostId) {
    currentHostId = 0;
  }    
  currenthost = archiehostlist.at(currentHostId);
  //  config->setGroup( ConfigEntries::HostConfigGroup );
  //  currenthost = config->readEntry( ConfigEntries::CurrentHostEntry,
  //				   ConfigEntries::CurrentHostDefault );

  //    debug("setup menu");
  menu = new KAMenu( this, "mainmenu" );
  setMenu( menu );
  connect( menu, SIGNAL(sigSettingsAll()),
	   this, SLOT(slotChangeSettings()) );
  connect( menu, SIGNAL(sigFileOpen()),
	   this, SLOT(slotOpenFileSelected()) );
  connect( menu, SIGNAL(sigFileOpenDir()), 
	   this, SLOT(slotOpenDirSelected()) );
  connect( menu, SIGNAL(sigFileGet()), 
	   this, SLOT(slotGetfileSelected()) );
  connect( menu, SIGNAL(sigFileLoadList()), 
	   this, SLOT(slotLoadfilelistSelected()) );
  connect( menu, SIGNAL(sigFileStoreList()), 
	   this, SLOT(slotStorefilelistSelected()) );
  connect( menu, SIGNAL(sigFileWriteList()), 
	   this, SLOT(slotWritefilelistSelected()) );
  connect( menu, SIGNAL(sigQueryFile()), 
	   this, SLOT(slotSearchFile()) );
  connect( menu, SIGNAL(sigQueryPath()), 
	   this, SLOT(slotSearchPath()) );
  connect( menu, SIGNAL(sigQueryHost()), 
	   this, SLOT(slotSearchHost()) );

  connect( menu, SIGNAL(sigSortHostname()), 
	   this, SLOT(slotSortListHostname()) );
  connect( menu, SIGNAL(sigSortDomain()), 
	   this, SLOT(slotSortListDomain()) );  
  connect( menu, SIGNAL(sigSortDate()), 
	   this, SLOT(slotSortListDate()) );
  connect( menu, SIGNAL(sigSortFilesize()), 
	   this, SLOT(slotSortListFilesize()) );
  menu->show();
  menu->setFileGetEnable( FALSE );
  menu->setFileOpenEnable( FALSE );
  menu->setFileOpenDirEnable( FALSE );
  menu->setFileStoreListEnable( FALSE );
  menu->setFileWriteListEnable( FALSE );
  menu->setSortEnable( FALSE );

  //    debug("setup statusbar");
  statbar = new KAStatusBar( this, "statusbar" );
  setStatusBar( statbar );
  statbar->slotChangeHost( currenthost );
  statbar->show();
  connect( menu, SIGNAL(sigArchieHost(const char *)), statbar, SLOT(slotChangeHost(const char *)) );

  delete saveGroup;
  saveGroup = new KConfigGroupSaver( config, "WindowConfig" );

  //  debug( "setup view" );
  view = new KAView( this, "view" );
  setView( view );
  //  view->slotShowFileDiscriptor(config->readBoolEntry("FAttr", true));
  view->show();

  connect( menu, SIGNAL(sigSettingsShowFileDiscription( bool )),
	   view, SLOT(slotShowFileDiscriptor( bool )) );
  connect( &(view->getSearchterm()),
	   SIGNAL(sigTextSelected()),
	   SLOT(slotSearchFile()) );
  connect( &(view->getList()),
	   SIGNAL(sigOpenFileSelected()),
	   SLOT(slotOpenFileSelected()) );
  connect( &(view->getList()),
	   SIGNAL(sigOpenDirSelected()),
	   SLOT(slotOpenDirSelected()) );
  connect( &(view->getList()),
	   SIGNAL(sigGetFileSelected()),
	   SLOT(slotGetfileSelected()) );

  show();
//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:101,代码来源:KArchie.cpp

示例11: start

void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit)
{
  static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
  static QStrList &includePath = Config_getList(INCLUDE_PATH);
  static QStrList clangOptions = Config_getList(CLANG_OPTIONS);
  static QCString clangCompileDatabase = Config_getList(CLANG_COMPILATION_DATABASE_PATH);
  if (!clangAssistedParsing) return;
  //printf("ClangParser::start(%s)\n",fileName);
  p->fileName = fileName;
  p->index    = clang_createIndex(0, 0);
  p->curLine  = 1;
  p->curToken = 0;
  QDictIterator<void> di(Doxygen::inputPaths);
  int argc=0;
  std::string error;
  // load a clang compilation database (https://clang.llvm.org/docs/JSONCompilationDatabase.html)
  // this only needs to be loaded once, and could be refactored to a higher level function
  static std::unique_ptr<clang::tooling::CompilationDatabase> db =
      clang::tooling::CompilationDatabase::loadFromDirectory(clangCompileDatabase.data(), error);
  int clang_option_len = 0;
  std::vector<clang::tooling::CompileCommand> command;
  if (strcmp(clangCompileDatabase, "0") != 0) {
      if (db == nullptr) {
          // user specified a path, but DB file was not found
          err("%s using clang compilation database path of: \"%s\"\n", error.c_str(),
              clangCompileDatabase.data());
      } else {
          // check if the file we are parsing is in the DB
          command = db->getCompileCommands(fileName);
          if (!command.empty() ) {
              // it's possible to have multiple entries for the same file, so use the last entry
              clang_option_len = command[command.size()-1].CommandLine.size();
          }
      }
  }
  char **argv = (char**)malloc(sizeof(char*)*(4+Doxygen::inputPaths.count()+includePath.count()+clangOptions.count()+clang_option_len));
  if (!command.empty() ) {
      std::vector<std::string> options = command[command.size()-1].CommandLine;
      // copy each compiler option used from the database. Skip the first which is compiler exe.
      for (auto option = options.begin()+1; option != options.end(); option++) {
          argv[argc++] = strdup(option->c_str());
      }
      // this extra addition to argv is accounted for as we are skipping the first entry in
      argv[argc++]=strdup("-w"); // finally, turn off warnings.
  } else {
  // add include paths for input files
  for (di.toFirst();di.current();++di,++argc)
  {
    QCString inc = QCString("-I")+di.currentKey();
    argv[argc]=strdup(inc.data());
    //printf("argv[%d]=%s\n",argc,argv[argc]);
  }
  // add external include paths
  for (uint i=0;i<includePath.count();i++)
  {
    QCString inc = QCString("-I")+includePath.at(i);
    argv[argc++]=strdup(inc.data());
  }
  // user specified options
  for (uint i=0;i<clangOptions.count();i++)
  {
    argv[argc++]=strdup(clangOptions.at(i));
  }
  // extra options
  argv[argc++]=strdup("-ferror-limit=0");
  argv[argc++]=strdup("-x");

  // Since we can be presented with a .h file that can contain C/C++ or
  // Objective C code and we need to configure the parser before knowing this,
  // we use the source file to detected the language. Detection will fail if you
  // pass a bunch of .h files containing ObjC code, and no sources :-(
  SrcLangExt lang = getLanguageFromFileName(fileName);
  if (lang==SrcLangExt_ObjC || p->detectedLang!=ClangParser::Private::Detected_Cpp)
  {
    QCString fn = fileName;
    if (p->detectedLang==ClangParser::Private::Detected_Cpp && 
        (fn.right(4).lower()==".cpp" || fn.right(4).lower()==".cxx" ||
         fn.right(3).lower()==".cc" || fn.right(2).lower()==".c"))
    { // fall back to C/C++ once we see an extension that indicates this
      p->detectedLang = ClangParser::Private::Detected_Cpp;
    }
    else if (fn.right(3).lower()==".mm") // switch to Objective C++
    {
      p->detectedLang = ClangParser::Private::Detected_ObjCpp;
    }
    else if (fn.right(2).lower()==".m") // switch to Objective C
    {
      p->detectedLang = ClangParser::Private::Detected_ObjC;
    }
  }
  switch(p->detectedLang)
  {
    case ClangParser::Private::Detected_Cpp: 
      argv[argc++]=strdup("c++"); 
      break;
    case ClangParser::Private::Detected_ObjC: 
      argv[argc++]=strdup("objective-c"); 
      break;
    case ClangParser::Private::Detected_ObjCpp: 
      argv[argc++]=strdup("objective-c++"); 
//.........这里部分代码省略.........
开发者ID:bithium,项目名称:doxygen,代码行数:101,代码来源:clangparser.cpp

示例12: dir

Kfm::Kfm()
{
    pKfm = this;
    pHistory = new QStrList;
    
    kapp->setTopWidget( this );

    HTMLCache::load();
    
    pIconLoader = new KIconLoader();

    // We need this in KfmGui::KfmGui(), so moved it here. DF.
    QStrList* list = pIconLoader->getDirList();
    list->clear();
    QString tmp = kapp->kde_icondir().copy();
    list->append( tmp.data() );
    tmp = KApplication::localkdedir();
    tmp += "/share/icons";
    list->append( tmp.data() );

    KConfig *config = kapp->getConfig();
    QStrList dirList;
    config->setGroup("KDE Setup");
    config->readListEntry( "IconPath", dirList, ':' );

    for (const char *it=dirList.first(); it; it = dirList.next()) {
      QDir dir( it );

      if (dir.exists())
        list->append( it );
    }

    if ( KfmGui::rooticons )
    {
	kapp->enableSessionManagement( TRUE );
	kapp->setWmCommand( "" );
	
	connect( kapp, SIGNAL( saveYourself() ), this, SLOT( slotSave() ) );
	connect( kapp, SIGNAL( shutDown() ), this, SLOT( slotShutDown() ) );

        // Global configuration
	config->setGroup("KFM Misc Defaults");
        bAllowURLProps = config->readBoolEntry( "EnablePerURLProps", false );
        bTreeViewFollowMode = config->readBoolEntry( "TreeFollowsView", false);

	config->setGroup( "SM" );
	bool flag = config->hasKey( "URLs" );
	
	QStrList urlList;
	int n = config->readListEntry( "URLs", urlList );

	if ( !flag && KfmGui::rooticons == true )
	{
	    QString home = "file:";
	    home.detach();
	    home += QDir::homeDirPath().data();
	    KfmGui *m = new KfmGui( 0L, 0L, home.data() );
	    m->show();
	}

	if ( flag )
	{
	    int i;
	    for ( i = 1; i <= n; i++ )
	    {
		KfmGui *m = new KfmGui( 0L, 0L, urlList.at( i - 1 ) );
		m->readProperties(i);
		m->show();
	    }
	}
    }

    // Install HTTP Cookies
    {
        KConfig *config = kapp->getConfig();
        config->setGroup( "Browser Settings/HTTP" );
        
        bool cookiesEnabled = config->readBoolEntry( "Cookies", true );
        if ( cookiesEnabled)
        {
            cookiejar = new KCookieJar();
                            
            cookiejar->loadConfig( config );
                                    
            QString cookieFile = kapp->localkdedir().data();
            cookieFile += "/share/apps/kfm/cookies";
            cookiejar->loadCookies( cookieFile.data() );
        }
    }

    connect( &timer, SIGNAL( timeout() ), this, SLOT( slotTouch() ) );
    // Call every hour
    timer.start( 3600000 );
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:94,代码来源:kfmw.cpp

示例13: Callx

int Transmitter::Callx(QStrList host_list, int port, int prot)
{
	// Transmitter's initial
	init(prot);


	int sd = -1; // return value

	struct hostent *hostInfo = NULL;
	int adr_size = host_list . count();
	struct sockaddr_in *ip_list= new sockaddr_in[adr_size];
	

	for(int i = 0 ; i < adr_size ; i++){
		debug("Transmitter callx -  ip %d - %s",i , host_list.at(i));

		hostInfo = ::gethostbyname( host_list.at(i) );
		if(hostInfo == NULL)
			throw Error(tr("can't resolve ") + host_list.at(i));

		ip_list[i] . sin_family = hostInfo->h_addrtype;
		ip_list[i] . sin_port = htons(port);
		memcpy((char *) &ip_list[i] . sin_addr.s_addr,
				hostInfo->h_addr_list[0], hostInfo->h_length); 
	}

	int type = 0;
	
	switch(protocol)
	{
		case DRTA_UDP:
		case DRTA_TCP:
			throw Error("should not use callx");
			break;
		case DRTA_SCTP:
			type = SOCK_STREAM;
			break;
		case DRTA_SCTP_UDP:
			type = SOCK_SEQPACKET;
			break;
		default:
			throw Error("unknown protocol");
	}
	
	if ((sd = socket(AF_INET, type, IPPROTO_SCTP)) == -1)
		throw Error(tr("can't initalize socket (") + strerror(errno)+ tr(")"));

	SctpSocketHandler::SctpEnable(sd);
	SctpSocketHandler::SctpSetMaxStream(sd,5);
	SctpSocketHandler::SctpSetNoDelay(sd);

	SctpSocketHandler::SctpSetRtoMax(sd , 10000);
	SctpSocketHandler::SctpSetRtoMin(sd ,  1000);
	SctpSocketHandler::SctpTurnOnAllEvent(sd );

	if( protocol == DRTA_SCTP_UDP );
		SctpSocketHandler::SctpSetAutoClose(sd ,  true);
	
	if( ::sctp_connectx(sd , (struct sockaddr*) ip_list , adr_size ) < 0){
		debug("callx :: connnection refuse?"); 
		throw Error(strerror(errno));
	}
	
	//TODO : free IP_LIST
	delete ip_list;
	start(sd);
	
	initRecorder();
	
	return sd;
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:71,代码来源:Transmitter.cpp

示例14: process

  void process(const QObject * obj){
	if(obj != NULL){
	  QListViewItem * buf = __current;
	  __current = new QListViewItem(__current,obj->className(),QString(obj->name()));
	  __current->setPixmap(0,__pixgeom);
	  QMetaObject* _m = obj->metaObject();
	  QListViewItem * att = NULL;
	  if(_m != NULL){
		QString _superclass(_m->superClassName());
		if(!_superclass.isEmpty()){
		  att = new QListViewItem(__current,"Inherit",_superclass);
		  att->setPixmap(0,__pixattptr);
		  QMetaObject* _meta = _m->superClass();
		  QListViewItem * att4 = NULL;
		  while((_meta = _meta->superClass())!= NULL){
			att4 = new QListViewItem(att,att4,QString(_meta->className()));
			att4->setPixmap(0,__pixatt);
		  }
		}
		att = new QListViewItem(__current,att,"Priority",(obj->highPriority()?"High":"Normal"));
		att->setPixmap(0,__pixatt);
		att = new QListViewItem(__current,att,"Widget",(obj->isWidgetType()?"True":"False"));
		att->setPixmap(0,__pixatt);
		QStrList _slots = _m->slotNames(true);
		if(!_slots.isEmpty()){
		  att = new QListViewItem(__current,att,"Slots");
		  att->setPixmap(0,__pixtransf);
		  uint sl_size = _slots.count();
		  QListViewItem * att2 = NULL;
		  for(uint j = 0; j < sl_size; j++ ){
			att2 = new QListViewItem(att,att2,_slots.at(j));
			att2->setPixmap(0,__pixatt);
		  }
		}
		QStrList _signals = _m->signalNames(true);
		if(!_signals.isEmpty()){
		  att = new QListViewItem(__current,att,"Signals");
		  att->setPixmap(0,__pixtransf);
		  uint si_size = _signals.count();
		  QListViewItem * att2 = NULL;
		  for(uint j = 0; j < si_size; j++ ){
			att2 = new QListViewItem(att,att2,_signals.at(j));
			att2->setPixmap(0,__pixatt);
		  }
		}
		int numCInfo = _m->numClassInfo(true);
		if(numCInfo !=0){
		  att = new QListViewItem(__current,att,"ClassInfo","List<Info>["+QString::number(numCInfo)+']');
		  att->setPixmap(0,__pixtransf);
		  QListViewItem * att2 = NULL;
		  for(int j = 0; j < numCInfo; j++ ){
			const QClassInfo * _inf = _m->classInfo(j);
			if(_inf != NULL){
			  att2 = new QListViewItem(att,att2,QString(_inf->name),QString(_inf->value));
			  att2->setPixmap(0,__pixatt);
			}
		  }
		}
		QStrList _props = _m->propertyNames(true);
		if(!_props.isEmpty()){
		  att = new QListViewItem(__current,att,"Properties");
		  att->setPixmap(0,__pixtransf);
		  uint p_size = _props.count();
		  QListViewItem * att2 = NULL;
		  for(uint j = 0; j < p_size; j++ ){
			att2 = new QListViewItem(att,att2,_props.at(j));
			att2->setPixmap(0,__pixatt);
			
			QVariant val;
			QString propname(_props.at(j));
#if QT_VERSION >= 300
			const QMetaProperty*  prop = _m->property (j,true);
#else
			const QMetaProperty*  prop = _m->property (propname,true);
#endif
			QString proptype;
			if(prop){
			  proptype = prop->type();
			  att2->setText(2,proptype);
			  /*
			  QListViewItem * att3 = new QListViewItem(att2,"Writable",(prop->writable()?"True":"False"));
			  att3->setPixmap(0,__pixatt);
			  att3 = new QListViewItem(att2,att3,"Designable",(prop->designable()?"True":"False"));
			  att3->setPixmap(0,__pixatt);
			  */
			}
			
			val = obj->property(propname);
			
			if(!val.isValid())att2->setText(1,"Invalid");
			else if(prop->isEnumType()){
			  att2->setText(1,prop->valueToKey(val.toInt()));
			}
			else if(prop->isSetType()){
			  QStrList st = prop->valueToKeys(val.toInt());
			  QString t = st.at(0);
			  for(uint i= 1; i < st.count(); i++)t+='/'+st.at(i);
			  att2->setText(1,t);
			}
			else if(val.type() == QVariant::String)att2->setText(1,'"'+val.toString()+'"');
//.........这里部分代码省略.........
开发者ID:kkremitzki,项目名称:plantgl,代码行数:101,代码来源:qobjectbrowser.cpp

示例15: start

void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit)
{
  static bool clangAssistedParsing = Config_getBool("CLANG_ASSISTED_PARSING");
  static QStrList &includePath = Config_getList("INCLUDE_PATH");
  static QStrList clangOptions = Config_getList("CLANG_OPTIONS");
  if (!clangAssistedParsing) return;
  //printf("ClangParser::start(%s)\n",fileName);
  p->fileName = fileName;
  p->index    = clang_createIndex(0, 0);
  p->curLine  = 1;
  p->curToken = 0;
  char **argv = (char**)malloc(sizeof(char*)*(4+Doxygen::inputPaths.count()+includePath.count()+clangOptions.count()));
  QDictIterator<void> di(Doxygen::inputPaths);
  int argc=0;
  // add include paths for input files
  for (di.toFirst();di.current();++di,++argc)
  {
    QCString inc = QCString("-I")+di.currentKey();
    argv[argc]=strdup(inc.data());
    //printf("argv[%d]=%s\n",argc,argv[argc]);
  }
  // add external include paths
  for (uint i=0;i<includePath.count();i++)
  {
    QCString inc = QCString("-I")+includePath.at(i);
    argv[argc++]=strdup(inc.data());
  }
  // user specified options
  for (uint i=0;i<clangOptions.count();i++)
  {
    argv[argc++]=strdup(clangOptions.at(i));
  }
  // extra options
  argv[argc++]=strdup("-ferror-limit=0");
  argv[argc++]=strdup("-x");

  // Since we can be presented with a .h file that can contain C/C++ or
  // Objective C code and we need to configure the parser before knowing this,
  // we use the source file to detected the language. Detection will fail if you
  // pass a bunch of .h files containing ObjC code, and no sources :-(
  SrcLangExt lang = getLanguageFromFileName(fileName);
  if (lang==SrcLangExt_ObjC || p->detectedLang!=ClangParser::Private::Detected_Cpp)
  {
    QCString fn = fileName;
    if (p->detectedLang==ClangParser::Private::Detected_Cpp && 
        (fn.right(4).lower()==".cpp" || fn.right(4).lower()==".cxx" ||
         fn.right(3).lower()==".cc" || fn.right(2).lower()==".c"))
    { // fall back to C/C++ once we see an extension that indicates this
      p->detectedLang = ClangParser::Private::Detected_Cpp;
    }
    else if (fn.right(3).lower()==".mm") // switch to Objective C++
    {
      p->detectedLang = ClangParser::Private::Detected_ObjCpp;
    }
    else if (fn.right(2).lower()==".m") // switch to Objective C
    {
      p->detectedLang = ClangParser::Private::Detected_ObjC;
    }
  }
  switch(p->detectedLang)
  {
    case ClangParser::Private::Detected_Cpp: 
      argv[argc++]=strdup("c++"); 
      break;
    case ClangParser::Private::Detected_ObjC: 
      argv[argc++]=strdup("objective-c"); 
      break;
    case ClangParser::Private::Detected_ObjCpp: 
      argv[argc++]=strdup("objective-c++"); 
      break;
  }

  // provide the input and and its dependencies as unsaved files so we can
  // pass the filtered versions
  argv[argc++]=strdup(fileName);
  static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES");
  //printf("source %s ----------\n%s\n-------------\n\n",
  //    fileName,p->source.data());
  uint numUnsavedFiles = filesInTranslationUnit.count()+1;
  p->numFiles = numUnsavedFiles;
  p->sources = new QCString[numUnsavedFiles];
  p->ufs     = new CXUnsavedFile[numUnsavedFiles];
  p->sources[0]      = detab(fileToString(fileName,filterSourceFiles,TRUE));
  p->ufs[0].Filename = strdup(fileName);
  p->ufs[0].Contents = p->sources[0].data();
  p->ufs[0].Length   = p->sources[0].length();
  QStrListIterator it(filesInTranslationUnit);
  uint i=1;
  for (it.toFirst();it.current() && i<numUnsavedFiles;++it,i++)
  {
    p->fileMapping.insert(it.current(),new uint(i));
    p->sources[i]      = detab(fileToString(it.current(),filterSourceFiles,TRUE));
    p->ufs[i].Filename = strdup(it.current());
    p->ufs[i].Contents = p->sources[i].data();
    p->ufs[i].Length   = p->sources[i].length();
  }

  // let libclang do the actual parsing
  p->tu = clang_parseTranslationUnit(p->index, 0,
                                     argv, argc, p->ufs, numUnsavedFiles, 
//.........这里部分代码省略.........
开发者ID:Acidburn0zzz,项目名称:doxygen,代码行数:101,代码来源:clangparser.cpp


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