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


C++ QStringList::fromLast方法代码示例

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


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

示例1: createRecentMenuItems

// create and fill "recent" section at first
void PanelKMenu::createRecentMenuItems()
{
    RecentlyLaunchedApps::self().init();
    RecentlyLaunchedApps::self().m_nNumMenuItems = 0;

    QStringList RecentApps;
    RecentlyLaunchedApps::self().getRecentApps(RecentApps);

    if (RecentApps.count() > 0)
    {
        bool bSeparator = KickerSettings::showMenuTitles();
        int nId = serviceMenuEndId() + 1;
        int nIndex = KickerSettings::showMenuTitles() ? 1 : 0;

        for (QList<QString>::iterator it =
             RecentApps.fromLast(); /*nop*/; --it)
        {
            KService::Ptr s = KService::serviceByDesktopPath(*it);
            if (!s)
            {
                RecentlyLaunchedApps::self().removeItem(*it);
            }
            else
            {
                if (bSeparator)
                {
                    bSeparator = false;
                    /*
                     FIXME: no more titles!
                    int id = insertTitle(
                        RecentlyLaunchedApps::self().caption(),
                        serviceMenuEndId(), 0);
                    setItemEnabled( id, false );
                    */
                    addSeparator();
                }
                insertMenuItem(s, nId++, nIndex);
                RecentlyLaunchedApps::self().m_nNumMenuItems++;
            }

            if (it == RecentApps.begin())
            {
                break;
            }
        }

        if (!KickerSettings::showMenuTitles())
        {
            insertSeparator(RecentlyLaunchedApps::self().m_nNumMenuItems);
        }
    }
}
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:53,代码来源:k_mnu.cpp

示例2: searchPath

