Sleeping Wombat GUI  0.100
swGUI
ImplHCF.h
Go to the documentation of this file.
1 #pragma once
2 
9 #include "ChunkRepr.h"
10 #include "AttributeRepr.h"
11 
14 
16 
18 
19 
20 #include <stdio.h>
21 
22 
23 
24 namespace sw
25 {
26 
28 class ImplHCF
29 {
32 private:
33 
35 
36  ChunkReprPtr m_rootChunk;
37  AttributeReprPtr m_fileAttributes;
38 
39  // File related things.
40  FILE* m_file;
42 
43 public:
44 
45  bool m_directWrite : 1;
47  bool m_fileReadOnly : 1;
48 
49 protected:
50 public:
51  explicit ImplHCF ();
52  ~ImplHCF ();
53 
54 
57 
58  bool OpenFile ( const filesystem::Path& filePath, bool writeDirect );
59  bool WriteFile ( const filesystem::Path& filePath );
60  bool LoadFile ( const filesystem::Path& filePath, bool readOnly );
61 
62  Attribute AddGlobalAttribute ( AttributeType type, const DataPtr data, Size dataSize );
63  Attribute AddAttribute ( AttributeReprPtr& list, AttributeType type, const DataPtr data, Size dataSize );
64 
65 public:
66  // Internal implementation
67  Size ComputeWholeSize ( Attribute attrib );
68 
69  Size ReserveMemory ( Size dataSize );
70  FILE* GetFile () { return m_file; }
71 
72  bool CanAddGlobalAttrib () const;
73 };
74 
75 
76 } // sw
FRIEND_CLASS_TESTER(HCF)
Definition: Path.h:22
uint64 AttributeType
Definition: AttributeTypes.h:12
bool m_directWrite
Definition: ImplHCF.h:45
Size ComputeWholeSize(Attribute attrib)
Definition: ImplHCF.cpp:185
ImplHCF()
Definition: ImplHCF.cpp:21
Definition: DirectInputModule.cpp:11
Definition: ImplHCF.h:28
Represents memory chunk in file.
Definition: Chunk.h:24
Main class for loading and writing HCF files.
Definition: HCF.h:34
bool WriteFile(const filesystem::Path &filePath)
Definition: ImplHCF.cpp:83
Size m_writePtr
Definition: ImplHCF.h:41
DataUnderlayingType * DataPtr
Definition: AttributeTypes.h:14
FILE * GetFile()
Definition: ImplHCF.h:70
bool m_attributesWritten
Definition: ImplHCF.h:46
bool m_fileReadOnly
Definition: ImplHCF.h:47
bool LoadFile(const filesystem::Path &filePath, bool readOnly)
Definition: ImplHCF.cpp:106
FILE * m_file
Definition: ImplHCF.h:40
Size ReserveMemory(Size dataSize)
Definition: ImplHCF.cpp:193
bool OpenFile(const filesystem::Path &filePath, bool writeDirect)
Definition: ImplHCF.cpp:58
ChunkReprPtr m_rootChunk
Main Chunk.
Definition: ImplHCF.h:36
size_t Size
Definition: TypesDefinitions.h:35
AttributeReprPtr m_fileAttributes
Top level attributes.
Definition: ImplHCF.h:37
Definition: Attribute.h:21
Chunk CreateRootChunk()
Definition: ImplHCF.cpp:132
Attribute AddGlobalAttribute(AttributeType type, const DataPtr data, Size dataSize)
Definition: ImplHCF.cpp:151
Chunk GetRootChunk()
Definition: ImplHCF.cpp:40
~ImplHCF()
Definition: ImplHCF.cpp:31
Attribute AddAttribute(AttributeReprPtr &list, AttributeType type, const DataPtr data, Size dataSize)
Definition: ImplHCF.cpp:168
bool CanAddGlobalAttrib() const
Definition: ImplHCF.cpp:203
FileHeader m_header
Definition: ImplHCF.h:34
Hierarchical Chunked Format file header.
Definition: FileHeader.h:19