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


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

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


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

示例1:

void
InitializeFATEditor::SetTo(BPartition* partition)
{
	BString name = partition->Name();
	if (name.IsEmpty())
		name = partition->ContentName();
	if (!name.IsEmpty())
		fNameControl->SetText(name.String());
}
开发者ID:Paradoxianer,项目名称:haiku,代码行数:9,代码来源:InitializeParameterEditor.cpp

示例2: commandReference

bool
CommandLineUserInterface::_RegisterCommand(const BString& name,
	CliCommand* command)
{
	BReference<CliCommand> commandReference(command, true);
	if (name.IsEmpty() || command == NULL)
		return false;

	BString nextName;
	int32 startIndex = 0;
	int32 spaceIndex;
	do {
		spaceIndex = name.FindFirst(' ', startIndex);
		if (spaceIndex == B_ERROR)
			spaceIndex = name.Length();
		name.CopyInto(nextName, startIndex, spaceIndex - startIndex);

		CommandEntry* entry = new(std::nothrow) CommandEntry(nextName,
			command);
		if (entry == NULL || !fCommands.AddItem(entry)) {
			delete entry;
			return false;
		}
		startIndex = spaceIndex + 1;
	} while (startIndex < name.Length());

	return true;
}
开发者ID:DonCN,项目名称:haiku,代码行数:28,代码来源:CommandLineUserInterface.cpp

示例3: lstat

