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


C++ BString::RemoveFirst方法代码示例

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


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

示例1:

RuleFilter::RuleFilter(MailProtocol& protocol, AddonSettings* addonSettings)
	:
	MailFilter(protocol, addonSettings)
{
	const BMessage* settings = &addonSettings->Settings();
	// attribute is adapted to our "capitalize-each-word-in-the-header" policy
	settings->FindString("attribute", &fAttribute);
	fAttribute.CapitalizeEachWord();

	BString regex;
	settings->FindString("regex", &regex);
	
	int32 index = regex.FindFirst("REGEX:");
	if (index == B_ERROR || index > 0)
		EscapeRegexTokens(regex);
	else
		regex.RemoveFirst("REGEX:");
		
	fMatcher.SetPattern(regex, false);
	
	settings->FindString("argument",&fArg);
	settings->FindInt32("do_what",(long *)&fDoWhat);
	if (fDoWhat == Z_SET_REPLY)
		settings->FindInt32("argument", &fReplyAccount);
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: local_to_db_filepath

/*
* Convert a local absolute filepath to a Dropbox one
* by removing the <path to Dropbox> from the beginning
*/
BString local_to_db_filepath(const char * local_path)
{
  BString s;
  s = BString(local_path);
  s.RemoveFirst(local_path_string);
  return s;
}
开发者ID:astrieanna,项目名称:haiku-dropbox-client,代码行数:11,代码来源:HaikuDropbox.cpp

示例3: UpdateStatementType

void Parser::UpdateStatementType(Statement* statement)
{
	if (statement->GetType() != Statement::kUnknown) return;
	
	BString* keyword = statement->GetKeyword();
	Statement::Type type;
	if (keyword->FindFirst("Default") == 0) {
		type = Statement::kDefault;
		keyword->RemoveFirst("Default");
	} else if (keyword->FindFirst("Param") == 0) {
		type = Statement::kParam;
		keyword->RemoveFirst("Param");
	} else {
		type = Statement::kValue;
	}
	statement->SetType(type);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:17,代码来源:Parser.cpp

示例4: CountLanguages

BString
MSHLanguageMgr::GetLanguageName(const int32 index)
{
	BString languageName = "";

	if (NULL != fTransFiles) {
		const int32 numLanguages = CountLanguages();
		if ((numLanguages > 0) && (index < numLanguages)) {
			MSHLanguageFile* langFile = reinterpret_cast<MSHLanguageFile*>(fTransFiles->ItemAt(index));
			if (NULL != langFile) {
				BString transFileName = langFile->GetTranslationFileName();
				transFileName.RemoveFirst(fFileNameStub);
				transFileName.RemoveFirst(".");
				languageName = transFileName;
			}
		}
	}

	return languageName;
}
开发者ID:carriercomm,项目名称:Helios,代码行数:20,代码来源:MSHLanguageMgr.cpp

示例5: PairNameAt

BString
EnumFlagProperty::GetValueAsString(void) const
{
	BString out;
	for (int32 i = 0; i < CountValuePairs(); i++)
	{
		if (fValue & PairValueAt(i))
			out << " | " << PairNameAt(i);
	}
	
	if (out.FindFirst(" | ") == 0)
		out.RemoveFirst(" | ");
	
	return out;
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:15,代码来源:EnumProperty.cpp

示例6: RefreshCategories

void BudgetWindow::RefreshCategories(void)
{
	fCategoryList->Clear();
	fIncomeRow = new BRow();
	fCategoryList->AddRow(fIncomeRow);
	fSpendingRow = new BRow();
	fCategoryList->AddRow(fSpendingRow);
	fIncomeRow->SetField(new BStringField(TRANSLATE("Income")),0);
	fSpendingRow->SetField(new BStringField(TRANSLATE("Spending")),0);

	CppSQLite3Query query = gDatabase.DBQuery("select category,amount,period,isexpense from "
											"budgetlist order by category",
											"BudgetWindow::RefreshCategories");
	float maxwidth=fCategoryList->StringWidth("Category");
	while(!query.eof())
	{
		BString cat = DeescapeIllegalCharacters(query.getStringField(0));
		Fixed amount;
		amount.SetPremultiplied(query.getInt64Field(1));
		BudgetPeriod period = (BudgetPeriod)query.getIntField(2);

		BRow *row = new BRow();

		if(query.getIntField(3)==0)
			fCategoryList->AddRow(row,fIncomeRow);
		else
			fCategoryList->AddRow(row,fSpendingRow);

		row->SetField(new BStringField(cat.String()),0);

		BString amountstr;
		gDefaultLocale.CurrencyToString(amount.AbsoluteValue(),amountstr);
		amountstr.Truncate(amountstr.FindFirst(gDefaultLocale.CurrencyDecimal()));
		amountstr.RemoveFirst(gDefaultLocale.CurrencySymbol());

		row->SetField(new BStringField(amountstr.String()),1);

		float tempwidth = fCategoryList->StringWidth(cat.String());
		maxwidth = MAX(tempwidth,maxwidth);

		row->SetField(new BStringField(BudgetPeriodToString(period).String()),2);

		query.nextRow();
	}
	fCategoryList->ColumnAt(0)->SetWidth(maxwidth+30);
	fCategoryList->ExpandOrCollapse(fIncomeRow,true);
	fCategoryList->ExpandOrCollapse(fSpendingRow,true);
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:48,代码来源:BudgetWindow.cpp

示例7: while

void
JabberProtocol::ReceiveData(BMessage *msg)
{
	BMessage packet;
	BString msgData;
	
	msg->MakeEmpty();
	
	bool found_stream_start = false;
	bool found_stream_end = false;
	
	do 
	{
		BString data;
		int32 length;
		
		packet.MakeEmpty();
		socketAdapter->ReceiveData(&packet);
	
		packet.FindString("data", &data);
		packet.FindInt32("length", &length);

		if (data.FindFirst("<stream:stream") >= 0)
			found_stream_start = true;
			
		if (data.FindFirst("</stream:stream") >= 0)
			found_stream_end = true;
			
		msgData.Append(data);
		
	} while (FXMLCheck(msgData.String()) == NULL && 
				!found_stream_start && !found_stream_end);
	
	// TODO: handle XML head more accurately
	
	msgData.RemoveFirst("<?xml version='1.0'?>").Append("</dengon>").Prepend("<dengon>");
					
	msg->AddInt32("length", msgData.Length());
	msg->AddString("data", msgData);
	
}
开发者ID:BackupTheBerlios,项目名称:dengon-svn,代码行数:41,代码来源:JabberProtocol.cpp

示例8: entry

/*static*/ void
Playlist::AppendPlaylistToPlaylist(const entry_ref& ref, Playlist* playlist)
{
	BEntry entry(&ref, true);
	if (entry.InitCheck() != B_OK || !entry.Exists())
		return;

	BString mimeString = _MIMEString(&ref);
	if (_IsTextPlaylist(mimeString)) {
		//printf("RunPlaylist thing\n");
		BFile file(&ref, B_READ_ONLY);
		FileReadWrite lineReader(&file);

		BString str;
		entry_ref refPath;
		status_t err;
		BPath path;
		while (lineReader.Next(str)) {
			str = str.RemoveFirst("file://");
			str = str.RemoveLast("..");
			path = BPath(str.String());
			printf("Line %s\n", path.Path());
			if (path.Path() != NULL) {
				if ((err = get_ref_for_path(path.Path(), &refPath)) == B_OK) {
					PlaylistItem* item
						= new (std::nothrow) FilePlaylistItem(refPath);
					if (item == NULL || !playlist->AddItem(item))
						delete item;
				} else
					printf("Error - %s: [%lx]\n", strerror(err), (int32) err);
			} else
				printf("Error - No File Found in playlist\n");
		}
	} else if (_IsBinaryPlaylist(mimeString)) {
		BFile file(&ref, B_READ_ONLY);
		Playlist temp;
		if (temp.Unflatten(&file) == B_OK)
			playlist->AdoptPlaylist(temp, playlist->CountItems());
	}
}
开发者ID:michael-manley,项目名称:haiku,代码行数:40,代码来源:Playlist.cpp

示例9: BMailFilter

RuleFilter::RuleFilter(BMessage *settings) : BMailFilter(settings) {
	// attribute is adapted to our "capitalize-each-word-in-the-header" policy
	BString attr;
	settings->FindString("attribute",&attr);
	attr.CapitalizeEachWord();
	attribute = strdup(attr.String());

	BString regex;
	settings->FindString("regex",&regex);
	
	int32 index = regex.FindFirst("REGEX:");
	if (index == B_ERROR || index > 0)
		EscapeRegexTokens(regex);
	else
		regex.RemoveFirst("REGEX:");
		
	matcher.SetPattern(regex.String(),false);
	
	settings->FindString("argument",&arg);
	settings->FindInt32("do_what",(long *)&do_what);
	if (do_what == Z_SET_REPLY)
		settings->FindInt32("argument",&chain_id);
}
开发者ID:luciang,项目名称:haiku,代码行数:23,代码来源:RuleFilter.cpp

示例10: SetPeriod

void BudgetWindow::SetPeriod(const BudgetPeriod &period)
{
	BRow *row = fCategoryList->CurrentSelection();
	if(!row)
		return;

	BudgetEntry entry;
	BStringField *strfield = (BStringField*)row->GetField(0);
	if(!gDatabase.GetBudgetEntry(strfield->String(),entry))
		return;

	// Convert the amount to reflect the change in period
	switch(entry.period)
	{
		case BUDGET_WEEKLY:
		{
			entry.amount *= 52;
			break;
		}
		case BUDGET_QUARTERLY:
		{
			entry.amount *= 4;
			break;
		}
		case BUDGET_ANNUALLY:
		{
			break;
		}
		default:
		{
			entry.amount *= 12;
			break;
		}
	}
	entry.period = period;

	switch(entry.period)
	{
		case BUDGET_WEEKLY:
		{
			entry.amount /= 52;
			break;
		}
		case BUDGET_QUARTERLY:
		{
			entry.amount /= 4;
			break;
		}
		case BUDGET_ANNUALLY:
		{
			break;
		}
		default:
		{
			entry.amount /= 12;
			break;
		}
	}
	// yeah, yeah, I know about rounding errors. It's not that big of a deal,
	// so deal with it. *famous last words*
	entry.amount.Round();

	gDatabase.AddBudgetEntry(entry);
	RefreshBudgetGrid();
	RefreshBudgetSummary();

	BString str;
	gDefaultLocale.CurrencyToString(entry.amount,str);
	str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());

	row->SetField(new BStringField(str.String()),1);
	fAmountBox->SetText(str.String());

	row->SetField(new BStringField(BudgetPeriodToString(entry.period).String()),2);
	fCategoryList->UpdateRow(row);
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:77,代码来源:BudgetWindow.cpp

示例11: RefreshBudgetSummary

void BudgetWindow::RefreshBudgetSummary(void)
{
	Fixed itotal,stotal,mtotal,f;
	Fixed irowtotal,srowtotal, ttotal;
	for(int32 i=0; i<12; i++)
	{
		itotal = stotal = mtotal = 0;

		for(int32 j=0; j<fIncomeGrid.CountItems(); j++)
		{
			fIncomeGrid.ValueAt(i,j,f);
			itotal += f;
			irowtotal += f;
		}

		for(int32 j=0; j<fSpendingGrid.CountItems(); j++)
		{
			fSpendingGrid.ValueAt(i,j,f);
			stotal += f.AbsoluteValue();
			srowtotal += f;
		}

		mtotal = itotal - stotal;
		ttotal += mtotal;

		itotal.Round();
		stotal.Round();
		mtotal.Round();

		BString itemp,stemp,mtemp;
		gDefaultLocale.CurrencyToString(itotal,itemp);
		gDefaultLocale.CurrencyToString(stotal,stemp);
		gDefaultLocale.CurrencyToString(mtotal,mtemp);

		itemp.Truncate(itemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
		stemp.Truncate(stemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
		mtemp.Truncate(mtemp.FindFirst(gDefaultLocale.CurrencyDecimal()));

		itemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
		stemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
		mtemp.RemoveFirst(gDefaultLocale.CurrencySymbol());

		BRow *irow = fBudgetSummary->RowAt(0);
		BRow *srow = fBudgetSummary->RowAt(1);
		BRow *mrow = fBudgetSummary->RowAt(2);

		irow->SetField(new BStringField(itemp.String()),i+1);
		srow->SetField(new BStringField(stemp.String()),i+1);
		mrow->SetField(new BStringField(mtemp.String()),i+1);

		float colwidth = fBudgetSummary->StringWidth(itemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);

		colwidth = fBudgetSummary->StringWidth(stemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);

		colwidth = fBudgetSummary->StringWidth(mtemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);
	}

	BString ttemp;

	gDefaultLocale.CurrencyToString(irowtotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(0)->SetField(new BStringField(ttemp.String()),13);

	gDefaultLocale.CurrencyToString(srowtotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(1)->SetField(new BStringField(ttemp.String()),13);

	gDefaultLocale.CurrencyToString(ttotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(2)->SetField(new BStringField(ttemp.String()),13);

	fBudgetSummary->Invalidate();
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:82,代码来源:BudgetWindow.cpp

示例12: HandleCategorySelection

void BudgetWindow::HandleCategorySelection(void)
{
	BRow *row = fCategoryList->CurrentSelection();
	if(!row)
	{
		fAmountBox->SetText("");
		fMonthly->SetValue(B_CONTROL_ON);
		fStatAverageRow->SetField(new BStringField(""),1);
		fStatHighestRow->SetField(new BStringField(""),1);
		fStatLowestRow->SetField(new BStringField(""),1);
	}

	BudgetEntry entry;
	BStringField *strfield = (BStringField*)row->GetField(0);
	if(!gDatabase.GetBudgetEntry(strfield->String(),entry))
		return;

	switch(entry.period)
	{
		case BUDGET_WEEKLY:
		{
			fWeekly->SetValue(B_CONTROL_ON);
			break;
		}
		case BUDGET_QUARTERLY:
		{
			fQuarterly->SetValue(B_CONTROL_ON);
			break;
		}
		case BUDGET_ANNUALLY:
		{
			fAnnually->SetValue(B_CONTROL_ON);
			break;
		}
		default:
		{
			fMonthly->SetValue(B_CONTROL_ON);
			break;
		}
	}

	BString str;
	gDefaultLocale.CurrencyToString(entry.amount.AbsoluteValue(),str);
	str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fAmountBox->SetText(str.String());

	Fixed high,low,avg;
	CalcStats(entry.name.String(),high,low,avg);

	gDefaultLocale.CurrencyToString(high.AbsoluteValue(),str);
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fStatHighestRow->SetField(new BStringField(str.String()),1);

	gDefaultLocale.CurrencyToString(low.AbsoluteValue(),str);
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fStatLowestRow->SetField(new BStringField(str.String()),1);

	gDefaultLocale.CurrencyToString(avg.AbsoluteValue(),str);
	str.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fStatAverageRow->SetField(new BStringField(str.String()),1);

	fCatStat->Invalidate();
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:64,代码来源:BudgetWindow.cpp

示例13: SetMIMEInfoForType

nsresult nsOSHelperAppService::SetMIMEInfoForType(const char *aMIMEType, nsMIMEInfoBeOS**_retval) {

	LOG(("-- nsOSHelperAppService::SetMIMEInfoForType: %s\n",aMIMEType));

	nsresult rv = NS_ERROR_FAILURE;

	nsMIMEInfoBeOS* mimeInfo = new nsMIMEInfoBeOS(aMIMEType);
	if (mimeInfo) {
		NS_ADDREF(mimeInfo);
		BMimeType mimeType(aMIMEType);
		BMessage data;
		int32 index = 0;
		BString strData;
		LOG(("   Adding extensions:\n"));
		if (mimeType.GetFileExtensions(&data) == B_OK) {
			while (data.FindString("extensions",index,&strData) == B_OK) {
				// if the file extension includes the '.' then we don't want to include that when we append
				// it to the mime info object.
				if (strData.ByteAt(0) == '.')
					strData.RemoveFirst(".");
				mimeInfo->AppendExtension(nsDependentCString(strData.String()));
				LOG(("      %s\n",strData.String()));
				index++;
			}
		}

		char desc[B_MIME_TYPE_LENGTH + 1];
		if (mimeType.GetShortDescription(desc) == B_OK) {
			mimeInfo->SetDescription(NS_ConvertUTF8toUCS2(desc));
		} else {
			if (mimeType.GetLongDescription(desc) == B_OK) {
				mimeInfo->SetDescription(NS_ConvertUTF8toUCS2(desc));
			} else {
				mimeInfo->SetDescription(NS_ConvertUTF8toUCS2(aMIMEType));
			}
		}
		
		LOG(("    Description: %s\n",desc));

		//set preferred app and app description
		char appSig[B_MIME_TYPE_LENGTH + 1];
		bool doSave = true;
		if (mimeType.GetPreferredApp(appSig) == B_OK) {
			LOG(("    Got preferred ap\n"));
			BMimeType app(appSig);
			entry_ref ref;
			BEntry entry;
			BPath path;
			if ((app.GetAppHint(&ref) == B_OK) &&
			        (entry.SetTo(&ref, false) == B_OK) &&
			        (entry.GetPath(&path) == B_OK)) {

				LOG(("    Got our path!\n"));
				nsCOMPtr<nsIFile> handlerFile;
				rv = GetFileTokenForPath(NS_ConvertUTF8toUCS2(path.Path()).get(), getter_AddRefs(handlerFile));

				if (NS_SUCCEEDED(rv)) {
					mimeInfo->SetDefaultApplication(handlerFile);
					mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
					mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUCS2(path.Leaf()));
					LOG(("    Preferred App: %s\n",path.Leaf()));
					doSave = false;
				}
			}
		}
		if (doSave) {
			mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk);
			LOG(("    No Preferred App\n"));
		}

		*_retval = mimeInfo;
		rv = NS_OK;
	}
	else
		rv = NS_ERROR_FAILURE;

	return rv;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:78,代码来源:nsOSHelperAppService.cpp

示例14: GetPath

void
Project::Link(void)
{
	BString linkString;
	
	if (TargetType() == TARGET_STATIC_LIB)
	{
		linkString = "ar rcs '";
		linkString << GetPath().GetFolder() << "/" << GetTargetName() << "' ";
		for (int32 i = 0; i < CountGroups(); i++)
		{
			SourceGroup *group = GroupAt(i);
			
			for (int32 j = 0; j < group->filelist.CountItems(); j++)
			{
				SourceFile *file = group->filelist.ItemAt(j);
				if (file->GetObjectPath(fBuildInfo).GetFullPath())
					linkString << "'" << file->GetObjectPath(fBuildInfo).GetFullPath() << "' ";
			}
		}
	
	}
	else
	{
		linkString = "gcc -o '";
		linkString << GetPath().GetFolder() << "/" << GetTargetName() << "' ";
			
		for (int32 i = 0; i < CountGroups(); i++)
		{
			SourceGroup *group = GroupAt(i);
			
			for (int32 j = 0; j < group->filelist.CountItems(); j++)
			{
				SourceFile *file = group->filelist.ItemAt(j);
				if (file->GetObjectPath(fBuildInfo).GetFullPath())
					linkString << "'" << file->GetObjectPath(fBuildInfo).GetFullPath() << "' ";
			}
		}
	
		for (int32 i = 0; i < CountGroups(); i++)
		{
			SourceGroup *group = GroupAt(i);
			
			for (int32 j = 0; j < group->filelist.CountItems(); j++)
			{
				SourceFile *file = group->filelist.ItemAt(j);
				if (file->GetLibraryPath(fBuildInfo).GetFullPath())
					linkString << "'" << file->GetLibraryPath(fBuildInfo).GetFullPath() << "' ";
			}
		}
	
		for (int32 i = 0; i < CountLibraries(); i++)
		{
			SourceFile *file = LibraryAt(i);
			if (!file)
				continue;
			
			BString filenamebase;
			filenamebase = file->GetPath().GetBaseName();
			if (filenamebase.FindFirst("lib") == 0)
				filenamebase.RemoveFirst("lib");
			
			linkString << "-l" << filenamebase << " ";
		}
		
		if (TargetType() == TARGET_DRIVER)
			linkString << "/boot/develop/lib/x86/_KERNEL_ ";
		
		linkString << "-L/boot/home/config/lib ";
		
		switch (TargetType())
		{
			case TARGET_DRIVER:
			{
				linkString << "-Xlinker -nostdlib ";
				break;
			}
			case TARGET_SHARED_LIB:
			{
				linkString << "-nostart -Xlinker -soname=" << GetTargetName() << " ";
				break;
			}
			default:
			{
				// Application
				linkString << "-Xlinker -soname=_APP_ ";
				break;
			}
		}
	}
	
	linkString << " 2>&1";
	
	BString errmsg;
	PipeCommand(linkString.String(),errmsg);

	STRACE(1,("Linking %s:\n%s\nErrors:\n%s\n",GetName(),linkString.String(),errmsg.String()));
	
	if (errmsg.CountChars() > 0)
		ParseLDErrors(errmsg.String(),fBuildInfo.errorList);
//.........这里部分代码省略.........
开发者ID:passick,项目名称:Paladin,代码行数:101,代码来源:Project.cpp

示例15: partnerPath

void
ProjectWindow::ActOnSelectedFiles(const int32 &command)
{
	SCMOutputWindow *win = NULL;
	switch (command)
	{
		case M_ADD_SELECTION_TO_REPO:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Add to Repository"));
			win->Show();
			break;
		}
		case M_REMOVE_SELECTION_FROM_REPO:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Remove from Repository"));
			win->Show();
			break;
		}
		case M_REVERT_SELECTION:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Revert"));
			win->Show();
			break;
		}
		case M_DIFF_SELECTION:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Show Differences"));
			win->Show();
			break;
		}
		default:
			break;
	}
	
	for (int32 i = 0; i < fProjectList->CountItems(); i++)
	{
		SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->ItemAt(i));
		if (item && item->IsSelected())
		{
			SourceFile *file = item->GetData();
			
			BString relPath = file->GetPath().GetFullPath();
			if (relPath.FindFirst(fProject->GetPath().GetFolder()) == 0)
			{
				relPath.RemoveFirst(fProject->GetPath().GetFolder());
				relPath.RemoveFirst("/");
			}
			
			BString relPartnerPath;
			entry_ref partnerRef = GetPartnerRef(file->GetPath().GetRef());
			if (partnerRef.name)
			{
				DPath partnerPath(partnerRef);
				relPartnerPath = partnerPath.GetFullPath();
				if (relPartnerPath.FindFirst(fProject->GetPath().GetFolder()) == 0)
				{
					relPartnerPath.RemoveFirst(fProject->GetPath().GetFolder());
					relPartnerPath.RemoveFirst("/");
				}
			}
			switch (command)
			{
				case M_REBUILD_FILE:
				{
					if (file->UsesBuild())
					{
						file->RemoveObjects(*fProject->GetBuildInfo());
						item->SetDisplayState(SFITEM_NEEDS_BUILD);
						fProjectList->InvalidateItem(fProjectList->IndexOf(item));
					}
					break;
				}
				case M_ADD_SELECTION_TO_REPO:
				{
					fSourceControl->AddToRepository(relPath.String());
					if (relPartnerPath.CountChars() > 0)
						fSourceControl->AddToRepository(relPartnerPath.String());
					break;
				}
				case M_REMOVE_SELECTION_FROM_REPO:
				{
					fSourceControl->RemoveFromRepository(relPath.String());
					if (relPartnerPath.CountChars() > 0)
						fSourceControl->RemoveFromRepository(relPartnerPath.String());
					break;
				}
				case M_REVERT_SELECTION:
				{
//.........这里部分代码省略.........
开发者ID:passick,项目名称:Paladin,代码行数:101,代码来源:ProjectWindow.cpp


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