class Core::Portable::SettingFile

Persistent application settings.

#include <corepersistence.h>

class SettingFile:
    public Core::Portable::SettingFileHandler,
    public Core::Portable::Attributes,
    public Core::Portable::StaticSingleton
{
public:
    // methods

    Attributes& getSection(CStringPtr id);
    void storeIfNeeded();
    void setDirty(bool state = true);
    bool restore();
    bool store();
    bool storeInBackground(FileIOCompletionHandler* completionHandler = nullptr);
};

Inherited Members

public:
    // enums

    enum Flags;
    enum InternalFlags;

    // fields

     kDirty;
    isDirty PROPERTY_VARIABLE(int, streamSizeEstimate, StreamSizeEstimate) protected FileName filename;
    FileName altFilename;
     kCompress;
    isCompressed int flags;

    // methods

    void init(
        CStringPtr companyName,
        CStringPtr productName,
        CStringPtr productFileName = nullptr,
        Archiver::Format format = Archiver::kJSON,
        int flags = 0
    );

    Archiver::Format getArchiveFormat() const;
    const FileName& getFileName() const;
    bool swapFileName();
    bool setFileModifyTimesToCurrent();

    FileIOTaskID saveInBackground(
        ArchiveUtils::AttributesPromise* promise,
        FileIOCompletionHandler* completionHandler
    );

    bool loadAttributes(Attributes& attributes, bool inplace = false);
    FileStorageContext::Mode getStorageMode(bool saving) const;
    PROPERTY_FLAG(flags, kAlternateFileNames, alternateFileNames);
    PROPERTY_FLAG(flags, kUseAltFileName, useAltFileName);
    AttributeAllocator& getAllocator() const;
    void copyFrom(const Attributes& other);
    void makeReal();
    bool isEmpty() const;
    int countAttributes() const;
    AttrID getAttributeName(int index) const;
    const Attribute* getAttribute(int index) const;
    const Attribute* lookup(AttrID id) const;
    int getAttributeIndex(AttrID id) const;
    bool contains(AttrID id) const;
    bool remove(AttrID id);
    void removeAll();
    void set(AttrID id, int64 value);
    void set(AttrID id, int value);
    void set(AttrID id, double value);
    void set(AttrID id, CStringPtr value, bool shared = false);
    void set(AttrID id, const Attributes& attributes);
    AttributeQueue* makeQueue(AttrID id);
    Attributes* makeAttributes(AttrID id);
    void add(AttrID id, int64 value, int flags = 0);
    void add(AttrID id, int value, int flags = 0);
    void add(AttrID id, double value, int flags = 0);
    void add(AttrID id, CStringPtr value, int flags = 0);
    void add(AttrID id, const Attributes& attributes, int flags = 0);
    AttributeQueue* addQueue(AttrID id, int flags = 0);
    Attributes* addAttributes(AttrID id, int flags = 0);
    void addAttribute(const Attribute& a);
    int64 getInt(AttrID id) const;
    double getFloat(AttrID id) const;
    CStringPtr getString(AttrID id) const;
    const AttributeQueue* getQueue(AttrID id) const;
    Attributes* getAttributes(AttrID id) const;
    PROPERTY_POINTER(IO::Buffer, inplaceBuffer, InplaceBuffer);
    static T& instance();
    DeletableList& instance();