void QSettingsSysPrivate::searchPath( HKEY &scope, QString &path, REGSAM access, bool global, bool readonly )
{
    const HKEY scopes[ 2 ] = {
                                 HKEY_CURRENT_USER,
                                 HKEY_LOCAL_MACHINE
                             };

    for ( QStringList::Iterator it = searchPaths.fromLast(); it != searchPaths.end(); --it ) {
        QString search_key;
        HKEY res_key;
        if ( ( *it ).length() )
            search_key = "Software\\" + ( *it );
        if ( path.length() )
            search_key += "\\" + path;
        search_key = search_key.replace( QRegExp( "(\\\\)+" ), "\\" );
        /* Now try to open this key */
        int i = global ? 1 : 0;
        for ( i ; i < 2; i++ ) {
            long ret;
            if ( readonly )
                ret = QT_WA_INLINE(
                          RegOpenKeyExW( scopes[ i ], ( LPCTSTR ) search_key.ucs2(),
                                         0, access, &res_key ),
                          RegOpenKeyExA( scopes[ i ], ( LPCSTR ) search_key.latin1(),
                                         0, access, &res_key ) );
            else
                ret = QT_WA_INLINE(
                          RegCreateKeyExW( scopes[ i ], ( LPCTSTR ) search_key.ucs2(), 0,
                                           NULL, REG_OPTION_NON_VOLATILE, access, NULL,
                                           &res_key , NULL ),
                          RegCreateKeyExA( scopes[ i ], ( LPCSTR ) search_key.latin1(), 0,
                                           NULL, REG_OPTION_NON_VOLATILE, access, NULL,
                                           &res_key , NULL ) );
            /* key found :) */
            if ( ret == ERROR_SUCCESS ) {
                RegCloseKey( res_key );
                scope = scopes[ i ];
                path = search_key;
                return ;
            }
        }
    }
    /* No key found -> use first path */
    scope = global ? scopes[ 1 ] : scopes[ 0 ];
    QString new_path = searchPaths.last();
    if ( new_path.length() && path.length() )
        new_path += "\\";
    new_path += path;
    while ( new_path[ 0 ] == '\\' )
        new_path.remove( 0, 1 );
    path = new_path;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:52,代码来源:qsettings_win.cpp

示例3: add

void KRecentDirs::add(const QString &fileClass, const QString &directory)
{
   QString key = fileClass;
   QStringList result;
   KConfig *config = recentdirs_readList(key, result, false);
   // make sure the dir is first in history
   result.remove(directory);
   result.prepend(directory);
   while(result.count() > MAX_DIR_HISTORY)
      result.remove(result.fromLast());
   config->writePathEntry(key, result);
   recentdirs_done(config);
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例4: setObjectProperty


//.........这里部分代码省略.........
	    v.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "" ) );
	    v.append( QString( externPixmaps ? "\"" : "" ) + " )" );
	}
    } else if ( e.tagName() == "iconset" ) {
	v = "QIconSet( %1 )";
	QString s = e.firstChild().toText().data();
	if ( !pixmapLoaderFunction.isEmpty() ) {
	    s.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "" ) );
	    s.append( QString( externPixmaps ? "\"" : "" ) + " )" );
	}
	v = v.arg( s );
    } else if ( e.tagName() == "image" ) {
	v = e.firstChild().toText().data() + ".convertToImage()";
    } else if ( e.tagName() == "enum" ) {
	if ( stdset )
	    v = "%1::%2";
	else
	    v = "\"%1\"";
	QString oc = objClass;
	QString ev = e.firstChild().toText().data();
	if ( oc == "QListView" && ev == "Manual" ) // #### workaround, rename QListView::Manual in 4.0
	    oc = "QScrollView";
	if ( stdset )
	    v = v.arg( oc ).arg( ev );
	else
	    v = v.arg( ev );
    } else if ( e.tagName() == "set" ) {
	QString keys( e.firstChild().toText().data() );
	QStringList lst = QStringList::split( '|', keys );
	v = "int( ";
	QStringList::Iterator it = lst.begin();
	while ( it != lst.end() ) {
	    v += objClass + "::" + *it;
	    if ( it != lst.fromLast() )
		v += " | ";
	    ++it;
	}
	v += " )";
    } else if ( e.tagName() == "sizepolicy" ) {
	QDomElement n3 = e.firstChild().toElement();
	QSizePolicy sp;
	while ( !n3.isNull() ) {
	    if ( n3.tagName() == "hsizetype" )
		sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
	    else if ( n3.tagName() == "vsizetype" )
		sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
	    else if ( n3.tagName() == "horstretch" )
		sp.setHorStretch( n3.firstChild().toText().data().toInt() );
	    else if ( n3.tagName() == "verstretch" )
		sp.setVerStretch( n3.firstChild().toText().data().toInt() );
	    n3 = n3.nextSibling().toElement();
	}
	QString tmp;
	if ( !obj.isEmpty() )
	    tmp = obj + "->";
	v = "QSizePolicy( (QSizePolicy::SizeType)%1, (QSizePolicy::SizeType)%2, %3, %4, " + tmp + "sizePolicy().hasHeightForWidth() )";
	v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() );
    } else if ( e.tagName() == "palette" ) {
	QPalette pal;
	bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0;
	QDomElement n;
	if ( no_pixmaps ) {
	    n = e.firstChild().toElement();
	    while ( !n.isNull() ) {
		QColorGroup cg;
		if ( n.tagName() == "active" ) {
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:67,代码来源:object.cpp

示例5: parse


//.........这里部分代码省略.........
		 matchString(&text) ) {
		com = "";
		if ( match(Tok_RightParen) ||
		     (match(Tok_Comma) &&
		      matchString(&com) &&
		      (match(Tok_RightParen) ||
		       match(Tok_Comma) &&
		       matchEncoding(&utf8) &&
		       match(Tok_RightParen))) )
		    tor->insert( MetaTranslatorMessage(context, text, com,
						       QString::null, utf8) );
	    }
	    break;
	case Tok_Q_OBJECT:
	    missing_Q_OBJECT = FALSE;
	    yyTok = getToken();
	    break;
	case Tok_Ident:
	    if ( !prefix.isNull() )
		prefix += "::";
	    prefix += yyIdent;
	    yyTok = getToken();
	    if ( yyTok != Tok_Gulbrandsen )
		prefix = (const char *) 0;
	    break;
	case Tok_Comment:
	    com = yyComment;
	    com = com.simplifyWhiteSpace();
	    if ( com.left(sizeof(MagicComment) - 1) == MagicComment ) {
		com.remove( 0, sizeof(MagicComment) - 1 );
		int k = com.find( ' ' );
		if ( k == -1 ) {
		    context = com;
		} else {
		    context = com.left( k );
		    com.remove( 0, k + 1 );
		    tor->insert( MetaTranslatorMessage(context, "", com,
						       QString::null, FALSE) );
		}

		/*
		  Provide a backdoor for people using "using
		  namespace". See the manual for details.
		*/
		k = 0;
		while ( (k = context.find("::", k)) != -1 ) {
		    qualifiedContexts.insert( context.mid(k + 2), context );
		    k++;
		}
	    }
	    yyTok = getToken();
	    break;
	case Tok_Arrow:
	    yyTok = getToken();
	    if ( yyTok == Tok_tr || yyTok == Tok_trUtf8 )
		qWarning( "%s:%d: Cannot invoke tr() like this",
			  (const char *) yyFileName, yyLineNo );
	    break;
	case Tok_Gulbrandsen:
	    // at top level?
	    if ( yyBraceDepth == (int) namespaces.count() && yyParenDepth == 0 )
		functionContext = prefix;
	    yyTok = getToken();
	    break;
	case Tok_RightBrace:
	case Tok_Semicolon:
	    if ( yyBraceDepth >= 0 &&
		 yyBraceDepth + 1 == (int) namespaces.count() )
		namespaces.remove( namespaces.fromLast() );
	    if ( yyBraceDepth == (int) namespaces.count() ) {
		if ( missing_Q_OBJECT ) {
		    if ( needs_Q_OBJECT.contains(functionContext) ) {
			qWarning( "%s:%d: Class '%s' lacks Q_OBJECT macro",
				  (const char *) yyFileName, yyLineNo,
				  (const char *) functionContext );
		    } else {
			lacks_Q_OBJECT.insert( functionContext, 0 );
		    }
		}
		functionContext = defaultContext;
		missing_Q_OBJECT = FALSE;
	    }
	    yyTok = getToken();
	    break;
	default:
	    yyTok = getToken();
	}
    }

    if ( yyBraceDepth != 0 )
	fprintf( stderr,
		 "%s:%d: Unbalanced braces in C++ code (or abuse of the C++"
		  " preprocessor)\n",
		  (const char *)yyFileName, yyBraceLineNo );
    else if ( yyParenDepth != 0 )
	fprintf( stderr,
		 "%s:%d: Unbalanced parentheses in C++ code (or abuse of the C++"
		 " preprocessor)\n",
		 (const char *)yyFileName, yyParenLineNo );
}
开发者ID:opieproject,项目名称:opie,代码行数:101,代码来源:fetchtr.cpp

