summaryrefslogtreecommitdiffstats
path: root/src/auto-save.h
blob: 83cc27db20c41ea993e7f722ffb4646e1b3fc45c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Auto-save
 *
 * Copyright (C) 2020 Tavmjong Bah
 *
 * Re-write of code formerly in inkscape.cpp and originally written by Jon Cruz and others.
 *
 * The contents of this file may be used under the GNU General Public License Version 2 or later.
 *
 */

#ifndef INKSCAPE_AUTOSAVE_H
#define INKSCAPE_AUTOSAVE_H

class InkscapeApplication;

namespace Inkscape {

class AutoSave {
private:
    AutoSave() = default;

public:
    AutoSave(const AutoSave &) = delete;
    AutoSave &operator=(const AutoSave &) = delete;
    AutoSave(AutoSave &&) = delete;
    AutoSave &operator=(AutoSave &&) = delete;

    static AutoSave &getInstance()
    {
        static AutoSave theInstance;
        return theInstance;
    }

    static void restart();
    void init(InkscapeApplication *app);
    void start(); // Includes restarting.
    bool save();

private:
    InkscapeApplication* _app = nullptr;
};

} // namespace Inkscape

#endif // INKSCAPE_AUTOSAVE_H

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :