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


C++ _List::Clear方法代码示例

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


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

示例1: HandlePullDown

_String HandlePullDown (_List& menuOptions, long l, long t,long startPos)
{
    lastPopupMenuSelection = -1;
    lastPopupMenuItemStrings.Clear();
    if (lastPopupFactory) {
        delete lastPopupFactory;
    }

    if (menuOptions.lLength) {
        ListToPopUpMenu (menuOptions);
        GtkWidget *menu;

        int button                  = 0;
        guint32     event_time      = gtk_get_current_event_time ();

        GtkItemFactory * menu_items = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<HY_POPUP>", NULL);
        gtk_item_factory_create_items (menu_items,  menuOptions.lLength, lastPopupFactory, menu);

        menu = gtk_item_factory_get_widget (menu_items, "<HY_POPUP>/Popup");
        g_signal_connect (menu, "selection-done", (GCallback)hyphy_popup_menu_close, menu_items);

        lastPopupMenuSelection = -1;

        gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,  button, event_time);
        gtk_main ();
        gtk_widget_destroy (menu);
        g_object_unref(menu_items);
        if (lastPopupMenuSelection>=0) {
            return *(_String*)menuOptions (lastPopupMenuSelection);
        }

    }

    return empty;
}
开发者ID:Nicholas-NVS,项目名称:hyphy,代码行数:35,代码来源:HYPlatformUtils.cpp

示例2: CompileListOfUserExpressions

//__________________________________________________________________________________
void    CompileListOfUserExpressions (_SimpleList& varRefs,_List& rec, bool doAll)
{
    rec.Clear();
    if (varRefs.lLength == 0) {
        return;
    }

    long i;
    _SimpleList startVars;
    _VariableContainer*  firstVar = (_VariableContainer*)LocateVar(varRefs.lData[0]);

    firstVar->ScanAndAttachVariables();

    {
        _AVLList sA (&startVars);
        if (doAll) {

            firstVar->ScanForVariables (sA,sA);
            firstVar->ScanForGVariables (sA,sA);
        }

        firstVar->ScanForDVariables (sA,sA);
        sA.ReorderList ();
    }

    if (!doAll) {
        for (i=startVars.lLength-1; i>=0; i--) {
            if (firstVar->IsModelVar(i)) {
                startVars.Delete(i);
            }
        }
    }

    for (i=0; i<startVars.lLength; i++) {
        _String thisName (LocateVar(startVars.lData[i])->GetName()->Cut
                          (LocateVar(startVars.lData[i])->GetName()->FindBackwards('.',0,-1),-1));
        rec && &thisName;
    }

    for (i=varRefs.lLength-1; i>=1; i--) {
        firstVar = (_VariableContainer*)LocateVar(varRefs.lData[i]);
        firstVar->ScanAndAttachVariables();
        firstVar->MatchParametersToList (rec,doAll);
    }

    for (i=rec.lLength-1; i>=0; i--) {
        _String* thisLine = ((_String*)rec(i));
        thisLine->Trim(1,-1);
        if (doAll)
            if (LocateVarByName(*thisLine)<0) {
                *thisLine = _String('!')&*thisLine;
            }
    }

}
开发者ID:HyperionRiaz,项目名称:hyphy,代码行数:56,代码来源:parser.cpp

示例3: SplitVariableIDsIntoLocalAndGlobal

//__________________________________________________________________________________
void SplitVariableIDsIntoLocalAndGlobal (const _SimpleList& theList, _List& splitStorage)
{
    splitStorage.Clear();
    splitStorage.AppendNewInstance(new _SimpleList);
    splitStorage.AppendNewInstance(new _SimpleList);

    for (unsigned long k=0; k<theList.lLength; k++) {
        long varID = theList.lData[k];
        (*(_SimpleList*)splitStorage(1-LocateVar (varID)->IsGlobal())) << varID;
    }
}
开发者ID:HyperionRiaz,项目名称:hyphy,代码行数:12,代码来源:parser.cpp

示例4: GenerateFontList

void    GenerateFontList (_List& fonts)
{
    fonts.Clear();
    PangoFontFamily **families;
    PangoFontFamily *match_family = NULL;
    gint n_families, i;
    pango_context_list_families ((screenPContext),&families, &n_families);

    for (i=0; i<n_families; i++) {
        fonts.AppendNewInstance(new _String(pango_font_family_get_name (families[i])));
    }
    fonts.Sort();
    g_free (families);
}
开发者ID:Nicholas-NVS,项目名称:hyphy,代码行数:14,代码来源:HYPlatformUtils.cpp

