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


C++ BEntry::GetRef方法代码示例

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


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

示例1: msg

status_t
BackgroundThemesAddon::RunPreferencesPanel()
{
/*	if (be_roster->Launch("application/x-vnd.obos-Backgrounds") < B_OK)
		if (be_roster->Launch("application/x-vnd.Be-Backgrounds") < B_OK)
			return B_ERROR;*/
	status_t err;
	entry_ref ref;
	BEntry ent;
	err = ent.SetTo("/boot/beos/preferences/Backgrounds");
	if (!err) {
		err = ent.GetRef(&ref);
		if (!err) {
			err = be_roster->Launch(&ref);
		}
	}
	if (!err)
		return B_OK;
	err = ent.SetTo("/system/add-ons/Preferences/Backgrounds");
	if (!err) {
		err = ent.GetRef(&ref);
		if (!err) {
			err = be_roster->Launch(&ref);
			if (err) {
				BMessage msg(B_REFS_RECEIVED);
				msg.AddRef("refs", &ref);
				be_app_messenger.SendMessage(&msg);
			}
		}
	}
	return err;
}
开发者ID:luciang,项目名称:haiku,代码行数:32,代码来源:BackgroundsAddon.cpp

示例2:

status_t
ScreensaverThemesAddon::RunPreferencesPanel()
{
	// Haiku
	if (be_roster->Launch("application/x-vnd.Haiku-ScreenSaver") == B_OK)
		return B_OK;

	status_t err;
	entry_ref ref;
	BEntry ent;

	// BeOS
	err = ent.SetTo("/boot/beos/preferences/ScreenSaver");
	if (!err) {
		err = ent.GetRef(&ref);
		if (!err) {
			err = be_roster->Launch(&ref);
		}
	}
	if (!err)
		return B_OK;
	// ZETA
	err = ent.SetTo("/system/add-ons/Preferences/ScreenSaver");
	if (!err) {
		err = ent.GetRef(&ref);
		if (!err) {
			err = be_roster->Launch(&ref);
		}
	}
	return err;
}
开发者ID:HaikuArchives,项目名称:HaikuThemeManager,代码行数:31,代码来源:ScreensaverAddon.cpp

示例3: if

void
TBarWindow::MenusBeginning()
{
	BPath path;
	entry_ref ref;
	BEntry entry;

	if (GetDeskbarSettingsDirectory(path) == B_OK
		&& path.Append(kDeskbarMenuEntriesFileName) == B_OK
		&& entry.SetTo(path.Path(), true) == B_OK
		&& entry.Exists()
		&& entry.GetRef(&ref) == B_OK) {
		sDeskbarMenu->SetNavDir(&ref);
	} else if (GetDeskbarDataDirectory(path) == B_OK
		&& path.Append(kDeskbarMenuEntriesFileName) == B_OK
		&& entry.SetTo(path.Path(), true) == B_OK
		&& entry.Exists()
		&& entry.GetRef(&ref) == B_OK) {
		sDeskbarMenu->SetNavDir(&ref);
	} else {
		//	this really should never happen
		TRESPASS();
		return;
	}

	sDeskbarMenu->ResetTargets();

	fShowingMenu = true;
	BWindow::MenusBeginning();
}
开发者ID:looncraz,项目名称:haiku,代码行数:30,代码来源:BarWindow.cpp

示例4: msg

status_t
SoundsThemesAddon::RunPreferencesPanel()
{
	status_t err;
	entry_ref ref;
	BEntry ent;
	err = ent.SetTo("/boot/beos/preferences/Sounds");
	if (!err) {
		err = ent.GetRef(&ref);
		if (!err) {
			err = be_roster->Launch(&ref);
		}
	}
	if (!err)
		return B_OK;
	err = ent.SetTo("/system/add-ons/Preferences/Sounds");
	if (!err) {
		err = ent.GetRef(&ref);
		if (!err) {
			err = be_roster->Launch(&ref);
			if (err) {
				BMessage msg(B_REFS_RECEIVED);
				msg.AddRef("refs", &ref);
				be_app_messenger.SendMessage(&msg);
			}
		}
	}
	return err;
}
开发者ID:mmanley,项目名称:Antares,代码行数:29,代码来源:SoundsAddon.cpp