示例6: updateRecent

void PanelKMenu::updateRecent()
{
    if (!RecentlyLaunchedApps::self().m_bNeedToUpdate)
    {
        return;
    }

    RecentlyLaunchedApps::self().m_bNeedToUpdate = false;

    int nId = serviceMenuEndId() + 1;

    // remove previous items
    if (RecentlyLaunchedApps::self().m_nNumMenuItems > 0)
    {
        // -1 --> menu title
        int i = KickerSettings::showMenuTitles() ? -1 : 0;
        for (; i < RecentlyLaunchedApps::self().m_nNumMenuItems; i++)
        {
            removeItem(nId + i);
            entryMap_.remove(nId + i);
        }
        RecentlyLaunchedApps::self().m_nNumMenuItems = 0;

        if (!KickerSettings::showMenuTitles())
        {
            removeItemAt(0);
        }
    }

    // insert new items
    QStringList RecentApps;
    RecentlyLaunchedApps::self().getRecentApps(RecentApps);

    if (RecentApps.count() > 0)
    {
        bool bNeedSeparator = KickerSettings::showMenuTitles();
        for (QList<QString>::iterator it = RecentApps.fromLast();
             /*nop*/; --it)
        {
            KService::Ptr s = KService::serviceByDesktopPath(*it);
            if (!s)
            {
                RecentlyLaunchedApps::self().removeItem(*it);
            }
            else
            {
                if (bNeedSeparator)
                {
                    bNeedSeparator = false;
                    addSeparator();
                    /* FIXME: no more titles!
                    int id = insertTitle(
                        RecentlyLaunchedApps::self().caption(),
                        nId - 1, 0);
                    setItemEnabled( id, false );
                    */
                }
                insertMenuItem(s, nId++, KickerSettings::showMenuTitles() ?
                    1 : 0);
                RecentlyLaunchedApps::self().m_nNumMenuItems++;
            }

            if (it == RecentApps.begin())
                break;
        }

        if (!KickerSettings::showMenuTitles())
        {
            insertSeparator(RecentlyLaunchedApps::self().m_nNumMenuItems);
        }
    }
}
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:72,代码来源:k_mnu.cpp

