Beispiel #1
0
void testDerivedClass()
{
    getStringList().first(); // Warning
    getStringList()[0]; // Warning
    getMultiMap().begin(); // Warning
    getMultiMap().insert(1, 1); // Warning
}
Beispiel #2
0
QStringList AmarokMediaPlayer::getPlayListTitles()
{
	kdebugf();
	// No API for titles list, only file names.
	return getStringList("playlist", "filenames");
	kdebugf2();
}
//----------------------------------------------------------------------------------------------------
CMouseEventResult UIViewCreatorDataSource::dbOnMouseDown (const CPoint& where, const CButtonState& buttons, int32_t row, int32_t column, CDataBrowser* browser)
{
	mouseDownRow = row;
	if (buttons.isLeftButton ())
	{
		if (!buttons.isDoubleClick ())
			return kMouseEventHandled;
		addViewToCurrentEditView ();
	}
	else if (buttons.isRightButton ())
	{
		const std::string& viewName = getStringList ()->at (static_cast<uint32_t> (mouseDownRow));
		std::string menuEntryName = "Add a new '" + viewName + "'";
		COptionMenu menu;
		menu.setStyle (kPopupStyle);
		menu.addEntry (menuEntryName.c_str ());
		CPoint menuLocation (where);
		browser->localToFrame (menuLocation);
		if (menu.popup (browser->getFrame (), menuLocation))
		{
			if (menu.getEntry (menu.getLastResult ()))
				addViewToCurrentEditView ();
		}
	}
	mouseDownRow = -1;
	return kMouseDownEventHandledButDontNeedMovedOrUpEvents;
}
Beispiel #4
0
/*!
  Builds and returns a list of file pathnames for the file
  type specified by \a filesVar (e.g. "headers" or "sources").
  The files are found in the directories specified by
  \a dirsVar, and they are filtered by \a defaultNameFilter
  if a better filter can't be constructed from \a filesVar.
  The directories in \a excludedDirs are avoided.
 */
QStringList Config::getAllFiles(const QString &filesVar,
                                const QString &dirsVar,
                                const QSet<QString> &excludedDirs)
{
    QStringList result = getStringList(filesVar);
    QStringList dirs = getStringList(dirsVar);

    QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS));

    QStringList::ConstIterator d = dirs.begin();
    while (d != dirs.end()) {
	result += getFilesHere(*d, nameFilter, excludedDirs);
	++d;
    }
    return result;
}
std::string MROMInstaller::setInstallLoc(const std::string& loc, bool &images)
{
	if(loc.compare(INTERNAL_MEM_LOC_TXT) == 0)
	{
		if(getIntValue("enable_internal"))
		{
			images = false;
			m_type = ROM_INSTALLER_INTERNAL;
			return std::string();
		}
		else
			return "ROM can't be installed to internal memory!";
	}
	else
	{
		size_t start = loc.find('(');
		size_t end = loc.find(')');
		if(start == std::string::npos || end == std::string::npos)
			return "Failed to get filesystem of target location";

		++start;
		std::string fs = loc.substr(start, end-start);

		// try to be dir first
		std::vector<std::string> supported;
		getStringList(supported, "usb_dir_fs");
		if(std::find(supported.begin(), supported.end(), fs) != supported.end())
		{
			images = false;
			m_type = ROM_INSTALLER_USB_DIR;
			return std::string();
		}

		// now images
		supported.clear();
		getStringList(supported, "usb_img_fs");
		if(std::find(supported.begin(), supported.end(), fs) != supported.end())
		{
			images = true;
			m_type = ROM_INSTALLER_USB_IMG;
			return std::string();
		}
		return std::string("Install location has unsupported fs (") + fs + ")";
	}
	return std::string();
}
bool AbilityList::toBinaryStream(ObjectOutputStream* stream) {
	Vector<String> names;
	getStringList(names);

	TypeInfo<uint32>::toBinaryStream(&updateCounter, stream);
	names.toBinaryStream(stream);

	return true;
}
Beispiel #7
0
/*!
  Looks up the configuration variable \a var in the string list
  map, converts the string list to a list of regular expressions,
  and returns it.
 */
