Files
oboe/osx/tools/tarball.hpp
Celtic Minstrel 60d1ce3be9 Initial setup for saving game states
(code may or may not compile at this point)
2014-04-19 22:47:38 -04:00

52 lines
997 B
C++

//
// tarball.hpp
// BoE
//
// Created by Celtic Minstrel on 14-04-19.
//
//
#ifndef BoE_tarball_hpp
#define BoE_tarball_hpp
#include <sstream>
#include <deque>
class tarball {
struct header_posix_ustar {
char name[100];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char checksum[8];
char typeflag[1];
char linkname[100];
char magic[6];
char version[2];
char uname[32];
char gname[32];
char devmajor[8];
char devminor[8];
char prefix[155];
char pad[12];
};
struct tarfile {
header_posix_ustar header;
std::string filename;
std::stringstream contents;
};
std::deque<tarfile> files;
static header_posix_ustar generateTarHeader(const std::string& fileName, unsigned long long fileSize, bool directory=false);
public:
void writeTo(std::ostream& out);
void readFrom(std::istream& in);
std::ostream& newFile(std::string fname);
void newDirectory(std::string dname);
std::istream& getFile(std::string fname);
};
#endif