示例7: createGUI

/**
 * Create the amarok gui from the xml file.
 */
void PlaylistWindow::createGUI()
{
    setUpdatesEnabled( false );

    m_toolbar->clear();

    //KActions don't unplug themselves when the widget that is plugged is deleted!
    //we need to unplug to detect if the menu is plugged in App::applySettings()
    //TODO report to bugs.kde.org
    //we unplug after clear as otherwise it crashes! dunno why..
     KActionPtrList actions = actionCollection()->actions();
     for( KActionPtrList::Iterator it = actions.begin(), end = actions.end(); it != end; ++it )
     {
         (*it)->unplug( m_toolbar );
     }

    KXMLGUIBuilder builder( this );
    KXMLGUIFactory factory( &builder, this );

    //build Toolbar, plug actions
    factory.addClient( this );

    //TEXT ON RIGHT HACK
    //KToolBarButtons have independent settings for their appearance.
    //KToolBarButton::modeChange() causes that button to set its mode to that of its parent KToolBar
    //KToolBar::setIconText() calls modeChange() for children, unless 2nd param is false

    QStringList list;
    list << "toolbutton_playlist_add"
//         << "toolbutton_playlist_clear"
//         << "toolbutton_playlist_shuffle"
//         << "toolbutton_playlist_show"
         << "toolbutton_burn_menu"
         << "toolbutton_amarok_menu";

    m_toolbar->setIconText( KToolBar::IconTextRight, false ); //we want some buttons to have text on right

    const QStringList::ConstIterator end  = list.constEnd();
    const QStringList::ConstIterator last = list.fromLast();
    for( QStringList::ConstIterator it = list.constBegin(); it != end; ++it )
    {
        KToolBarButton* const button = static_cast<KToolBarButton*>( m_toolbar->child( (*it).latin1() ) );

        if ( it == last ) {
            //if the user has no PlayerWindow, he MUST have the menu action plugged
            //NOTE this is not saved to the local XMLFile, which is what the user will want
            if ( !AmarokConfig::showPlayerWindow() && !AmarokConfig::showMenuBar() && !button )
                actionCollection()->action( "amarok_menu" )->plug( m_toolbar );
        }

        if ( button ) {
            button->modeChange();
            button->setFocusPolicy( QWidget::NoFocus );
        }
    }

    if ( AmarokConfig::showMenuBar() ) {
        if ( actionCollection()->action( "amarok_menu" )->isPlugged() )
            actionCollection()->action( "amarok_menu" )->unplugAll();
    }

    m_toolbar->setIconText( KToolBar::IconOnly, false ); //default appearance
    conserveMemory();
    setUpdatesEnabled( true );
}
开发者ID:tmarques,项目名称:waheela,代码行数:68,代码来源:playlistwindow.cpp

示例8: parseConfigFiles