示例5: FlattenedSize

/*!	\brief Converts the object's pathname to an entry_ref and writes it into
	buffer.
	Implements BFlattenable.
	\param buffer the buffer the data shall be stored in
	\param size the size of \a buffer
	\return
	- \c B_OK: Everything went fine.
	- \c B_BAD_VALUE: \c NULL buffer or the buffer is of insufficient size.
	- other error codes.
	\todo Reimplement for performance reasons: Don't call FlattenedSize().
*/
status_t
BPath::Flatten(void* buffer, ssize_t size) const
{
	if (buffer == NULL)
		return B_BAD_VALUE;

	ssize_t flattenedSize = FlattenedSize();
	if (flattenedSize < 0)
		return flattenedSize;
	if (size < flattenedSize)
		return B_BAD_VALUE;
	status_t status = InitCheck();
	if (status != B_OK)
		return status;

	// convert the path to an entry_ref
	BEntry entry;
	entry_ref ref;
	status = entry.SetTo(Path());
	if (status == B_OK)
		status = entry.GetRef(&ref);
	if (status != B_OK)
		return status;

	// store the entry_ref in the buffer
	flattened_entry_ref& fref = *(flattened_entry_ref*)buffer;
	fref.device = ref.device;
	fref.directory = ref.directory;
	if (ref.name)
		strcpy(fref.name, ref.name);

	return B_OK;
}
开发者ID:mariuz,项目名称:haiku,代码行数:44,代码来源:Path.cpp

示例6: OpenWorksheet

PDoc* PApp::OpenWorksheet()
{
	try
	{
		if (!gPrefsDir.Contains("Worksheet", B_FILE_NODE | B_SYMLINK_NODE))
		{
			BFile file;
			gPrefsDir.CreateFile("Worksheet", &file);
		}

		BEntry w;
		entry_ref wr;

		FailOSErr(gPrefsDir.FindEntry("Worksheet", &w, true));
		FailOSErr(w.GetRef(&wr));
		OpenWindow(wr);

		PDoc *d = dynamic_cast<PDoc*>(CDoc::FindDoc(wr));
		if (d)
			d->MakeWorksheet();

		return d;
	}
	catch (HErr& e)
	{
		e.DoError();
	}

	return NULL;
} /* PApp::OpenWorksheet */
开发者ID:jscipione,项目名称:Paladin,代码行数:30,代码来源:PApp.cpp

示例7: msg

