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


C++ BEntry函数代码示例

本文整理汇总了C++中BEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ BEntry函数的具体用法?C++ BEntry怎么用?C++ BEntry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: winpath

void
FieldView::SetSoundRefs(void)
{
	BPath winpath(fThemePath.String());
	winpath.Append(gGameStyle->StyleName());
	winpath.Append("win.ogg");
	entry_ref winSoundRef;
	BEntry(winpath.Path()).GetRef(&winSoundRef);
	fWinPlayer = new BFileGameSound(&winSoundRef, false);
	fWinPlayer->Preload();

	BPath losepath(fThemePath.String());
	losepath.Append(gGameStyle->StyleName());
	losepath.Append("lose.ogg");
	entry_ref loseSoundRef;
	BEntry(losepath.Path()).GetRef(&loseSoundRef);
	fLosePlayer = new BFileGameSound(&loseSoundRef, false);
	fLosePlayer->Preload();

	BPath clickpath(fThemePath.String());
	clickpath.Append(gGameStyle->StyleName());
	clickpath.Append("click.ogg");
	entry_ref clickSoundRef;
	BEntry(clickpath.Path()).GetRef(&clickSoundRef);
	fClickPlayer = new BFileGameSound(&clickSoundRef, false);
	fClickPlayer->Preload();
}
开发者ID:HaikuArchives,项目名称:BeMines,代码行数:27,代码来源:FieldView.cpp

示例2: Copy_Loop

void Copy_Loop(entry_ref* ref)
{
	entry_ref temp_ref, t_ref, t_ref2;
	status_t err;
	char temp_char[4096];
	BPath temp_path;
	BDirectory* temp_dir;
	BEntry temp_entry;
	temp_dir = new BDirectory(ref);
	while (temp_dir->GetNextRef(&temp_ref) == B_OK) {
		if (BEntry(&temp_ref, true).IsDirectory()) {
			BFSDir->GetEntry(&temp_entry);
			temp_entry.GetPath(&temp_path);
			memset(temp_char, 0, sizeof(temp_char));
			sprintf(temp_char, "%s/%s", temp_path.Path(), temp_ref.name);
			if ((err = BFSDir->CreateDirectory(temp_char, NULL)) == B_OK) {
				if (BFSDir->SetTo(temp_char) == B_OK) {
					Copy_Loop(&temp_ref);
					BFSDir->SetTo(temp_path.Path());
				}
			}
		} else {
			if (BFSDir->GetEntry(&temp_entry) == B_OK) {
				if (temp_entry.GetPath(&temp_path) == B_OK) {
					sprintf(temp_char, "%s/%s", temp_path.Path(), temp_ref.name);
					BEntry(&temp_ref, true).GetRef(&t_ref2);
					if (BEntry(temp_char, true).GetRef(&t_ref) == B_OK)
						CopyFile(t_ref2, t_ref);
				}
			}
		}
	}
	delete temp_dir;
}
开发者ID:Admixior,项目名称:BurnItNow,代码行数:34,代码来源:MakeBFS.cpp

示例3: uninstall_asst

//------------------------------------------------------------------------------
status_t	uninstall_asst(bool oSilent)
{
	BEntry(static_cast<const char*>(asst_install_path(FOLDER_NAME_ASST_SPY).c_str())).Remove();
	BEntry(static_cast<const char*>(asst_install_path(FOLDER_NAME_ASST_PASTE_SENDER).c_str())).Remove();
	if ( !oSilent ) {
		show_alert3(alert_caption(), _T(LKK_INFO_UNINSTALLED_ASST) , _T(LKK_BUTTON_OK));
	}
	if ( is_asst_installed() )
		return B_ERROR;
	return B_OK;
}
开发者ID:BackupTheBerlios,项目名称:textbank,代码行数:12,代码来源:Common.cpp

示例4: BEntry

	~TemporaryFile()
	{
		if (fDeleteFile) {
			fFile.Unset();
			BEntry(fPath.Path()).Remove();
		}
	}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:7,代码来源:IMAPFolder.cpp

示例5: CopyFiles