QList<QRegExp> Config::getRegExpList(const QString& var) const
{
    QStringList strs = getStringList(var);
    QStringList::ConstIterator s = strs.begin();
    QList<QRegExp> regExps;

    while (s != strs.end()) {
	regExps += QRegExp(*s);
	++s;
    }
    return regExps;
}
Beispiel #8
0
/*!
  Looks up the configuration variable \a var in the string list
  map. Iterates through the string list found, interpreting each
  string in the list as an integer and adding it to a total sum.
  Returns the sum.
 */
int Config::getInt(const QString& var) const
{
    QStringList strs = getStringList(var);
    QStringList::ConstIterator s = strs.begin();
    int sum = 0;

    while (s != strs.end()) {
	sum += (*s).toInt();
	++s;
    }
    return sum;
}
Beispiel #9
0
/*!
  Looks up the configuration variable \a var in the string list
  map. Iterates through the string list found, interpreting each
  string in the list as an integer and adding it to a total sum.
  Returns the sum or \c -1 if \a var is not set.
 */
int Config::getInt(const QString& var) const
{
    QStringList strs = getStringList(var);
    if (strs.isEmpty())
        return -1;

    QStringList::ConstIterator s = strs.constBegin();
    int sum = 0;

    while (s != strs.constEnd()) {
        sum += (*s).toInt();
        ++s;
    }
    return sum;
}
Beispiel #10
0
void CEToStringsMap::put(uint32_t ce, UnicodeString *string, UErrorCode &status)
{
    StringList *strings = getStringList(ce);

    if (strings == NULL) {
        strings = new StringList(status);

        if (strings == NULL || U_FAILURE(status)) {
            status = U_MEMORY_ALLOCATION_ERROR;
            return;
        }

        putStringList(ce, strings, status);
    }

    strings->add(string, status);
}
ossimQtPropertyStringListItem::ossimQtPropertyStringListItem(ossimQtPropertyListView *propList,
                                                     ossimQtPropertyItem *after,
                                                     ossimQtPropertyItem *parent,
                                                     ossimRefPtr<ossimProperty> oProp)
   :ossimQtPropertyItem(propList, after, parent, oProp),
    theBox(0),
    theButton(0),
    theStringListDialog(0)
{
    theBox = new QHBox( theListView->viewport() );
    theBox->hide();
    theBox->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
    theBox->setLineWidth( 2 );
    theButton = new QPushButton( "...", theBox );
    theButton->setFixedWidth( 20 );

    connect( theButton, SIGNAL( clicked() ),
             this, SLOT( getStringList() ) );
}
//----------------------------------------------------------------------------------------------------
SharedPointer<UISelection> UIViewCreatorDataSource::createSelection ()
{
	SharedPointer<UISelection> selection;
	UIAttributes viewAttr;
	viewAttr.setAttribute (UIViewCreator::kAttrClass, getStringList ()->at (static_cast<uint32_t> (mouseDownRow)));
	CView* view = factory->createView (viewAttr, description);
	if (view)
	{
		if (view->getViewSize ().isEmpty ())
		{
			CRect size (CPoint (0, 0), CPoint (20, 20));
			view->setViewSize (size);
			view->setMouseableArea (size);
		}
		selection = owned (new UISelection ());
		selection->add (view);
		view->forget ();
	}
	return selection;
}
Beispiel #13
0
/*!
  Looks up the configuration variable \a var in the string
  list map, converts the string list it maps to into a set
  of strings, and returns the set.
 */
QSet<QString> Config::getStringSet(const QString& var) const
{
    return QSet<QString>::fromList(getStringList(var));
}
Beispiel #14
0
 std::vector<std::wstring> RegistryByteBuffer::getStringList() const {
     return getStringList(0, _byteBuffer->limit());
 }
