class Core::Portable::Archiver

An archiver is used to save/load structured data to/from disk in JSON or UBJSON format.

#include <corepersistence.h>

class Archiver
{
public:
    // enums

    enum Flags;
    enum Format;

    // classes

    class ErrorHandler;

    // construction

    Archiver(IO::Stream* stream, Format format = kJSON, int flags = 0);

    // methods

    bool save(const Attributes& attributes);
    bool load(Attributes& attributes);
    static Format detectFormat(CStringPtr fileName);
    static CStringPtr getFileType(Format format);

    static bool loadInplace(
        Attributes& attributes,
        IO::Buffer& buffer,
        Format format
    );
};