// Helper function that contacts the registrar for mime update calls
status_t
do_mime_update(int32 what, const char *path, int recursive,
	int synchronous, int force)
{
	BEntry root;
	entry_ref ref;

	status_t err = root.SetTo(path ? path : "/");
	if (!err)
		err = root.GetRef(&ref);
	if (!err) {
		BMessage msg(what);
		BMessage reply;
		status_t result;

		// Build and send the message, read the reply
		if (!err)
			err = msg.AddRef("entry", &ref);
		if (!err)
			err = msg.AddBool("recursive", recursive);
		if (!err)
			err = msg.AddBool("synchronous", synchronous);
		if (!err)
			err = msg.AddInt32("force", force);
		if (!err)
			err = BRoster::Private().SendTo(&msg, &reply, true);
		if (!err)
			err = reply.what == B_REG_RESULT ? B_OK : B_BAD_VALUE;
		if (!err)
			err = reply.FindInt32("result", &result);
		if (!err)
			err = result;
	}
	return err;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:36,代码来源:Mime.cpp

示例8: AddEntry

bool SeqNavMenu::AddEntry(BEntry& entry, bool useLeafForLabel)
{
	BPath			path;
	if( entry.GetPath( &path ) != B_OK ) {
		printf("\tquery returned an entry but couldn't get the path\n");
		return false;
	}
	const char*		label = (useLeafForLabel) ? path.Leaf(): path.Path();
	if( !label ) return false;
	_AmIconMenuItem* item = 0;
	uint32			tmpEntry;
	if( entry.IsDirectory() ) {
		tmpEntry = DIR_ENTRY;
		SeqNavMenu*	nm = new SeqNavMenu( label, mTarget );
		if( nm && (item = new _AmIconMenuItem( nm )) ) {
			nm->SetPath( path.Path() );
		}
	} else {
		tmpEntry = OTHER_ENTRY;
		BMessage*		msg = new BMessage( B_REFS_RECEIVED );
		entry_ref		ref;
		if( msg && (entry.GetRef( &ref ) == B_OK) ) {
			msg->AddRef( "refs", &ref );
			item = new _AmIconMenuItem( label, msg );
		}
	}

	if( item ) {
		mItems.push_back( item );
		item->SetIcon( GetIcon( entry ) );
		if( mFirstEntry == NO_ENTRY ) mFirstEntry = tmpEntry;
	}
	return true;
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:34,代码来源:SeqNavMenu.cpp

示例9: Archive

status_t HTMLProject::Archive(BMessage *archive,bool deep)
{
	archive->AddInt16(hpV,bhv_application);	// version

	BEntry dirEntry;
	entry_ref dirRef;
	filesDir.GetEntry(&dirEntry);
	dirEntry.GetRef(&dirRef);
	
	archive->AddRef(hpD,&dirRef);

	BMallocIO happyArchive;
	happyList->Archive(&happyArchive);
	archive->AddData(hpH,B_RAW_TYPE,happyArchive.Buffer(),happyArchive.BufferLength());
	
	unsigned int n = fileList->CountItems();
	for (unsigned int i=0; i<n; i++)
		archive->AddString(hpF,((HTMLFile*)fileList->ItemAt(i))->name.String());
		
	n = labelList->CountItems();
	for (unsigned int i=0; i<n; i++)
	{
		smallLabel *lab = (smallLabel*)labelList->ItemAt(i);
		archive->AddString(hpLn,lab->label.String());
		archive->AddInt32(hpLf,lab->file);
	}
	
	return B_OK;
}
开发者ID:mmadia,项目名称:behappy-svn_clone,代码行数:29,代码来源:HTMLProject.cpp

示例10: dir

entry_ref
FindFile(entry_ref folder, const char *name)
{
	entry_ref ref,returnRef;
	if (!folder.name || !name)
		return returnRef;
	
	BDirectory dir(&folder);
	if (dir.InitCheck() != B_OK)
		return returnRef;
	
	dir.Rewind();
	while (dir.GetNextRef(&ref) == B_OK)
	{
		struct stat statData;
		stat(BPath(&ref).Path(),&statData);
		
		// Is a directory?
		if (S_ISDIR(statData.st_mode))
		{
			entry_ref innerref = FindFile(ref,name);
			if (innerref.device != -1 && innerref.directory != -1)
				return innerref;
		}
	}
	
	BEntry entry;
	if (dir.FindEntry(name,&entry) == B_OK)
		entry.GetRef(&returnRef);
	return returnRef;
}
开发者ID:tgkokk,项目名称:Paladin,代码行数:31,代码来源:FileUtils.cpp

示例11: strlen

static int32
build_dirent(const BEntry* source, struct dirent* ent,
	size_t size, int32 count)
{
	entry_ref ref;
	source->GetRef(&ref);

	size_t recordLength = strlen(ref.name) + sizeof(dirent);
	if (recordLength > size || count <= 0) {
		// can't fit in buffer, bail
		return 0;
	}

	// info about this node
	ent->d_reclen = static_cast<ushort>(recordLength);
	strcpy(ent->d_name, ref.name);
	ent->d_dev = ref.device;
	ent->d_ino = ref.directory;

	// info about the parent
	BEntry parent;
	source->GetParent(&parent);
	if (parent.InitCheck() == B_OK) {
		entry_ref parentRef;
		parent.GetRef(&parentRef);
		ent->d_pdev = parentRef.device;
		ent->d_pino = parentRef.directory;
	} else {
		ent->d_pdev = 0;
		ent->d_pino = 0;
	}

	return 1;
}
开发者ID:mylegacy,项目名称:haiku,代码行数:34,代码来源:NodeWalker.cpp

示例12: GetAppInfo

void
ServerApp::_LaunchAddOnServer()
{
    // Try to launch media_addon_server by mime signature.
    // If it fails (for example on the Live CD, where the executable
    // hasn't yet been mimesetted), try from this application's
    // directory
    status_t err = be_roster->Launch(B_MEDIA_ADDON_SERVER_SIGNATURE);
    if (err == B_OK)
        return;

    app_info info;
    BEntry entry;
    BDirectory dir;
    entry_ref ref;

    err = GetAppInfo(&info);
    err |= entry.SetTo(&info.ref);
    err |= entry.GetParent(&entry);
    err |= dir.SetTo(&entry);
    err |= entry.SetTo(&dir, "media_addon_server");
    err |= entry.GetRef(&ref);

    if (err == B_OK)
        be_roster->Launch(&ref);
    if (err == B_OK)
        return;

    (new BAlert("media_server", "Launching media_addon_server failed.\n\n"
                "media_server will terminate", "OK"))->Go();
    fprintf(stderr, "Launching media_addon_server (%s) failed: %s\n",
            B_MEDIA_ADDON_SERVER_SIGNATURE, strerror(err));
    exit(1);
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:34,代码来源:media_server.cpp

示例13: while

void
OpenWindow::CollectDevices(BMenu *menu, BEntry *startEntry)
{
    BDirectory directory;
    if (startEntry != NULL)
        directory.SetTo(startEntry);
    else
        directory.SetTo("/dev/disk");

    BEntry entry;
    while (directory.GetNextEntry(&entry) == B_OK) {
        if (entry.IsDirectory()) {
            CollectDevices(menu, &entry);
            continue;
        }

        entry_ref ref;
        if (entry.GetRef(&ref) != B_OK)
            continue;

        BPath path;
        if (entry.GetPath(&path) != B_OK)
            continue;

        BMessage *message = new BMessage(B_REFS_RECEIVED);
        message->AddRef("refs", &ref);

        menu->AddItem(new BMenuItem(path.Path(), message));
    }
}
开发者ID:simonsouth,项目名称:haiku,代码行数:30,代码来源:OpenWindow.cpp

示例14: CurrentMessage

void
FileTypes::ArgvReceived(int32 argc, char **argv)
{
	BMessage *message = CurrentMessage();

	BDirectory currentDirectory;
	if (message)
		currentDirectory.SetTo(message->FindString("cwd"));

	BMessage refs;

	for (int i = 1 ; i < argc ; i++) {
		BPath path;
		if (argv[i][0] == '/')
			path.SetTo(argv[i]);
		else
			path.SetTo(&currentDirectory, argv[i]);

		status_t status;
		entry_ref ref;
		BEntry entry;

		if ((status = entry.SetTo(path.Path(), false)) != B_OK
			|| (status = entry.GetRef(&ref)) != B_OK) {
			fprintf(stderr, "Could not open file \"%s\": %s\n",
				path.Path(), strerror(status));
			continue;
		}

		refs.AddRef("refs", &ref);
	}

	RefsReceived(&refs);
}
开发者ID:mariuz,项目名称:haiku,代码行数:34,代码来源:FileTypes.cpp

示例15: message

void 
BNavigator::GoTo()
{
	BString pathname = fLocation->Text();

	if (pathname.Compare("") == 0)
		pathname = "/";

	BEntry entry;
	entry_ref ref;

	if (entry.SetTo(pathname.String()) == B_OK
		&& !FSIsDeskDir(&entry)
		&& entry.GetRef(&ref) == B_OK) {
		BMessage message(kSwitchDirectory);
		message.AddRef("refs", &ref);
		message.AddInt32("action", kActionLocation);
		Window()->PostMessage(&message);		
	} else {
		BPath path;
		
		if (Window()
			&& Window()->TargetModel()) {
			Window()->TargetModel()->GetPath(&path);
			fLocation->SetText(path.Path());
		}
	}
}
开发者ID:HaikuArchives,项目名称:OpenTracker,代码行数:28,代码来源:Navigator.cpp


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