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


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

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


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

示例1: resources

void
DecorInfo::_Init(bool isUpdate)
{
	if (!isUpdate && InitCheck() != B_NO_INIT) {
		// TODO: remove after validation
		fprintf(stderr, "DecorInfo::_Init()\tImproper init state\n");
		return;
	}

	BEntry entry;

	if (fPath == "Default") {
		if (isUpdate) {
			// should never happen
			fprintf(stderr, "DecorInfo::_Init(true)\tBUG BUG updating default"
				"decorator!?!?!\n");
			return;
		}

		fAuthors = "DarkWyrm, Stephan Aßmus, Clemens Zeidler, Ingo Weinhold";
		fLongDescription = fShortDescription;
		fLicenseURL = "http://";
		fLicenseName = "MIT";
		fSupportURL = "http://www.haiku-os.org/";
		fVersion = 0.5;
		fInitStatus = B_OK;

		fName = gSystemCatalog.GetString(B_TRANSLATE_MARK("Default"),
			B_TRANSLATION_CONTEXT);
		fShortDescription = gSystemCatalog.GetString(B_TRANSLATE_MARK(
				"Default Haiku window decorator."),
			B_TRANSLATION_CONTEXT);

		// The following is to get the modification time of the app_server
		// and, thusly, the Default decorator...
		// If you can make it more simple, please do!
		BPath path;
		find_directory(B_SYSTEM_SERVERS_DIRECTORY, &path);
		path.Append("app_server");
		entry.SetTo(path.Path(), true);
		if (!entry.Exists()) {
			fprintf(stderr, "Server MIA the world has become its slave! "
				"Call the CIA!\n");
			return;
		}

		entry.GetModificationTime(&fModificationTime);
		return;
	}

	// Is a file system object...

	entry.SetTo(&fRef, true);	// follow link
	if (entry.InitCheck() != B_OK) {
		fInitStatus = entry.InitCheck();
		return;
	}

	if (!entry.Exists()) {
		if (isUpdate) {
			fprintf(stderr, "DecorInfo::_Init()\tERROR: decorator deleted"
					" after CheckForChanges() found it!\n");
			fprintf(stderr, "DecorInfo::_Init()\tERROR: DecorInfo will "
					"Unset\n");
			Unset();
		}
		return;
	}

	// update fRef to match file system object
	entry.GetRef(&fRef);
	entry.GetModificationTime(&fModificationTime);

	BResources resources(&fRef);
	if (resources.InitCheck() != B_OK) {
		fprintf(stderr, "DecorInfo::_Init()\t BResource InitCheck() failure\n");
		return;
	}

	size_t infoSize = 0;
	const void* infoData = resources.LoadResource(B_MESSAGE_TYPE,
		"be:decor:info", &infoSize);
	BMessage infoMessage;

	if (infoData == NULL || infoSize == 0
		|| infoMessage.Unflatten((const char*)infoData) != B_OK) {
		fprintf(stderr, "DecorInfo::_init()\tNo extended information found for"
			" \"%s\"\n", fRef.name);
	} else {
		infoMessage.FindString("name", &fName);
		infoMessage.FindString("authors", &fAuthors);
		infoMessage.FindString("short_descr", &fShortDescription);
		infoMessage.FindString("long_descr", &fLongDescription);
		infoMessage.FindString("lic_url", &fLicenseURL);
		infoMessage.FindString("lic_name", &fLicenseName);
		infoMessage.FindString("support_url", &fSupportURL);
		infoMessage.FindFloat ("version", &fVersion);
	}

	fInitStatus = B_OK;
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:DecorInfo.cpp

示例2: RefsReceived

void PecoApp::RefsReceived ( BMessage* msg ) {

	entry_ref	ref;
	BPath		aPath;
	BEntry		aEntry;
	off_t		size;
	time_t		timer;
	
	fWindow->Lock();
	BTextControl* 	pfadView 	= (BTextControl *)fWindow->FindView("pfadView");
	fWindow->Unlock();
	
	//Pfad finden
	for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) if ( ref.device > 1 ) break;
	
	if ( ref.device > 1 ) {
		New();

		fWindow->Lock();
		((PecoApp *)be_app)->fStatusBar->SetText(STATUS_IMPORT);
		fWindow->Unlock();
	
		aEntry = BEntry(&ref);
		BPath( &aEntry ).GetParent(&fPfad);
				
		fWindow->Lock();
		pfadView->SetText( fPfad.Path() );
		fWindow->Unlock();
		
		//zählen
		type_code	typeFound;
		long		total = 0;
		msg->GetInfo("refs", &typeFound, &total);
		
		fWindow->Lock();
		fStatusBar->SetMaxValue( total );
		fWindow->Unlock();
		
		BPath	newPath;
		
		bool	didntshow_msgmultidir = true;
		
		for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) {
			
			fWindow->Lock();
			fStatusBar->Update(1);
			fWindow->Unlock();
			
			// Laufwerke ausfiltern
			if ( ref.device == 1 ) continue;
 			
			// Dateien mit falschem Pfad ausfiltern
			aEntry = BEntry(&ref);
			aPath = BPath(&aEntry);
			
			BPath( &aEntry ).GetParent(&newPath);
			
			if ( (strcmp( fPfad.Path(), newPath.Path() ) != 0 ) ) {
				if ( didntshow_msgmultidir ) {
					BAlert*	myAlert = new BAlert(NULL, MESSAGE_MULTIDIR, STR_OK);
					myAlert->Go();
					didntshow_msgmultidir = false;
				}
				continue;
			}
			
			// Werte auslesen
			if (aEntry.IsFile()) aEntry.GetSize(&size); 
			else
				if (aEntry.IsSymLink()) size = -1;
				else
					if (aEntry.IsDirectory()) size = -2;
					else continue;
			
			aEntry.GetModificationTime(&timer);
			
			fList->AddItem(new FileListItem(aPath.Leaf(), size, timer, &ref));
			
		}
		
		fWindow->Lock();
		fListView->AddList(fList);
		float Hoehe = be_plain_font->Size() + 2;
		if (Hoehe < 18) {
			BListItem*	myListItem;
			for (int i=0; (myListItem = fListView->ItemAt(i)); i++) myListItem->SetHeight(18);
			// Zum Updaten:
			fListView->AddItem(myListItem = new BStringItem(""));
			fListView->RemoveItem(myListItem);
		}
		fStatusBar->Reset(STATUS_STATUS);
		fStatusBar->SetMaxValue(fList->CountItems());
		fWindow->Unlock();
		
		MakeList();
	}
	fWindow->Activate();
	UpdateWindowStatus();
}
开发者ID:diversys,项目名称:PecoRename,代码行数:99,代码来源:PecoApp.cpp


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