Sleeping Wombat Common Library  0.50.0
swCommonLibrary
FileHeader.h
Go to the documentation of this file.
1 #pragma once
2 
10 
11 
12 namespace sw
13 {
14 
15 
19 struct FileHeader
20 {
21  char LetterShortcut[ 3 ];
22  bool LittleEndian;
23  Size FileSize;
26 
27 
28 // ================================ //
29 //
31  FileHeader ( Version version )
32  : VersionHCF( version )
33  {
34  LetterShortcut[ 0 ] = 'H';
35  LetterShortcut[ 1 ] = 'C';
36  LetterShortcut[ 2 ] = 'F';
37 
38  FileSize = 0;
39  RootChunkOffset = 0;
40  LittleEndian = CheckLittleEndian();
41  }
42 
47  {
48  int n = 1;
49  // little endian if true
50  if( *(char *)&n == 1 )
51  return true;
52  return false;
53  }
54 };
55 
56 } // sw
57 
bool LittleEndian
Endiannes of hardware which have written this file.
Definition: FileHeader.h:22
Definition: Exception.h:11
bool CheckLittleEndian()
Based on: http://stackoverflow.com/questions/4181951/how-to-check-whether-a-system-is-big-endian-or-l...
Definition: FileHeader.h:46
Version VersionHCF
Version of HCF file library.
Definition: FileHeader.h:25
Plik zawiera definicje podstawowych typów zmiennych.
Size RootChunkOffset
First chunk in file.
Definition: FileHeader.h:24
char LetterShortcut[3]
Header.
Definition: FileHeader.h:21
Size FileSize
Size including header.
Definition: FileHeader.h:23
Standard version structure.
Definition: Version.h:17
Hierarchical Chunked Format file header.
Definition: FileHeader.h:19