status_t CopyFiles()
{
	entry_ref temp_ref;
	BEntry(BURN_DIR).GetRef(&temp_ref);
	Copy_Loop(&temp_ref);
	return B_OK;
}
开发者ID:Admixior,项目名称:BurnItNow,代码行数:7,代码来源:MakeBFS.cpp

示例6: find_directory

status_t
AGMSBayesianSpamFilter::_CheckForSpamServer()
{
	// Make sure the server is running.
	if (be_roster->IsRunning (kServerSignature))
		return B_OK;

	status_t errorCode = be_roster->Launch (kServerSignature);
	if (errorCode == B_OK)
		return errorCode;

	BPath path;
	entry_ref ref;
	directory_which places[] = {B_COMMON_BIN_DIRECTORY,B_BEOS_BIN_DIRECTORY};
	for (int32 i = 0; i < 2; i++) {
		find_directory(places[i],&path);
		path.Append("spamdbm");
		if (!BEntry(path.Path()).Exists())
			continue;
		get_ref_for_path(path.Path(),&ref);
		if ((errorCode =  be_roster->Launch(&ref)) == B_OK)
			break;
	}

	return errorCode;
}
开发者ID:jiangxilong,项目名称:haiku,代码行数:26,代码来源:SpamFilter.cpp

示例7: managerLocker

