-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTag.cpp
More file actions
27 lines (21 loc) · 704 Bytes
/
Copy pathTag.cpp
File metadata and controls
27 lines (21 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "Tag.h"
namespace TiffParse
{
Tag::Tag(FILE* filePtr, int offset) {
char tagBytes[12];
fseek(filePtr, offset, 0);
fread(tagBytes, sizeof(tagBytes), 1, filePtr);
char* tagBytesPtr = tagBytes;
_tagId = *(unsigned short*)tagBytesPtr;
tagBytesPtr += sizeof(_tagId);
_dataType = *(unsigned short*)tagBytesPtr;
tagBytesPtr += sizeof(_dataType);
_dataCount = *(unsigned int*)tagBytesPtr;
tagBytesPtr += sizeof(_dataCount);
_dataOffset = *(unsigned int*)tagBytesPtr;
}
void operator<<(std::ostream& os, const Tag& t) {
os << "Tag ID: " << t._tagId << "\nData Type: " <<
t._dataType << "\nData Count: " << t._dataCount << "\nData Offset: " << t._dataOffset<<"\n";
}
}