xref: /haiku/src/libs/print/libprint/SpoolMetaData.cpp (revision 26db1794f9199838b3d4c8e6199f72dcf9cfec08)
112fd6cc2SKarsten Heimrich /*
212fd6cc2SKarsten Heimrich  * SpoolMetaData.cpp
312fd6cc2SKarsten Heimrich  * Copyright 2003 Michael Pfeiffer. All Rights Reserved.
412fd6cc2SKarsten Heimrich  */
512fd6cc2SKarsten Heimrich 
612fd6cc2SKarsten Heimrich #include "SpoolMetaData.h"
712fd6cc2SKarsten Heimrich #include <String.h>
812fd6cc2SKarsten Heimrich 
912fd6cc2SKarsten Heimrich const char *kSDDescription             = "_spool/Description";
1012fd6cc2SKarsten Heimrich const char* kSDMimeType                = "_spool/MimeType";
1112fd6cc2SKarsten Heimrich 
1208d759feSMichael Pfeiffer 
SpoolMetaData(BFile * spool_file)1312fd6cc2SKarsten Heimrich SpoolMetaData::SpoolMetaData(BFile* spool_file)
1412fd6cc2SKarsten Heimrich {
1512fd6cc2SKarsten Heimrich 	BString string;
1612fd6cc2SKarsten Heimrich 	time_t time;
17*4410ee12SMichael Pfeiffer 	if (spool_file->ReadAttrString(kSDDescription, &string) == B_OK)
1812fd6cc2SKarsten Heimrich 		fDescription = string.String();
19*4410ee12SMichael Pfeiffer 
20*4410ee12SMichael Pfeiffer 	if (spool_file->ReadAttrString(kSDMimeType, &string) == B_OK)
2112fd6cc2SKarsten Heimrich 		fMimeType = string.String();
22*4410ee12SMichael Pfeiffer 
23*4410ee12SMichael Pfeiffer 	if (spool_file->GetCreationTime(&time) == B_OK)
2412fd6cc2SKarsten Heimrich 		fCreationTime = ctime(&time);
2512fd6cc2SKarsten Heimrich }
2612fd6cc2SKarsten Heimrich 
2708d759feSMichael Pfeiffer 
~SpoolMetaData()2812fd6cc2SKarsten Heimrich SpoolMetaData::~SpoolMetaData()
2912fd6cc2SKarsten Heimrich {
3012fd6cc2SKarsten Heimrich }
3112fd6cc2SKarsten Heimrich 
32*4410ee12SMichael Pfeiffer 
33*4410ee12SMichael Pfeiffer const string&
GetDescription() const34*4410ee12SMichael Pfeiffer SpoolMetaData::GetDescription() const
35*4410ee12SMichael Pfeiffer {
36*4410ee12SMichael Pfeiffer 	return fDescription;
37*4410ee12SMichael Pfeiffer }
38*4410ee12SMichael Pfeiffer 
39*4410ee12SMichael Pfeiffer 
40*4410ee12SMichael Pfeiffer const string&
GetMimeType() const41*4410ee12SMichael Pfeiffer SpoolMetaData::GetMimeType() const
42*4410ee12SMichael Pfeiffer {
43*4410ee12SMichael Pfeiffer 	return fMimeType;
44*4410ee12SMichael Pfeiffer }
45*4410ee12SMichael Pfeiffer 
46*4410ee12SMichael Pfeiffer 
47*4410ee12SMichael Pfeiffer const string&
GetCreationTime() const48*4410ee12SMichael Pfeiffer SpoolMetaData::GetCreationTime() const
49*4410ee12SMichael Pfeiffer {
50*4410ee12SMichael Pfeiffer 	return fCreationTime;
51*4410ee12SMichael Pfeiffer }
52