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


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

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


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

示例1: entry

void
SourceFileRez::Compile(BuildInfo &info, const char *options)
{
	BString abspath = GetPath().GetFullPath();
	if (abspath[0] != '/')
	{
		abspath.Prepend("/");
		abspath.Prepend(info.projectFolder.GetFullPath());
	}
	
	if (BString(GetPath().GetExtension()).ICompare("r") != 0)
		return;
	
	BString pipestr = "rez -t ";
	
	for (int32 i = 0; i < info.includeList.CountItems(); i++)
		pipestr << "'-I" << info.includeList.ItemAt(i)->Absolute() << "' ";
	
	pipestr << "-o '" << GetResourcePath(info).GetFullPath()
			<< "' '" << GetTempFilePath(info).GetFullPath() << "' 2>&1";
	
	FILE *fd = popen(pipestr.String(),"r");
	if (!fd)
		return;
	
	char buffer[1024];
	BString errmsg;
	while (fgets(buffer,1024,fd))
		errmsg += buffer;
	pclose(fd);
	
	STRACE(1,("Compiling %s\nCommand:%s\nOutput:%s\n",
			abspath.String(),pipestr.String(),errmsg.String()));
	
	ParseRezErrors(errmsg.String(),info.errorList);
	
	if (info.errorList.msglist.CountItems() > 0)
	{
		BEntry entry(GetResourcePath(info).GetFullPath());
		entry.Remove();
	}
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:42,代码来源:SourceTypeRez.cpp

示例2:

status_t
SVNSourceControl::GetCheckinHeader(BString &out)
{
	GetChangeStatus(out);
	
	out.Prepend("SVN: \nAll lines starting with 'SVN:' will be ignored.\n"
				"----------------------------------------------------\n");
	out.ReplaceAll("\n", "\nSVN: ");
	
	return B_OK;
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:11,代码来源:SVNSourceControl.cpp

示例3: reply

void
LaunchDaemon::_HandleRegisterLaunchEvent(BMessage* message)
{
	uid_t user = _GetUserID(message);
	if (user < 0)
		return;

	if (user == 0 || fUserMode) {
		status_t status = B_OK;

		const char* name = message->GetString("name");
		const char* ownerName = message->GetString("owner");
		BMessenger source;
		if (name != NULL && ownerName != NULL
			&& message->FindMessenger("source", &source) == B_OK) {
			// Register event
			ownerName = get_leaf(ownerName);

			RegisteredEvent* event = new (std::nothrow) RegisteredEvent(
				source, ownerName, name);
			if (event != NULL) {
				// Use short name, and fully qualified name
				BString eventName = name;
				fEvents.insert(std::make_pair(eventName, event));
				_ResolveRegisteredEvents(event, eventName);

				eventName.Prepend("/");
				eventName.Prepend(ownerName);
				fEvents.insert(std::make_pair(eventName, event));
				_ResolveRegisteredEvents(event, eventName);
			} else
				status = B_NO_MEMORY;
		} else
			status = B_BAD_VALUE;

		BMessage reply((uint32)status);
		message->SendReply(&reply);
	}

	_ForwardEventMessage(user, message);
}
开发者ID:puckipedia,项目名称:haiku,代码行数:41,代码来源:LaunchDaemon.cpp

示例4: UpdateNotifyText

void ConfigView::UpdateNotifyText()
{
	BMenuField *field;
	if ((field = dynamic_cast<BMenuField *>(FindView("notify"))) == NULL)
		return;

	BString label;
	for (int32 i = field->Menu()->CountItems();i-- > 0;)
	{
		BMenuItem *item = field->Menu()->ItemAt(i);
		if (!item->IsMarked())
			continue;

		if (label != "")
			label.Prepend(" + ");
		label.Prepend(item->Label());
	}
	if (label == "")
		label = "none";
	field->MenuItem()->SetLabel(label.String());
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例5: ext

void
SourceFileC::Compile(BuildInfo &info, const char *options)
					
{
	BString abspath = GetPath().GetFullPath();
	if (abspath[0] != '/')
	{
		abspath.Prepend("/");
		abspath.Prepend(info.projectFolder.GetFullPath());
	}
	
	BString compileString = "gcc -c ";
	
	// This will make sure that we can still build if ccache is borked
	if (gUseCCache && gCCacheAvailable)
		compileString.Prepend("ccache ");
	
	if (gPlatform == PLATFORM_ZETA)
		compileString << "-D_ZETA_TS_FIND_DIR_ ";
	
	compileString << " -Wall -Wno-multichar -Wno-unknown-pragmas ";
	
	BString ext(GetPath().GetExtension());
	if (ext.ICompare("c") != 0)
		compileString << "-Wno-ctor-dtor-privacy ";
	
	// We should put extra compiler options so that -W options actually work
	if (options)
		compileString << options;
	
	compileString	<< "'" << abspath
					<< "' -o '" << GetObjectPath(info).GetFullPath() << "' 2>&1";
	
	BString errmsg;
	RunPipedCommand(compileString.String(), errmsg, true);
	STRACE(1,("Compiling %s\nCommand:%s\nOutput:%s\n",
			abspath.String(),compileString.String(),errmsg.String()));
	
	ParseGCCErrors(errmsg.String(),info.errorList);
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:40,代码来源:SourceTypeC.cpp

示例6: shellFilePath

void
SourceFileShell::PostBuild(BuildInfo &info, const char *options)
					
{
	BString abspath = GetPath().GetFullPath();
	if (abspath[0] != '/')
	{
		abspath.Prepend("/");
		abspath.Prepend(info.projectFolder.GetFullPath());
	}
	
	DPath shellFilePath(abspath.String());
	BString command = "cd '";
	command << shellFilePath.GetFolder() << "'; './"
			<< shellFilePath.GetFileName() << "'";
	
	STRACE(1,("Running shell script %s\nCommand:%s\n",
			abspath.String(),command.String()));
	
	FILE *fd = popen(abspath.String(),"r");
	if (!fd)
	{
		STRACE(1,("Bailed out of running %s: NULL pipe descriptor\n",
					GetPath().GetFullPath()));
		return;
	}
	
	char buffer[1024];
	BString errmsg;
	while (fgets(buffer,1024,fd))
		errmsg += buffer;
	pclose(fd);
	
	STRACE(1,("Running shell script %s\nOutput:%s\n", abspath.String(),errmsg.String()));
	
	ParseIntoLines(errmsg.String(),info.errorList);
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:37,代码来源:SourceTypeShell.cpp

示例7: encode_html

void encode_html( BString &msg ) {
	// BStrings are slow and sucky, but this is real easy
	msg.ReplaceAll("&","&amp;");
	msg.ReplaceAll("\"","&quot;");
	msg.ReplaceAll("<","&lt;");
	msg.ReplaceAll(">","&gt;");
	
	msg.ReplaceAll("[b]","<b>");
	msg.ReplaceAll("[/b]","</b>");
	msg.ReplaceAll("[i]","<i>");
	msg.ReplaceAll("[/i]","</i>");
	
	msg.Prepend("<html>");
	msg.Append("</html>");
}
开发者ID:Haikeek,项目名称:BePodder,代码行数:15,代码来源:htmlparse.cpp

示例8: BlockUser

status_t MSNManager::BlockUser(const char *passport) {
	status_t ret = B_ERROR;

	if (fNoticeCon) {
		buddymap::iterator i = fWaitingAuth.find(passport);
		if (i != fWaitingAuth.end()) fWaitingAuth.erase(i);
	
		Command *com = new Command("ADC");
		com->AddParam("BL");	// Disallow to see our presence

		BString passParam = passport;
		passParam.Prepend("N=");
		com->AddParam(passParam.String());// Passport
		
		ret = fNoticeCon->Send(com);
	};
	
	return ret;
};
开发者ID:HaikuArchives,项目名称:IMKit,代码行数:19,代码来源:MSNManager.cpp

示例9: MessageFromUser

status_t AIMProtocol::MessageFromUser(const char *nick, const char *msg,
	bool autoReply = false) {
	
	BMessage im_msg(IM::MESSAGE);
	im_msg.AddInt32("im_what", IM::MESSAGE_RECEIVED);
	im_msg.AddString("protocol", fManager->Protocol());
	im_msg.AddString("id", NormalizeNick(nick));
	
	BString text = msg;
	if (autoReply) text.Prepend("(Auto-response): ");
		
	im_msg.AddString("message", text);
	im_msg.AddBool("autoresponse", autoReply);
	im_msg.AddInt32("charset", fEncoding);
	
	fMsgr.SendMessage(&im_msg);											

	return B_OK;
};
开发者ID:louisdem,项目名称:IMKit,代码行数:19,代码来源:AIM.cpp

示例10: CountLanguages

BString
MSHLanguageMgr::_T(const char * stringTag)
{
	BString translation = stringTag;
	translation.Prepend("*");
	translation.Append("*");

	if (NULL != fTransFiles) {
		const int32 numLanguages = CountLanguages();
		if ((numLanguages > 0)) {
			if (fCurrentLanguage >= 0) {
				MSHLanguageFile* langFile =
						reinterpret_cast<MSHLanguageFile*>(fTransFiles->ItemAt(fCurrentLanguage));
				if (NULL != langFile) {
					langFile->GetStringForTag(stringTag, translation);
				}
			}
		}
	}

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

示例11: str

void
ICSTXTControl::MessageReceived(BMessage* message)
{
    switch (message->what) {
		case M_SEND_BUTTON:
        {
            AutoLocker<BLocker> autolocker(fLocker);

            BString str(fTxtControl->Text());

            if (str.Length() < 1)
                return;

            BString command = str;
            SendICS(command.Prepend("1000 "), Window());

            str.Prepend("\n").Append("\n");
            fTxtView->Insert(fTxtView->TextLength(), str, str.Length());
            float min, max;
            fScrollBar->GetRange(&min, &max);
            fScrollBar->SetValue(max);
            fTxtControl->SetText("");
            fTxtControl->MakeFocus();
			break;
        }

        case ICS_USER_CMD_RESPONSE:
        {
            BString str = "";
            message->FindString("info", &str);
            AddTxt(str);
            break;
        }

		default:
            BGroupView::MessageReceived(message);
			break;
	}
}
开发者ID:HaikuArchives,项目名称:Puri,代码行数:39,代码来源:ICSTXTControl.cpp

示例12: new

void
BNetworkCookieJar::UrlIterator::_Initialize()
{
	BString domain = fUrl.Host();

	if (!domain.Length()) {
		if (fUrl.Protocol() == "file")
			domain = "localhost";
		else
			return;
	}

	fIterator = new(std::nothrow) PrivateIterator(
		fCookieJar->fCookieHashMap->GetIterator());

	if (fIterator != NULL) {
		// Prepending a dot since _FindNext is going to call _SupDomain()
		domain.Prepend(".");
		fIterator->fKey.SetTo(domain, domain.Length());
		_FindNext();
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:22,代码来源:NetworkCookieJar.cpp

示例13: parent_dir

status_t 
FolderShaper::ShapeRef	(entry_ref * a_ref, const char * a_template, bool a_do_open)
{
	PRINT(("ShapeRef(%s, %s)\n", a_ref->name, a_template));

	status_t	status;

// store original_name
	
	BEntry	original_entry	(a_ref, true);
	original_entry.	GetRef	(a_ref);
	BString original_name 	= a_ref->name;
	BPath	original_path	(& original_entry);
	
	BString original_path_string = original_path.Path();
	NameSafe(& original_path_string);

	BPath	original_parent_path;
	original_path.GetParent(& original_parent_path);

	BDirectory parent_dir(original_parent_path.Path());

//	temp name
	BString new_name	=	a_ref->name;
	new_name.Prepend("New ");

	int32	counter	=	2;
	while(parent_dir.Contains(new_name.String()))
	{
		new_name = a_ref->name;
		new_name.Append(" (temporary ");
		new_name << counter;
		new_name.Append(")");		
		counter	++;
	}

	PRINT(("original_name: %s\n", original_name.String()));
	PRINT(("new_name: %s\n", new_name.String()));	
	
	PRINT(("original_path: %s\n", original_path.Path()));	
	PRINT(("original_path_string: %s\n", original_path_string.String()));	
	PRINT(("original_parent_path: %s\n", original_parent_path.Path()));	

	
	BPath	template_path	(m_tmpl_dir, a_template);

	BEntry	tmp_entry;		// traverse link to template
	if ((status = tmp_entry.SetTo(template_path.Path(), true)) != B_OK)
	{
		// message
		return status;
	}
	template_path.SetTo(& tmp_entry);
	
	BString	template_path_string 	=	template_path.Path();
	NameSafe(& template_path_string);
	PRINT(("template_path_string: %s\n", template_path_string.String()));		

	BPath	new_path	(original_parent_path.Path(), new_name.String());
	BString	new_path_string	=	new_path.Path();
	NameSafe(& new_path_string);
	PRINT(("new_path_string: %s\n", new_path_string.String()));			

	BString command;

	if(m_do_keep_position)
	{
		//	copy X/Y position attribute from Original Folder

		command = "copyattr -n _trk/pinfo_le ";
		command.Append(original_path_string);
		command.Append(" ");
		command.Append(template_path_string);
		
		PRINT(("copy X/Y position: \n%s\n", command.String()));
	
		system(command.String());
	}
	else
	{
		BNode template_node(& tmp_entry);
		template_node.RemoveAttr("_trk/pinfo_le");
	}
		
	
//	copy template -> "New name" (temp)

	command = "copyattr -d -r ";
	command.Append(template_path_string);
	command.Append(" ");
	command.Append(new_path_string);
	
	PRINT(("copy template -> temp: \n%s\n", command.String()));
	
	system(command.String());
	
//	New folder exists?

	BDirectory	new_directory;
	if((status = new_directory.SetTo(new_path.Path())) != B_OK)
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:FolderShaper,代码行数:101,代码来源:FSApp.cpp

示例14: if

void
TMailApp::RefsReceived(BMessage *msg)
{
	bool		have_names = false;
	BString		names;
	char		type[B_FILE_NAME_LENGTH];
	int32		item = 0;
	BFile		file;
	TMailWindow	*window;
	entry_ref	ref;

	//
	// If a tracker window opened me, get a messenger from it.
	//
	BMessenger messenger;
	if (msg->HasMessenger("TrackerViewToken"))
		msg->FindMessenger("TrackerViewToken", &messenger);

	while (msg->HasRef("refs", item)) {
		msg->FindRef("refs", item++, &ref);
		if ((window = FindWindow(ref)) != NULL)
			window->Activate(true);
		else {
			file.SetTo(&ref, O_RDONLY);
			if (file.InitCheck() == B_NO_ERROR) {
				BNodeInfo	node(&file);
				node.GetType(type);
				if (strcmp(type, B_MAIL_TYPE) == 0
					|| strcmp(type, B_PARTIAL_MAIL_TYPE) == 0) {
					window = NewWindow(&ref, NULL, false, &messenger);
					window->Show();
				} else if(strcmp(type, "application/x-person") == 0) {
					/* Got a People contact info file, see if it has an Email address. */
					BString name;
					BString email;
					attr_info	info;
					char *attrib;

					if (file.GetAttrInfo("META:email", &info) == B_NO_ERROR) {
						attrib = (char *) malloc(info.size + 1);
						file.ReadAttr("META:email", B_STRING_TYPE, 0, attrib, info.size);
						attrib[info.size] = 0; // Just in case it wasn't NUL terminated.
						email << attrib;
						free(attrib);

						/* we got something... */
						if (email.Length() > 0) {
							/* see if we can get a username as well */
							if(file.GetAttrInfo("META:name", &info) == B_NO_ERROR) {
								attrib = (char *) malloc(info.size + 1);
								file.ReadAttr("META:name", B_STRING_TYPE, 0, attrib, info.size);
								attrib[info.size] = 0; // Just in case it wasn't NUL terminated.
								name << "\"" << attrib << "\" ";
								email.Prepend("<");
								email.Append(">");
								free(attrib);
							}

							if (names.Length() == 0) {
								names << name << email;
							} else {
								names << ", " << name << email;
							}
							have_names = true;
							email.SetTo("");
							name.SetTo("");
						}
					}
				}
				else if (strcmp(type, kDraftType) == 0) {
					window = NewWindow();

					// If it's a draft message, open it
					window->OpenMessage(&ref);
					window->Show();
				}
			} /* end of else(file.InitCheck() == B_NO_ERROR */
		}
	}

	if (have_names) {
		window = NewWindow(NULL, names.String());
		window->Show();
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:85,代码来源:MailApp.cpp

示例15: update


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

		case kMsgAddExtension:
		{
			if (fCurrentType.Type() == NULL)
				break;

			BWindow* window = new ExtensionWindow(this, fCurrentType, NULL);
			window->Show();
			break;
		}

		case kMsgRemoveExtension:
		{
			int32 index = fExtensionListView->CurrentSelection();
			if (index < 0 || fCurrentType.Type() == NULL)
				break;

			BMessage extensions;
			if (fCurrentType.GetFileExtensions(&extensions) == B_OK) {
				extensions.RemoveData("extensions", index);
				fCurrentType.SetFileExtensions(&extensions);
			}
			break;
		}

		case kMsgRuleEntered:
		{
			// check rule
			BString parseError;
			if (BMimeType::CheckSnifferRule(fRuleControl->Text(), &parseError) != B_OK) {
				parseError.Prepend("Recognition rule is not valid:\n\n");
				error_alert(parseError.String());
			} else
				fCurrentType.SetSnifferRule(fRuleControl->Text());
			break;
		}

		// Description group

		case kMsgTypeEntered:
		{
			fCurrentType.SetShortDescription(fTypeNameControl->Text());
			break;
		}

		case kMsgDescriptionEntered:
		{
			fCurrentType.SetLongDescription(fDescriptionControl->Text());
			break;
		}

		// Preferred Application group

		case kMsgPreferredAppChosen:
		{
			const char* signature;
			if (message->FindString("signature", &signature) != B_OK)
				signature = NULL;

			fCurrentType.SetPreferredApp(signature);
			break;
		}
开发者ID:mmanley,项目名称:Antares,代码行数:66,代码来源:FileTypesWindow.cpp


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