bool KConfigINIBackEnd::parseConfigFiles()
{
    // Check if we can write to the local file.
    mConfigState = KConfigBase::ReadOnly;
    if(!mLocalFileName.isEmpty() && !pConfig->isReadOnly())
    {
        if(checkAccess(mLocalFileName, W_OK))
        {
            mConfigState = KConfigBase::ReadWrite;
        }
        else
        {
            // Create the containing dir, maybe it wasn't there
            KURL path;
            path.setPath(mLocalFileName);
            QString dir = path.directory();
            KStandardDirs::makeDir(dir);

            if(checkAccess(mLocalFileName, W_OK))
            {
                mConfigState = KConfigBase::ReadWrite;
            }
        }
        QFileInfo info(mLocalFileName);
        d->localLastModified = info.lastModified();
        d->localLastSize = info.size();
    }

    // Parse all desired files from the least to the most specific.
    bFileImmutable = false;

    // Parse the general config files
    if(useKDEGlobals)
    {
        QStringList kdercs = KGlobal::dirs()->findAllResources("config", QString::fromLatin1("kdeglobals"));

        QString etc_kderc = QString::fromLatin1("/etc/kderc");

        if(checkAccess(etc_kderc, R_OK))
            kdercs += etc_kderc;

        kdercs += KGlobal::dirs()->findAllResources("config", QString::fromLatin1("system.kdeglobals"));

        QStringList::ConstIterator it;

        for(it = kdercs.fromLast(); it != kdercs.end(); --it)
        {

            QFile aConfigFile(*it);
            if(!aConfigFile.open(IO_ReadOnly))
                continue;
            parseSingleConfigFile(aConfigFile, 0L, true, (*it != mGlobalFileName));
            aConfigFile.close();
            if(bFileImmutable)
                break;
        }
    }

    bool bReadFile = !mfileName.isEmpty();
    while(bReadFile)
    {
        bReadFile = false;
        QString bootLanguage;
        if(useKDEGlobals && localeString.isEmpty() && !KGlobal::_locale)
        {
            // Boot strap language
            bootLanguage = KLocale::_initLanguage(pConfig);
            setLocaleString(bootLanguage.utf8());
        }

        bFileImmutable = false;
        QStringList list;
        if(!QDir::isRelativePath(mfileName))
            list << mfileName;
        else
            list = KGlobal::dirs()->findAllResources(resType, mfileName);

        QStringList::ConstIterator it;

        for(it = list.fromLast(); it != list.end(); --it)
        {

            QFile aConfigFile(*it);
            // we can already be sure that this file exists
            bool bIsLocal = (*it == mLocalFileName);
            if(aConfigFile.open(IO_ReadOnly))
            {
                parseSingleConfigFile(aConfigFile, 0L, false, !bIsLocal);
                aConfigFile.close();
                if(bFileImmutable)
                    break;
            }
        }
        if(KGlobal::dirs()->isRestrictedResource(resType, mfileName))
            bFileImmutable = true;
        QString currentLanguage;
        if(!bootLanguage.isEmpty())
        {
            currentLanguage = KLocale::_initLanguage(pConfig);
            // If the file changed the language, we need to read the file again
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:101,代码来源:kconfigbackend.cpp

示例9: callTips

// Return the call tip for a function.
QStringList QsciAPIs::callTips(const QStringList &context, int commas,
        QsciScintilla::CallTipsStyle style,
        QValueList<int> &shifts)
{
    QString path;
    QStringList new_context = positionOrigin(context, path);
    QStringList wseps = lexer()->autoCompletionWordSeparators();
    QStringList cts;

    if (origin_len > 0)
    {
        QStringList::const_iterator it = origin;
        QString prev;

        // Work out the length of the context.
        const QString &wsep = wseps.first();
        QStringList strip = QStringList::split(wsep, path);
        strip.remove(strip.fromLast());
        int ctstart = strip.join(wsep).length();

        if (ctstart)
            ctstart += wsep.length();

        int shift;

        if (style == QsciScintilla::CallTipsContext)
        {
            shift = ctstart;
            ctstart = 0;
        }
        else
            shift = 0;

        // Make sure we only look at the functions we are interested in.
        path.append('(');

        while (it != prep->raw_apis.end() && (*it).startsWith(path))
        {
            QString w = (*it).mid(ctstart);

            if (w != prev && enoughCommas(w, commas))
            {
                shifts << shift;
                cts << w;
                prev = w;
            }

            ++it;
        }
    }
    else
    {
        const QString &fname = new_context[new_context.count() - 2];

        // Find everywhere the function name appears in the APIs.
        const WordIndexList *wil = wordIndexOf(fname);

        if (wil)
            for (int i = 0; i < wil->count(); ++i)
            {
                const WordIndex &wi = (*wil)[i];
                QStringList awords = prep->apiWords(wi.first, wseps, true);

                // Check the word is the function name and not part of any
                // context.
                if (wi.second != awords.count() - 1)
                    continue;

                const QString &api = prep->raw_apis[wi.first];

                int tail = api.find('(');

                if (tail < 0)
                    continue;

                if (!enoughCommas(api, commas))
                    continue;

                if (style == QsciScintilla::CallTipsNoContext)
                {
                    shifts << 0;
                    cts << (fname + api.mid(tail));
                }
                else
                {
                    shifts << tail - fname.length();
                    cts << api;
                }
            }
    }

    return cts;
}
开发者ID:fusigi0930,项目名称:qnotepad-pp,代码行数:94,代码来源:qsciapis.cpp

示例10: declaration


//.........这里部分代码省略.........
	    out << "typedef " << *it << ";" << endl;
    }

    nl = e.parentNode().toElement().elementsByTagName( "forward" );
    for ( i = 0; i < (int) nl.length(); i++ )
	forwardDecl2 << nl.item(i).toElement().firstChild().toText().data();

    nl = e.parentNode().toElement().elementsByTagName( "include" );
    for ( i = 0; i < (int) nl.length(); i++ ) {
	QDomElement n2 = nl.item(i).toElement();
	QString s = n2.firstChild().toText().data();
	if ( n2.attribute( "impldecl", "in implementation" ) == "in declaration" &&
	     n2.attribute( "location" ) != "local" )
	    globalIncludes += s;
    }
    for ( i = 0; i < (int) nl.length(); i++ ) {
	QDomElement n2 = nl.item(i).toElement();
	QString s = n2.firstChild().toText().data();
	if ( n2.attribute( "impldecl", "in implementation" ) == "in declaration" &&
	     n2.attribute( "location" ) == "local" &&!globalIncludes.contains( s ) )
	    localIncludes += s;
    }
    nl = e.parentNode().toElement().elementsByTagName( "exportmacro" );
    if ( nl.length() == 1 )
	exportMacro = nl.item( 0 ).firstChild().toText().data();

    forwardDecl = unique( forwardDecl );
    for ( it = forwardDecl.begin(); it != forwardDecl.end(); ++it ) {
	if ( !(*it).isEmpty() && (*it) != objClass ) {
	    QString forwardName = *it;
	    QStringList forwardNamespaces = QStringList::split( "::",
								forwardName );
	    forwardName = forwardNamespaces.last();
	    forwardNamespaces.remove( forwardNamespaces.fromLast() );

	    QStringList::ConstIterator ns = forwardNamespaces.begin();
	    while ( ns != forwardNamespaces.end() ) {
		out << "namespace " << *ns << " {" << endl;
		++ns;
	    }
	    out << "class " << forwardName << ";" << endl;
	    for ( int i = 0; i < (int) forwardNamespaces.count(); i++ )
		out << "}" << endl;
	}
    }

    for ( it = forwardDecl2.begin(); it != forwardDecl2.end(); ++it ) {
	QString fd = *it;
	fd = fd.stripWhiteSpace();
	if ( !fd.endsWith( ";" ) )
	    fd += ";";
	out << fd << endl;
    }

    out << endl;

    QStringList::ConstIterator ns = namespaces.begin();
    while ( ns != namespaces.end() ) {
	out << "namespace " << *ns << " {" << endl;
	++ns;
    }

    out << "class ";
    if ( !exportMacro.isEmpty() )
	out << exportMacro << " ";
    out << bareNameOfClass << " : public " << objClass << endl << "{" << endl;
开发者ID:OS2World,项目名称:LIB-QT3_Toolkit_Vbox,代码行数:67,代码来源:form.cpp

示例11: loadFeatures


//.........这里部分代码省略.........
	}

	int colon = line.find(':');
	if ( colon < 0 ) {
	    qDebug("Cannot parse: %s",line.ascii());
	} else {
	    QString tag = line.left(colon);
	    QString value = line.mid(colon+1).stripWhiteSpace();
	    if ( tag == "Feature" )
		feature = value;
	    else if ( tag == "Requires" )
		deps = QStringList::split(QChar(' '),value);
	    else if ( tag == "Name" )
		lab = value;
	    else if ( tag == "Section" )
		sec = value;
	    else if ( tag == "SeeAlso" )
		seealso = QStringList::split(QChar(' '),value);
	}

	line = nextline;
    }
    sections = keys(sectioncontents);

