MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / read

Method read

Engine/source/persistence/taml/binary/tamlBinaryReader.cpp:34–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32//-----------------------------------------------------------------------------
33
34SimObject* TamlBinaryReader::read( FileStream& stream )
35{
36 // Debug Profiling.
37 PROFILE_SCOPE(TamlBinaryReader_Read);
38
39 // Read Taml signature.
40 StringTableEntry tamlSignature = stream.readSTString();
41
42 // Is the signature correct?
43 if ( tamlSignature != StringTable->insert( TAML_SIGNATURE ) )
44 {
45 // Warn.
46 Con::warnf("Taml: Cannot read binary file as signature is incorrect '%s'.", tamlSignature );
47 return NULL;
48 }
49
50 // Read version Id.
51 U32 versionId;
52 stream.read( &versionId );
53
54 // Read compressed flag.
55 bool compressed;
56 stream.read( &compressed );
57
58 SimObject* pSimObject = NULL;
59
60 // Is the stream compressed?
61 if ( compressed )
62 {
63 // Yes, so attach zip stream.
64 ZipSubRStream zipStream;
65 zipStream.attachStream( &stream );
66
67 // Parse element.
68 pSimObject = parseElement( zipStream, versionId );
69
70 // Detach zip stream.
71 zipStream.detachStream();
72 }
73 else
74 {
75 // No, so parse element.
76 pSimObject = parseElement( stream, versionId );
77 }
78
79 return pSimObject;
80}
81
82//-----------------------------------------------------------------------------
83

Callers 5

parseElementMethod · 0.45
parseAttributesMethod · 0.45
parseChildrenMethod · 0.45
parseCustomElementsMethod · 0.45
parseCustomNodeMethod · 0.45

Calls 5

warnfFunction · 0.50
readSTStringMethod · 0.45
insertMethod · 0.45
attachStreamMethod · 0.45
detachStreamMethod · 0.45

Tested by

no test coverage detected