Inkscape
Vector Graphics Editor
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
file.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * File operations (independent of GUI)
4 *
5 * Copyright (C) 2018 Tavmjong Bah
6 *
7 * The contents of this file may be used under the GNU General Public License Version 2 or later.
8 *
9 */
10
11#ifndef INK_FILE_IO_H
12#define INK_FILE_IO_H
13
14#include <glibmm/refptr.h>
15#include <glibmm/ustring.h>
16#include <string>
17#include <memory>
18#include <span>
19
20namespace Gio {
21class File;
22} // namespace Gio
23
24class SPDocument;
25
26std::unique_ptr<SPDocument> ink_file_new(std::string const &Template = "");
27std::unique_ptr<SPDocument> ink_file_open(std::span<char const> buffer);
28std::pair<std::unique_ptr<SPDocument>, bool /*cancelled*/> ink_file_open(Glib::RefPtr<Gio::File> const &file);
29
30namespace Inkscape::IO {
31
33public:
34 TempFilename(const std::string &pattern);
36
37 std::string const &get_filename() const { return _filename; }
38
39private:
40 std::string _filename;
41 int _tempfd = 0;
42};
43
44std::string find_original_file(Glib::StdStringView filepath, Glib::StdStringView name);
45
46} // namespace Inkscape::IO
47
48// To do:
49// ink_file_save()
50// ink_file_export()
51// ink_file_import()
52
53#endif // INK_FILE_IO_H
54
55/*
56 Local Variables:
57 mode:c++
58 c-file-style:"stroustrup"
59 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
60 indent-tabs-mode:nil
61 fill-column:99
62 End:
63*/
64// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
std::string const & get_filename() const
Definition file.h:37
std::string _filename
Definition file.h:40
Typed SVG document implementation.
Definition document.h:102
std::unique_ptr< SPDocument > ink_file_open(std::span< char const > buffer)
Open a document from memory.
Definition file.cpp:73
std::unique_ptr< SPDocument > ink_file_new(std::string const &Template="")
Create a blank document, remove any template data.
Definition file.cpp:34
Low-level IO code.
std::string find_original_file(Glib::StdStringView const filepath, Glib::StdStringView const name)
Takes an absolute file path and returns a second file at the same directory location,...
Definition file.cpp:150
Glib::ustring name
Definition toolbars.cpp:55