#else
    QString sec;
    QString lab;
    QString doc;
    bool on = FALSE;
    bool docmode = FALSE;
    QStringList deps;

    do {
	QString line = s.readLine();
	line.replace(QRegExp("# *define"),"#define");

	QStringList token = QStringList::split(QChar(' '),line);
	if ( on ) {
	    if ( docmode ) {
		if ( token[0] == "*/" )
		    docmode = FALSE;
		else if ( lab.isEmpty() )
		    lab = line.stripWhiteSpace();
		else
		    doc += line.simplifyWhiteSpace() + "\n";
	    } else if ( token[0] == "//#define" || token[0] == "#define" ) {
		dependencies[token[1]] = deps;
		for (QStringList::ConstIterator it = deps.begin(); it!=deps.end(); ++it)
		    rdependencies[*it].append(token[1]);
		section[token[1]] = sec;
		documentation[token[1]] = doc;
		label[token[1]] = lab;
		choices.append(token[1]);
		doc = "";
		lab = "";
	    } else if ( token[0] == "/*!" ) {
		docmode = TRUE;
	    } else if ( token[0] == "//" ) {
		token.remove(token.begin());
		sec = token.join(" ");
		sections.append(sec);
	    } else if ( token[0] == "#if" ) {
		Q_ASSERT(deps.isEmpty());
		for (int i=1; i<(int)token.count(); i++) {
		    if ( token[i][0] == 'd' ) {
			int index;
			int len;
			index = qt_no_xxx.match(token[i],0,&len);
			if ( index >= 0 ) {
			    QString d = token[i].mid(index,len);
			    deps.append(d);
			}
		    }
		}
	    } else if ( token[0] == "#endif" ) {
		deps.clear();
	    } else if ( token[0].isEmpty() ) {
	    } else {
		qDebug("Cannot parse: %s",token.join(" ").ascii());
	    }
	} else if ( token[0] == "#include" ) {
	    on = TRUE;
	}
    } while (!s.atEnd());