bool
TermView::HyperLinkState::_EntryExists(const BString& path,
	BString& _actualPath) const
{
	if (path.IsEmpty())
		return false;

	if (path[0] == '/' || fCurrentDirectory.IsEmpty()) {
		_actualPath = path;
	} else if (path == "~" || path.StartsWith("~/")) {
		// Replace '~' with the user's home directory. We don't handle "~user"
		// here yet.
		BPath homeDirectory;
		if (find_directory(B_USER_DIRECTORY, &homeDirectory) != B_OK)
			return false;
		_actualPath = homeDirectory.Path();
		_actualPath << path.String() + 1;
	} else {
		_actualPath.Truncate(0);
		_actualPath << fCurrentDirectory << '/' << path;
	}

	struct stat st;
	return lstat(_actualPath, &st) == 0;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:25,代码来源:TermViewStates.cpp

示例4:

static void
PutFlag(BString& string, const char* flag)
{
	if (!string.IsEmpty())
		string += " ";
	string += flag;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:7,代码来源:Commands.cpp

示例5: ERROR

/*static*/ status_t
FSUtils::OpenSubDirectory(const BDirectory& baseDirectory,
                          const RelativePath& path, bool create, BDirectory& _directory)
{
    // get a string for the path
    BString pathString = path.ToString();
    if (pathString.IsEmpty())
        RETURN_ERROR(B_NO_MEMORY);

    // If creating is not allowed, just try to open it.
    if (!create)
        RETURN_ERROR(_directory.SetTo(&baseDirectory, pathString));

    // get an absolute path and create the subdirectory
    BPath absolutePath;
    status_t error = absolutePath.SetTo(&baseDirectory, pathString);
    if (error != B_OK) {
        ERROR("Volume::OpenSubDirectory(): failed to get absolute path "
              "for subdirectory \"%s\": %s\n", pathString.String(),
              strerror(error));
        RETURN_ERROR(error);
    }

    error = create_directory(absolutePath.Path(),
                             S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
    if (error != B_OK) {
        ERROR("Volume::OpenSubDirectory(): failed to create "
              "subdirectory \"%s\": %s\n", pathString.String(),
              strerror(error));
        RETURN_ERROR(error);
    }

    RETURN_ERROR(_directory.SetTo(&baseDirectory, pathString));
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:34,代码来源:FSUtils.cpp

示例6:

void
InfoWin::_UpdateFile()
{
	bool iconSet = false;
	if (fController->HasFile()) {
		const PlaylistItem* item = fController->Item();
		iconSet = fIconView->SetIcon(item) == B_OK;
		media_file_format fileFormat;
		status_t status = fController->GetFileFormatInfo(&fileFormat);
		if (status == B_OK) {
			fContainerInfo->SetText(fileFormat.pretty_name);
			if (!iconSet)
				iconSet = fIconView->SetIcon(fileFormat.mime_type) == B_OK;
		} else
			fContainerInfo->SetText(strerror(status));

		BString info;
		if (fController->GetLocation(&info) != B_OK)
			info = B_TRANSLATE("<unknown>");
		fLocationInfo->SetText(info.String());
		fLocationInfo->SetToolTip(info.String());

		if (fController->GetName(&info) != B_OK || info.IsEmpty())
			info = B_TRANSLATE("<unnamed media>");
		fFilenameView->SetText(info.String());
		fFilenameView->SetToolTip(info.String());
	} else {
		fFilenameView->SetText(B_TRANSLATE("<no media>"));
		fContainerInfo->SetText("-");
		fLocationInfo->SetText("-");
	}

	if (!iconSet)
		fIconView->SetGenericIcon();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:35,代码来源:InfoWin.cpp

示例7: if

void
TeamWindow::_UpdateSourcePathState()
{
	LocatableFile* sourceFile = NULL;
	BString sourceText = "Source file unavailable.";
	BString truncatedText;

	if (fActiveSourceCode != NULL) {
		sourceFile = fActiveFunction->GetFunctionDebugInfo()->SourceFile();

		if (sourceFile != NULL && !sourceFile->GetLocatedPath(sourceText))
			sourceFile->GetPath(sourceText);

		if (fActiveFunction->GetFunction()->SourceCodeState()
			!= FUNCTION_SOURCE_NOT_LOADED
			&& fActiveSourceCode->GetSourceFile() == NULL
			&& sourceFile != NULL) {
			sourceText.Prepend("Click to locate source file '");
			sourceText += "'";
			truncatedText = sourceText;
			fSourcePathView->TruncateString(&truncatedText, B_TRUNCATE_MIDDLE,
				fSourcePathView->Bounds().Width());
		} else if (sourceFile != NULL)
			sourceText.Prepend("File: ");
	}

	if (!truncatedText.IsEmpty() && truncatedText != sourceText) {
		fSourcePathView->SetToolTip(sourceText);
		fSourcePathView->SetText(truncatedText);
	} else
		fSourcePathView->SetText(sourceText);
}
开发者ID:DonCN,项目名称:haiku,代码行数:32,代码来源:TeamWindow.cpp

示例8: FindJob

void
LaunchDaemon::_AddJob(Target* target, bool service, BMessage& message)
{
	BString name = message.GetString("name");
	if (name.IsEmpty()) {
		// Invalid job description
		return;
	}
	name.ToLower();

	Job* job = FindJob(name);
	if (job == NULL) {
		job = new (std::nothrow) Job(name);
		if (job == NULL)
			return;

		job->SetService(service);
		job->SetCreateDefaultPort(service);
		job->SetTarget(target);
	}

	if (message.HasBool("disabled"))
		job->SetEnabled(!message.GetBool("disabled", !job->IsEnabled()));

	if (message.HasBool("legacy"))
		job->SetCreateDefaultPort(!message.GetBool("legacy", !service));

	_SetCondition(job, message);
	_SetEvent(job, message);
	_SetEnvironment(job, message);

	BMessage portMessage;
	for (int32 index = 0;
			message.FindMessage("port", index, &portMessage) == B_OK; index++) {
		job->AddPort(portMessage);
	}

	if (message.HasString("launch")) {
		job->Arguments().MakeEmpty();

		const char* argument;
		for (int32 index = 0; message.FindString("launch", index, &argument)
				== B_OK; index++) {
			job->AddArgument(argument);
		}
	}

	const char* requirement;
	for (int32 index = 0;
			message.FindString("requires", index, &requirement) == B_OK;
			index++) {
		job->AddRequirement(requirement);
	}
	if (fInitTarget != NULL)
		job->AddRequirement(fInitTarget->Name());

	fJobs.insert(std::make_pair(job->Title(), job));
}
开发者ID:puckipedia,项目名称:haiku,代码行数:58,代码来源:LaunchDaemon.cpp

示例9: SaveString

static inline status_t SaveString(BMessage &msg, const char *string, BString data)
{
	if(data == NULL || data.IsEmpty())
		return B_ERROR;
	
	if(msg.ReplaceString(string, data) == B_NAME_NOT_FOUND)
		return msg.AddString(string, data);
	return msg.ReplaceString(string, data);
}
开发者ID:ModeenF,项目名称:snes9x_haiku,代码行数:9,代码来源:s9x_settings.cpp

示例10: dir

BMailFilterAction
RuleFilter::HeaderFetched(entry_ref& ref, BFile& file, BMessage& attributes)
{
	// That field doesn't exist? NO match
	if (fAttribute == "")
		return B_NO_MAIL_ACTION;

	attr_info info;
	if (file.GetAttrInfo("Subject", &info) != B_OK
		|| info.type != B_STRING_TYPE)
		return B_NO_MAIL_ACTION;

	BString data = attributes.GetString(fAttribute.String(), NULL);
	if (data.IsEmpty() || !fMatcher.Match(data)) {
		// We're not supposed to do anything
		return B_NO_MAIL_ACTION;
	}

	switch (fAction) {
		case ACTION_MOVE_TO:
		{
			BDirectory dir(fMoveTarget);
			node_ref nodeRef;
			status_t status = dir.GetNodeRef(&nodeRef);
			if (status != B_OK)
				return status;

			ref.device = nodeRef.device;
			ref.directory = nodeRef.node;
			return B_MOVE_MAIL_ACTION;
		}

		case ACTION_DELETE_MESSAGE:
			return B_DELETE_MAIL_ACTION;

		case ACTION_SET_FLAGS_TO:
			file.WriteAttrString("MAIL:filter_flags", &fSetFlags);
			break;

		case ACTION_REPLY_WITH:
			file.WriteAttr("MAIL:reply_with", B_INT32_TYPE, 0, &fReplyAccount,
				sizeof(int32));
			break;
		case ACTION_SET_AS_READ:
		{
			BInboundMailProtocol& protocol
				= (BInboundMailProtocol&)fMailProtocol;
			protocol.MarkMessageAsRead(ref, B_READ);
			break;
		}
		default:
			fprintf(stderr,"Unknown do_what: 0x%04x!\n", fAction);
	}

	return B_NO_MAIL_ACTION;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:56,代码来源:RuleFilter.cpp

示例11: MakePath

	BString MakePath(const BPackageEntry* entry)
	{
		BString path;
		while (entry != NULL) {
			if (!path.IsEmpty())
				path.Prepend('/', 1);
			path.Prepend(entry->Name());
			entry = entry->Parent();
		}
		return path;
	}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例12: GetInstallationLocationInfo

status_t
BDaemonClient::CreateTransaction(BPackageInstallationLocation location,
	BActivationTransaction& _transaction, BDirectory& _transactionDirectory)
{
	// get an info for the location
	BInstallationLocationInfo info;
	status_t error = GetInstallationLocationInfo(location, info);
	if (error != B_OK)
		return error;

	// open admin directory
	entry_ref entryRef;
	entryRef.device = info.PackagesDirectoryRef().device;
	entryRef.directory = info.PackagesDirectoryRef().node;
	error = entryRef.set_name(PACKAGES_DIRECTORY_ADMIN_DIRECTORY);
	if (error != B_OK)
		return error;
	
	BDirectory adminDirectory;
	error = adminDirectory.SetTo(&entryRef);
	if (error != B_OK)
		return error;

	// create a transaction directory
	int uniqueId = 1;
	BString directoryName;
	for (;; uniqueId++) {
		directoryName.SetToFormat("transaction-%d", uniqueId);
		if (directoryName.IsEmpty())
			return B_NO_MEMORY;

		error = adminDirectory.CreateDirectory(directoryName,
			&_transactionDirectory);
		if (error == B_OK)
			break;
		if (error != B_FILE_EXISTS)
			return error;
	}

	// init the transaction
	error = _transaction.SetTo(location, info.ChangeCount(), directoryName);
	if (error != B_OK) {
		BEntry entry;
		_transactionDirectory.GetEntry(&entry);
		_transactionDirectory.Unset();
		if (entry.InitCheck() == B_OK)
			entry.Remove();
		return error;
	}

	return B_OK;
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:52,代码来源:DaemonClient.cpp

示例13: commandReference

bool
CommandLineUserInterface::_RegisterCommand(const BString& name,
	CliCommand* command)
{
	BReference<CliCommand> commandReference(command, true);
	if (name.IsEmpty() || command == NULL)
		return false;

	CommandEntry* entry = new(std::nothrow) CommandEntry(name, command);
	if (entry == NULL || !fCommands.AddItem(entry)) {
		delete entry;
		return false;
	}

	return true;
}
开发者ID:mmadia,项目名称:haiku,代码行数:16,代码来源:CommandLineUserInterface.cpp

示例14:

status_t
BActivationTransaction::SetTo(BPackageInstallationLocation location,
	int64 changeCount, const BString& directoryName)
{
	if (location < 0 || location >= B_PACKAGE_INSTALLATION_LOCATION_ENUM_COUNT
		|| directoryName.IsEmpty()) {
		return B_BAD_VALUE;
	}

	fLocation = location;
	fChangeCount = changeCount;
	fTransactionDirectoryName = directoryName;
	fPackagesToActivate.MakeEmpty();
	fPackagesToDeactivate.MakeEmpty();

	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:17,代码来源:ActivationTransaction.cpp

示例15:

bool
DepotMatchingRepositoryListener::Handle(DumpExportRepository* repository)
{
	int32 i;

	for (i = 0; i < repository->CountRepositorySources(); i++) {
		repository_and_repository_source repositoryAndRepositorySource;
		repositoryAndRepositorySource.repository = repository;
		repositoryAndRepositorySource.repositorySource =
			repository->RepositorySourcesItemAt(i);

		BString* repoInfoURL = repositoryAndRepositorySource
			.repositorySource->RepoInfoUrl();

		if (!repoInfoURL->IsEmpty()) {
			fModel->ReplaceDepotByUrl(*repoInfoURL, this,
				&repositoryAndRepositorySource);
		}
	}

	return !fStoppable->WasStopped();
}
开发者ID:looncraz,项目名称:haiku,代码行数:22,代码来源:ServerRepositoryDataUpdateProcess.cpp


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