Beispiel #15
0
QStringList AmarokMediaPlayer::getPlayListFiles()
{
	kdebugf();
	return getStringList("playlist", "filenames");
	kdebugf2();
}
Beispiel #16
0
CCMutableArray<StringLabel*>* TagString::parse( bool useTag )
{
    string cut = "";
    int start_idx = 0;
    
    float zen_width = 0;

    
    // 全角幅を取得
    {
        StringLabel* label_zen = StringLabel::init( "1", ccc3(0,0,0), baseFontSize );

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
        zen_width = (int)(label_zen->getContentSize().width);
#else
        zen_width = label_zen->getContentSize().width;
#endif
    }
    

    
    /////////////////////////////////////////////
    // 変数タグの置換
    start_idx = 0;
    
    for( ;; )
    {
        int tag_start1 = tagStr.find( "<param=", start_idx );
        if( tag_start1 == string::npos ) break;
        
        int tag_start2 = tagStr.find( ">", tag_start1 );
        
        string param_str = tagStr.substr( tag_start1+7, tag_start2-(tag_start1+7) );
        
        // 変数の値取得
        string value = ParamList::shared()->getValue( param_str );
        
        if( !value.empty() )
        {
            // 文字列の置換
            tagStr.replace( tag_start1, tag_start2-tag_start1+1, value );
            start_idx = 0;
            continue;
        }
        
        start_idx = tag_start2 + 1;
    }
    
    //tagStr->getStringWidth()
      
    /////////////////////////////////////////////
    // 自動改行チェック
    if( autoKaigyouFlg )
    {
        vector< string > list = StringComparator::comparate( tagStr );
        
        bool tag_start = false;

        float total_size = 0;
        
        string conv_str = "";
        
        for( int i = 0; i < list.size(); i++ )
        {
            if (useTag)
            {
                if( list[i] == "<" )
                {
                    tag_start = true;
                }
                
                if( list[i] == ">" )
                {
                    tag_start = false;
                    conv_str.append( list[i] );
                    continue;
                }
            
                if( tag_start )
                {
                    // 改行チェック
                    if( list[i] == "b" )
                    {
                        if( list[i+1] == "r" )
                        {
                            total_size = 0;
                        }
                    }
                    
                    conv_str.append( list[i] );
                    continue;
                }
            }
            
            float strw = 0;

            // 半角
            if( list[i].length() == 1 )
            {
                StringLabel* label = StringLabel::init( list[i].c_str(), ccc3(0,0,0), baseFontSize );
                strw = label->getContentSize().width;
            }
            // 全角
            else
            {
                strw = zen_width;
            }
            
            
            total_size += strw;
            
            // 改行を挿入
            if( width > 0 && total_size > width )
            {
                //CCLog( "kaigyou2 total_size=%d", total_size );
                
                // 改行コードを入れる
                conv_str.append( "<br>" );
                total_size = strw;
            }

            else
            {
                if (list[i] == "\n")  total_size = 0;
            }
            conv_str.append( list[i] );
            
            
        }
        
        tagStr = conv_str;
    }
  
    
    /////////////////////////////////////////////
    // 改行、カラー、フォントサイズ、アンカー解析
   
    int line = 0;
    
    start_idx = 0;
    
    int active_anchor = 0;
    int active_font_size = baseFontSize;
    ccColor3B active_color = baseColor;
    
    //CCLog( "tag_str=%s", tagStr.c_str() );

    bool brflg = false;

    for( ;; )
    {
        
        // 開始タグ判定
        int tag_start = tagStr.find( "<", start_idx );
        

        if( tag_start != string::npos && useTag )
        {
            //  表示文字列を取得
            cut = tagStr.substr( start_idx, tag_start - (start_idx) );
            
            //CCLog( "cut=%s actuve=%d", cut.c_str(), active_anchor );
            
            if( !cut.empty() || brflg )
            {
                parseList->addObject( new ColorString( cut, active_color, active_font_size, line, active_anchor ) );
            }
            
                
            int tag_close = tagStr.find( ">", tag_start );
            
            // タグ文字列取得
            string param_str = tagStr.substr( tag_start+1, tag_close-(tag_start+1) );
            
            // アンカー
            if( param_str.find( "left" ) != string::npos )
            {
                active_anchor = ALIGN_LEFT;
            }
        
            if( param_str.find( "center" ) != string::npos )
            {
                active_anchor = ALIGN_CENTER;
            }
            
            if( param_str.find( "right" ) != string::npos )
            {
                active_anchor = ALIGN_RIGHT;
            }
            
            // 改行
            if( param_str.find( "br" ) != string::npos )
            {
                line += 1;
                brflg = true;
            }
                
            // カラー設定
            if( param_str.find( "color=" ) != string::npos )
            {
                // 色情報の切り出し
                string color_str = param_str.substr( 6, param_str.length()-6 );
                
                // 色成分に分解
                char *csv = const_cast<char*>( color_str.c_str() );
                int red   = CommonUtils::StrToInt( strtok(  csv, ":" ) );
                int green = CommonUtils::StrToInt( strtok( NULL, ":" ) );
                int blue  = CommonUtils::StrToInt( strtok( NULL, ":" ) );
                
                active_color = ccc3( red, green, blue );
                
            }
            
            // フォントサイズ
            if( param_str.find( "size=" ) != string::npos )
            {
                string size_str = param_str.substr( 5, param_str.length()-5 );
                
                active_font_size = CommonUtils::StrToInt( size_str );
            }
            
            // カラー 終了タグ
            if( param_str.find( "/color" ) != string::npos )
            {
                active_color = baseColor;
            }

            // アンカー 終了タグ
            if( param_str.find( "/center" ) != string::npos )
            {
                active_anchor = ALIGN_LEFT;
            }
            
            if( param_str.find( "/right" ) != string::npos )
            {
                active_anchor = ALIGN_LEFT;
            }
            
            // フォントサイズ 終了タグ
            if( param_str.find( "/size" ) != string::npos )
            {
                active_font_size = baseFontSize;
            }
            
            start_idx = tag_close + 1;
        }
        
        else
        {
            /*
            for( ;; )
            {
                // 改行コードがある場合
                tag_start = tagStr.find( "\n", start_idx );
                if (tag_start != string::npos)
                {
                    //  表示文字列を取得
                    cut = tagStr.substr( start_idx, tag_start - (start_idx) );
                    
                    if( !cut.empty() )
                    {
                        parseList->addObject( new ColorString( cut, active_color, active_font_size, line, active_anchor ) );
                        line += 1;
                    }
                    start_idx = tag_start + 1;
                }
                else
                {
                    break;
                }
            }
            */
            cut = tagStr.substr( start_idx, tagStr.length() - (start_idx) );
            
            if( !cut.empty() )
            {
                //CCLog( "cut=%s", cut.c_str() );
                
                parseList->addObject( new ColorString( cut, active_color, active_font_size, line, active_anchor ) );
            }
            
            break;
        }
        
    }
    

    
    int linecnt = getLineCount();
    
    float basex = 0;
    float basey = 0;
    
    
    
    // アライン設定
    if( baseAlign == TEXT_ALIGN_CENTER_TOP )
    {
        basex = ( ( width - getStringWidth() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_TOP )
    {
        basex = width - getStringWidth();
    }
    
    if( baseAlign == TEXT_ALIGN_LEFT_MIDDLE )
    {
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_CENTER_MIDDLE )
    {
        basex = ( ( width  - getStringWidth()  )/2 );
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_MIDDLE )
    {
        basex = width - getStringWidth();
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_CENTER_BOTTOM )
    {
        basex = ( ( width  - getStringWidth()  )/2 );
        basey = height - getStringHeight();
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_BOTTOM )
    {
        basex = width - getStringWidth();
        basey = height - getStringHeight();
    }
    
    if( baseAlign == TEXT_ALIGN_LEFT_BOTTOM )
    {
        basey = height - getStringHeight();
    }
    
    float dispx = basex;
    float dispy = basey;
    
    // 返却用のリスト
    CCMutableArray<StringLabel*>* ret = new CCMutableArray<StringLabel*>;
    ret->autorelease();
    
    // ラベルを生成
    for( int i = 0; i < linecnt; i++ )
    {
        CCMutableArray<ColorString*> *list = getStringList( i );
        
        float lh = getStringLineHeight( i );
        float lw = getStringLineWidth( i );
        
        // 下合わせ
        dispy += lh;
        
        for( int j = 0; j < list->count(); j++ )
        {
            ColorString* cstr = list->getObjectAtIndex( j );
            
            // アライン
            if( j == 0 )
            {
                if( cstr->getAlign() == ALIGN_LEFT   ) dispx = 0;
                if( cstr->getAlign() == ALIGN_CENTER ) dispx = ((width-lw)/2);
                if( cstr->getAlign() == ALIGN_RIGHT  ) dispx = width - lw;
            }    
            
            // テキストを設定
            StringLabel* label = cstr->getStrLabel();
            
            label->setAlign( TEXT_ALIGN_LEFT_BOTTOM );
            //label->setPosition( dispx, dispy );
            label->setOffsetX( dispx );
            label->setOffsetY( dispy );
            
            ret->addObject( label );
            
            // ラベルサイズ取得
            CCSize size = label->getContentSize();
            dispx += size.width;
        }
        
        dispx  = basex;
    }
    
    
    return ret;
    
    
    
    
}
Beispiel #17
0
void testQStringListSpecificMethods()
{
    getStringList().removeDuplicates();
}