#endif

    lv->clear();
    sections.sort();
    // ##### QListView default sort order is reverse of insertion order
    for (QStringList::Iterator se = sections.fromLast(); se != sections.end(); --se) {
	sectionitem[*se] = new QListViewItem(lv,*se);
    }
    for (QStringList::Iterator ch = choices.begin(); ch != choices.end(); ++ch) {
	createItem(*ch);
    }

#ifdef FIXED_LAYOUT
    lv->setFixedWidth(lv->sizeHint().width());
#endif
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:101,代码来源:main.cpp

示例12: parse

static void parse( MetaTranslator *tor, const char *initialContext,
                   const char *defaultContext )
{
    QMap<QCString, QCString> qualifiedContexts;
    QStringList namespaces;
    QCString context;
    QCString ext;
    QCString text;
    QCString comment;
    QCString functionContext = initialContext;
    QCString prefix;
    bool utf8 = FALSE;

    yyTok = getToken();
    while ( yyTok != Tok_Eof ) {
        switch ( yyTok ) {
            case Tok_i18n:
                utf8 = FALSE;
                yyTok = getToken();
                if ( match( Tok_LeftParen ) &&
                     ( matchString( &context ) || matchSString( &context ) ) &&
                     match( Tok_Comma ) &&
                     ( matchString( &text ) || matchSString( &text ) ) )
                {
                    if ( ( match( Tok_Comma ) &&
                           ( matchString( &comment ) || matchSString( &comment ) ) &&
                           match( Tok_RightParen ) ) == false )
                    {
                        comment = "";
                    }
                    tor->insert( MetaTranslatorMessage( context, text, comment, QString::null, utf8 ) );
                }
//                 else
//                     qDebug( " --- token failed ------------" );
                break;
            case Tok_x18n:
                utf8 = FALSE;
                yyTok = getToken();
                if ( match( Tok_LeftParen ) &&
                     ( matchString( &ext ) || matchSString( &ext ) ) &&
                     match( Tok_Comma ) &&
                     ( matchString( &context ) || matchSString( &context ) ) &&
                     match( Tok_Comma ) &&
                     ( matchString( &text ) || matchSString( &text ) ) )
                {
                    if ( ( match( Tok_Comma ) &&
                           ( matchString( &comment ) || matchSString( &comment ) ) &&
                           match( Tok_RightParen ) ) == false )
                    {
                        comment = "";
                    }
                    tor->insert( MetaTranslatorMessage( context, text, comment, QString::null, utf8 ) );
                }
//                 else
//                     qDebug( " --- token failed ------------" );
                break;
            case Tok_Ident:
                if ( !prefix.isNull() )
                    prefix += "::";
                prefix += yyIdent;
                yyTok = getToken();
                if ( yyTok != Tok_Gulbrandsen )
                    prefix = (const char *) 0;
                break;
            case Tok_Comment:
                comment = yyComment;
                comment = comment.simplifyWhiteSpace();
                yyTok = getToken();
                break;
            case Tok_Gulbrandsen:
                // at top level?
                if ( yyBraceDepth == (int) namespaces.count() && yyParenDepth == 0 )
                    functionContext = prefix;
                yyTok = getToken();
                break;
            case Tok_RightBrace:
            case Tok_Semicolon:
                if ( yyBraceDepth >= 0 &&
                     yyBraceDepth + 1 == (int) namespaces.count() )
                    namespaces.remove( namespaces.fromLast() );
                if ( yyBraceDepth == (int) namespaces.count() ) {
                    functionContext = defaultContext;
                }
                yyTok = getToken();
                break;
            default:
                yyTok = getToken();
        }
    }

//     if ( yyBraceDepth != 0 )
//         qWarning( "%s: Unbalanced braces in PHP code", (const char *) yyFileName );
//     if ( yyParenDepth != 0 )
//         qWarning( "%s: Unbalanced parentheses in PHP code", (const char *) yyFileName );
}
开发者ID:aurelienRT1,项目名称:ezpublish,代码行数:95,代码来源:fetchtr_php.cpp

