Athena IO Library
MCFileWriter.hpp
1 #ifndef ATHENA_NO_SAVES
2 // This file is part of libAthena.
3 //
4 // libAthena is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // libAthena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with libAthena. If not, see <http://www.gnu.org/licenses/>
16 
17 #ifndef MCFILEWRITER_HPP
18 #define MCFILEWRITER_HPP
19 
20 #include "Athena/Types.hpp"
21 #include "Athena/MemoryWriter.hpp"
22 
23 namespace Athena
24 {
25 
26 class MCFile;
27 
28 namespace io
29 {
30 
38 class MCFileWriter : protected MemoryWriter
39 {
40  MEMORYWRITER_BASE();
41 public:
48  MCFileWriter(atUint8*, atUint64);
49 
55  MCFileWriter(const std::string&);
56 
62  void writeFile(MCFile* file);
63 
64  static atUint16 calculateChecksum(atUint8* data, atUint32 length);
65 private:
66  atUint16 calculateSlotChecksum(atUint32 game);
67 };
68 
69 } // io
70 } // zelda
71 
72 #endif // MCFILEWRITER_HPP
73 #endif // ATHENA_NO_SAVES
void writeFile(MCFile *file)
Writes the given save data to a file on disk.
The Minish Cap data container class class.
Definition: MCFile.hpp:31
MCFileWriter(atUint8 *, atUint64)
This constructor takes an existing buffer to write to.
atUint64 length() const
Returns whether or not the stream is at the end.
The Minish Cap Save save data writer class.
atUint8 * data() const
Returns a copy of the current buffer. Changes to the copy do not affect the buffer so it's perfectly...