int32
VirtualDirectoryEntryList::GetNextDirents(struct dirent* buffer, size_t length,
	int32 count)
{
	if (count > 1)
		count = 1;

	int32 countRead = fMergedDirectory.GetNextDirents(buffer, length, count);
	if (countRead != 1)
		return countRead;

	// deal with directories
	entry_ref ref;
	ref.device = buffer->d_pdev;
	ref.directory = buffer->d_pino;
	if (ref.set_name(buffer->d_name) == B_OK && BEntry(&ref).IsDirectory()) {
		if (VirtualDirectoryManager* manager
				= VirtualDirectoryManager::Instance()) {
			AutoLocker<VirtualDirectoryManager> managerLocker(manager);
			manager->TranslateDirectoryEntry(fDefinitionFileRef, buffer);
		}
	}

	return countRead;
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:25,代码来源:VirtualDirectoryEntryList.cpp

示例8: libpath

void
Project::AddLibrary(const char *path)
{
	if (!path)
		return;
	
	DPath libpath(path);
	if (!BEntry(libpath.GetFullPath()).Exists())
	{
		libpath = FindLibrary(libpath.GetFileName());
		if (libpath.IsEmpty())
		{
			if (gBuildMode)
			{
				printf("%s seems to be missing\n", path);
			}
			else
			{
				BString err;
				err << path << " seems to be missing. Do you want to remove it from the project?";
				int32 result = ShowAlert(err.String(),"Remove","Keep");
				if (result == 0)
					return;
			}
		}
	}
	
	if (!HasLibrary(libpath.GetFullPath()))
	{
		STRACE(1,("%s: Added library %s\n",GetName(),libpath.GetFullPath()));
		fLibraryList.AddItem(gFileFactory.CreateSourceFileItem(libpath.GetFullPath()));
	}
}
开发者ID:passick,项目名称:Paladin,代码行数:33,代码来源:Project.cpp

示例9: PlayMediaFile

void
PlayMediaFile(const char* media_type, const char* media_name)
{
	entry_ref ref;
	if (BMediaFiles().GetRefFor(media_type, media_name, &ref) != B_OK
		|| !BEntry(&ref).Exists())
		return;

	MediaFilePlayer* player = list.EachElement(FindMediaFilePlayer,
		(void*)media_name);

	if (player != NULL) {
		if (*(player->Ref()) == ref) {
			player->Restart();
			return;
		}

		list.RemoveItem(player);
		delete player;
		player = NULL;
	}

	if (player == NULL) {
		player = new MediaFilePlayer(media_type, media_name, &ref);
		if (player->InitCheck() == B_OK)
			list.AddItem(player);
		else
			delete player;
	}
}
开发者ID:garodimb,项目名称:haiku,代码行数:30,代码来源:MediaFilePlayer.cpp

示例10: DetectPlatform

platform_t
DetectPlatform(void)
{
	platform_t type = PLATFORM_R5;
	
	// While, yes, there is a uname() function in sys/utsname.h, we use spawn a shell
	// so that we can easily avoid the build mess of BONE vs netserver.
	// Use ShellHelper class to avoid problems with popen() causing hangs. :/
	ShellHelper shell;
	BString osname;
	
	shell << "uname" << "-o";
	shell.RunInPipe(osname, false);
	
	if (osname.FindFirst("Haiku\n") == 0)
	{
		BPath libpath;
		find_directory(B_BEOS_LIB_DIRECTORY,&libpath);
		libpath.Append("libsupc++.so");
		type =  BEntry(libpath.Path()).Exists() ? PLATFORM_HAIKU_GCC4 : PLATFORM_HAIKU;
	}
	else if (osname.FindFirst("Zeta\n") == 0)
		type = PLATFORM_ZETA;
	else
		printf("Detected platform from uname: %s\n", osname.String());
	
	return type;
}
开发者ID:passick,项目名称:Paladin,代码行数:28,代码来源:Project.cpp

示例11: path

bool
App::QuickImportProject(DPath folder)
{
	// Quickly makes a project in a folder by importing all resource files and C++ sources.
	if (!BEntry(folder.GetFullPath()).Exists())
		return false;

	BMessage settings;
	settings.AddString("name", folder.GetFileName());
	settings.AddString("target", folder.GetFileName());
	// skipping templatename field on purpose
	settings.AddInt32("type", PROJECT_GUI);
	settings.AddString("path", folder.GetFullPath());
	settings.AddInt32("scmtype", gDefaultSCM);
	settings.AddBool("createfolder", false);
	
	DPath path(folder);
	BEntry entry(path.GetFullPath());
	Project *proj = CreateNewProject(settings);
	if (!proj)
		return false;
	
	entry.SetTo(folder.GetFullPath());
	entry_ref addref;
	entry.GetRef(&addref);
	BMessage addmsg(M_ADD_FILES);
	addmsg.AddRef("refs",&addref);
	
	PostToProjectWindow(&addmsg,NULL);
	return true;
}
开发者ID:humdingerb,项目名称:Paladin,代码行数:31,代码来源:Paladin.cpp

示例12: entry

Model::CanHandleResult 
Model::CanHandleDrops() const
{
	if (IsDirectory())
		// directories take anything
		// resolve permissions here 
		return kCanHandle;
		
		
	if (IsSymLink()) {
		// descend into symlink and try again on it's target

		BEntry entry(&fEntryRef, true);
		if (entry.InitCheck() != B_OK)
			return kCannotHandle;
		
		if (entry == BEntry(EntryRef()))
			// self-referencing link, avoid infinite recursion
			return kCannotHandle;

		Model model(&entry);
		if (model.InitCheck() != B_OK)
			return kCannotHandle;

		return model.CanHandleDrops();
	}
	
	if (IsExecutable())
		return kNeedToCheckType;

	return kCannotHandle;
}
开发者ID:HaikuArchives,项目名称:OpenTracker,代码行数:32,代码来源:Model.cpp

示例13: update_file_in_dropbox

/*
* Given a local file path,
* update the corresponding file on Dropbox
*/
void
update_file_in_dropbox(const char * filepath, const char *parent_rev)
{
  char * argv[4];
  argv[0] = "db_put.py";

  BString db_filepath = local_to_db_filepath(filepath);
  const char * tmp = db_filepath.String();
  char not_const[db_filepath.CountChars()];
  strcpy(not_const,tmp);
  argv[2] = not_const;

  char not_const2[strlen(filepath)];
  strcpy(not_const2,filepath);
  argv[1] = not_const2;

  char not_const3[strlen(parent_rev)];
  strcpy(not_const3,parent_rev);
  argv[3] = not_const3;

  BString *result = run_python_script(argv,4);
  BString *real_path = parse_path(result);
  BString *new_parent_rev = parse_parent_rev(result);
  delete result;

  printf("path:|%s|\nparent_rev:|%s|\n",real_path->String(),new_parent_rev->String());

  BNode node = BNode(filepath);
  set_parent_rev(&node,new_parent_rev);
  delete new_parent_rev;

  BEntry entry = BEntry(filepath);
  BPath old_path;
  entry.GetPath(&old_path);

  BPath new_path = BPath(db_to_local_filepath(real_path->String()).String());

  printf("Should I move %s to %s?\n", old_path.Path(), new_path.Path());
  if(strcmp(new_path.Leaf(),old_path.Leaf()) != 0)
  {
    printf("moving %s to %s\n", old_path.Leaf(), new_path.Leaf());
    BEntry entry = BEntry(old_path.Path()); //entry for local path
    status_t err = entry.Rename(new_path.Leaf(),true);
    if(err != B_OK) printf("error moving: %s\n",strerror(err));
  }
  delete real_path;
}
开发者ID:astrieanna,项目名称:haiku-dropbox-client,代码行数:51,代码来源:HaikuDropbox.cpp

示例14: objname

bool
SourceFileRez::CheckNeedsBuild(BuildInfo &info, bool check_deps)
{
	if (!info.objectFolder.GetFullPath())
		return false;
	
	if (BString(GetPath().GetExtension()).ICompare("r") != 0)
		return false;
	
	if (BuildFlag() == BUILD_YES)
		return true;
	
	BString objname(GetPath().GetBaseName());
	objname << ".rsrc";
	
	DPath objpath(info.objectFolder);
	objpath.Append(objname);
	if (!BEntry(objpath.GetFullPath()).Exists())
		return true;
	
	BString tmpname(GetPath().GetBaseName());
	tmpname << ".r.txt";
	
	DPath tmppath(info.objectFolder);
	tmppath.Append(tmpname);
	if (!BEntry(tmppath.GetFullPath()).Exists())
		return true;
	
	
	struct stat objstat;
	if (stat(objpath.GetFullPath(),&objstat) != 0)
		return false;
	
	// Fix mod times set into the future
	time_t now = real_time_clock();
	if (GetModTime() > now)
	{
		BNode node(GetPath().GetFullPath());
		node.SetModificationTime(now);
	}
	
	if (GetModTime() > objstat.st_mtime)
		return true;
	
	return false;
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:46,代码来源:SourceTypeRez.cpp

示例15: find_directory

void
AGMSBayesianSpamFilterConfig::ShowSpamServerConfigurationWindow () {
	status_t    errorCode = B_OK;
	BMessage    maximizeCommand;
	BMessenger	messengerToServer;
	BMessage    replyMessage;

	// Make sure the server is running.
	if (!be_roster->IsRunning (kServerSignature)) {
			errorCode = be_roster->Launch (kServerSignature);
			if (errorCode != B_OK) {
				BPath path;
				entry_ref ref;
				directory_which places[] = {
					B_SYSTEM_NONPACKAGED_BIN_DIRECTORY,
					B_SYSTEM_BIN_DIRECTORY
				};
				for (int32 i = 0; i < 2; i++) {
					find_directory(places[i],&path);
					path.Append("spamdbm");
					if (!BEntry(path.Path()).Exists())
						continue;
					get_ref_for_path(path.Path(),&ref);
					if ((errorCode =  be_roster->Launch (&ref)) == B_OK)
						break;
				}
				if (errorCode != B_OK)
					goto ErrorExit;
			}
		}
	
	// Set up the messenger to the database server.
	messengerToServer =
		BMessenger (kServerSignature);
	if (!messengerToServer.IsValid ())
		goto ErrorExit;

	// Wait for the server to finish starting up, and for it to create the window.
	snooze (2000000);

	// Tell it to show its main window, in case it is hidden in server mode.
	maximizeCommand.what = B_SET_PROPERTY;
	maximizeCommand.AddBool ("data", false);
	maximizeCommand.AddSpecifier ("Minimize");
	maximizeCommand.AddSpecifier ("Window", (int32)0);
	errorCode = messengerToServer.SendMessage (&maximizeCommand, &replyMessage);
	if (errorCode != B_OK)
		goto ErrorExit;
	return; // Successful.

ErrorExit:
	BAlert* alert = new BAlert ("SpamFilterConfig Error", B_TRANSLATE("Sorry, "
		"unable to launch the spamdbm program to let you edit the server "
		"settings."), B_TRANSLATE("Close"));
	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	alert->Go ();
	return;
}
开发者ID:DonCN,项目名称:haiku,代码行数:58,代码来源:SpamFilterConfig.cpp


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