示例13: defined

// copy current artcle for back compatible use only
// for new coder please use getArticle
static PyObject *qterm_copyArticle(PyObject *, PyObject *args)
{
	long lp;
	if (!PyArg_ParseTuple(args, "l", &lp))
		return NULL;

	Window *pWin=(Window*)lp;

	QStringList strList;
	QString strArticle;
	while(1)
	{
		// check it there is duplicated string
		// it starts from the end in the range of one screen height
		// so this is a non-greedy match
		QString strTemp = pWin->stripWhitespace(
				pWin->m_pBuffer->screen(0)->getText());
		int i=0;
		int start=0;
		for(QStringList::Iterator it=strList.fromLast();
	it!=strList.begin(), i < pWin->m_pBuffer->line()-1; // not exceeeding the last screen
			--it, i++)
		{
			if(*it!=strTemp)
				continue;
			QStringList::Iterator it2 = it;
			bool dup=true;
			// match more to see if its duplicated
			for(int j=0; j<=i; j++, it2++)
			{
				QString str1 = pWin->stripWhitespace(
					pWin->m_pBuffer->screen(j)->getText());
				if(*it2!=str1)
				{
					dup = false;
					break;
				}
			}
			if(dup)
			{
				// set the start point
				start = i+1;
				break;
			}
		}
		// add new lines
		for(i=start;i<pWin->m_pBuffer->line()-1;i++)
			strList+=pWin->stripWhitespace(
			pWin->m_pBuffer->screen(i)->getText());

		// the end of article
		if( pWin->m_pBuffer->screen(
		pWin->m_pBuffer->line()-1)->getText().find("%") == -1 )
			break;
		// continue
		pWin->m_pTelnet->write(" ", 1);
		
		if(!pWin->m_wcWaiting.wait(10000))	// timeout
			break;
	}
	#if defined(_OS_WIN32_) || defined(Q_OS_WIN32)
	strArticle = strList.join("\r\n");
	#else
	strArticle = strList.join("\n");
	#endif
	
	PyObject *py_text = PyString_FromString(strArticle.toLocal8Bit);

	Py_INCREF(py_text);
	return py_text;
}
开发者ID:adaptee,项目名称:qterm-hack,代码行数:73,代码来源:qtermpython.cpp


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