示例5: log

//__________________________________________________________________
long		ComputeHashMarkPlacement  (_HYRect line, _Parameter min, _Parameter max, _Parameter& tickStep, 
									                  _Parameter&minLabel, _SimpleList& offsets, _List& labels,
									                  int count, _HYFont& f)
{
	if (max>min)
	{
		offsets.Clear();
		labels.Clear();

		long			w = line.right-line.left,
						h = line.bottom-line.top,
						t = 0;
		_Parameter 		scalingFactor = (w>h)?w/(max-min):h/(max-min);
		
		
		tickStep 		= log(max-min)/log(10.);
		tickStep		= pow (10.,floor (tickStep))*2.;
		minLabel		= min;
		
		t = count-1;
		while (t<count)
		{
			tickStep/=2.;
			if (tickStep>1.)
				tickStep = floor (tickStep);
			if (min)
				minLabel = ceil(min/tickStep)*tickStep;
			t = ceil((max-minLabel)/tickStep);
			if (min)
				minLabel = ceil(min/tickStep)*tickStep;
		}
						
		if (h>w)
		{
			_Parameter tracer = minLabel;
			long res  = 0,
				 last = -100000,
				 k,
				 sw;
				 
			w = h;
			
			for (h=0; h<=t; h++,tracer+=tickStep)
			{
				_String buffer (tracer);
				sw = GetVisibleStringWidth (buffer,f);
				k  = (tracer-min)*scalingFactor;
				if (k>w)
					break;
				if (k-last>f.size)
				{
					offsets << k;
					offsets << sw;
					labels  && & buffer;
					last = k;
				}
				if (sw>res)
					res = sw;
			}
			return res;
		}
		else
		{
			_Parameter tracer = minLabel;
			long res  = 0,
				 last = -100000,
				 k,
				 sw;
				 
			for (h=0; h<=t; h++,tracer+=tickStep)
			{
				_String buffer (tracer);
				sw = GetVisibleStringWidth (buffer,f);
				k  = (tracer-min)*scalingFactor;
				if (k>w)
					break;
				if (k-last>sw)
				{
					offsets << k;
					offsets << sw;
					labels  && & buffer;
					last = k;
				}
			}
		}
		
		return f.size;		
		
	}
	return 0;
	
}
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:93,代码来源:HYGraphicPane.cpp

示例6: ComputeTableCellPlacement

//__________________________________________________________________
long	 ComputeTableCellPlacement (_List& theStrings, _List& thePlacements, _HYRect margins, _HYFont& f)
{
	_SimpleList		columnWidths;
	_List			stringWidths;
	long			i1,i2,w;
	
	for (i1=0; i1<theStrings.lLength; i1++)
	{
		_List 		*thisRow = (_List*)theStrings(i1);
		_SimpleList	*rowWidths = new _SimpleList;
		
		checkPointer (rowWidths);
		
		for (i2=0; i2<thisRow->lLength;i2++)
		{
			w = GetVisibleStringWidth (*(_String*)((*thisRow)(i2)),f);
			
			if (columnWidths.lLength<=i2)
				columnWidths << w;
			else
				if (columnWidths.lData[i2]<w)
					columnWidths.lData[i2] = w;
				
			(*rowWidths) << w;
		}
		stringWidths << rowWidths;
		DeleteObject (rowWidths);
	}	
	
	thePlacements.Clear();
	
	w = f.size+margins.top;
	
	for (i1=0; i1<theStrings.lLength; i1++)
	{
		_SimpleList *thisRow 	   = (_SimpleList*)stringWidths(i1),
					*rowPlacements = new _SimpleList;
		
		checkPointer (rowPlacements);
		
		long		 cumW = margins.left;
		
		for (i2=0; i2<thisRow->lLength;i2++)
		{
			(*rowPlacements) << w;
			(*rowPlacements) << cumW;
			(*rowPlacements) << columnWidths.lData[i2]-thisRow->lData[i2];
			cumW += columnWidths.lData[i2]+margins.right+margins.left;
		}
		
		thePlacements << rowPlacements;
		w += f.size+margins.top+margins.bottom;
		DeleteObject (rowPlacements);
	}	
	
	w = 0;
	for (i1=0; i1<columnWidths.lLength; i1++)
	{
		w += columnWidths.lData[i1];
		w += margins.left;
		w += margins.right;
	}
		
	return w;
}
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:66,代码来源:HYGraphicPane.cpp


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