Added class SpoolMetaData to retrieve info from spool file attributes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2755 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* SpoolMetaData.cpp
|
||||
* Copyright 2003 Michael Pfeiffer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "SpoolMetaData.h"
|
||||
#include <String.h>
|
||||
|
||||
const char *SD_DESCRIPTION = "_spool/Description";
|
||||
const char* SD_MIME_TYPE = "_spool/MimeType";
|
||||
|
||||
SpoolMetaData::SpoolMetaData(BFile* spool_file)
|
||||
{
|
||||
BString string;
|
||||
time_t time;
|
||||
if (spool_file->ReadAttrString(SD_DESCRIPTION, &string) == B_OK) {
|
||||
__description = string.String();
|
||||
}
|
||||
if (spool_file->ReadAttrString(SD_MIME_TYPE, &string) == B_OK) {
|
||||
__mime_type = string.String();
|
||||
}
|
||||
if (spool_file->GetCreationTime(&time) == B_OK) {
|
||||
__creation_time = ctime(&time);
|
||||
}
|
||||
}
|
||||
|
||||
SpoolMetaData::~SpoolMetaData()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* SpoolMetaData.h
|
||||
* Copyright 2003 Michael Pfeiffer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __SPOOLMETADATA_H
|
||||
#define __SPOOLMETADATA_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <File.h>
|
||||
#include <string>
|
||||
|
||||
class SpoolMetaData {
|
||||
private:
|
||||
string __description;
|
||||
string __mime_type;
|
||||
string __creation_time;
|
||||
|
||||
public:
|
||||
SpoolMetaData(BFile* spool_file);
|
||||
~SpoolMetaData();
|
||||
|
||||
const string& getDescription() const { return __description; }
|
||||
const string& getMimeType() const { return __mime_type; }
|
||||
const string& getCreationTime() const { return __creation_time; }
|
||||
};
|
||||
|
||||
#endif /* __SpoolMetaData_H */
|
||||
Reference in New Issue
Block a user