From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/io/resource.h | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/io/resource.h (limited to 'src/io/resource.h') diff --git a/src/io/resource.h b/src/io/resource.h new file mode 100644 index 0000000..b4ba4dc --- /dev/null +++ b/src/io/resource.h @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** @file + * TODO: insert short description here + *//* + * Authors: + * MenTaLguY + * Martin Owens + * + * Copyright (C) 2018 Authors + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#ifndef SEEN_INKSCAPE_IO_RESOURCE_H +#define SEEN_INKSCAPE_IO_RESOURCE_H + +#include +#include +#include "util/share.h" + +namespace Inkscape { + +namespace IO { + +/** + * simple resource API + */ +namespace Resource { + +enum Type { + ATTRIBUTES, + EXAMPLES, + EXTENSIONS, + FONTS, + ICONS, + KEYS, + MARKERS, + NONE, + PAINT, + PALETTES, + SCREENS, + TEMPLATES, + TUTORIALS, + SYMBOLS, + FILTERS, + THEMES, + UIS, + PIXMAPS, + DOCS +}; + +enum Domain { + SYSTEM, + CREATE, + CACHE, + USER +}; + +Util::ptr_shared get_path(Domain domain, Type type, + char const *filename=nullptr); + +Glib::ustring get_path_ustring(Domain domain, Type type, + char const *filename=nullptr); +std::string get_path_string(Domain domain, Type type, char const *filename = nullptr); + +std::string get_filename_string(Type type, char const *filename, bool localized = false, bool silent = false); +Glib::ustring get_filename(Type type, char const *filename, bool localized = false, bool silent = false); +// TODO consolidate with Glib::StdStringView +Glib::ustring get_filename(Glib::ustring path, Glib::ustring filename); +std::string get_filename(std::string const& path, std::string const& filename); +inline std::string get_filename(const char *path, const char *filename) +{ + return get_filename(std::string(path), std::string(filename)); +} + +std::vector get_filenames(Type type, + std::vector const &extensions={}, + std::vector const &exclusions={}); + +std::vector get_filenames(Domain domain, Type type, + std::vector const &extensions={}, + std::vector const &exclusions={}); + +std::vector get_filenames(Glib::ustring path, + std::vector const &extensions={}, + std::vector const &exclusions={}); + +std::vector get_foldernames(Type type, std::vector const &exclusions = {}); + +std::vector get_foldernames(Domain domain, Type type, std::vector const &exclusions = {}); + +std::vector get_foldernames(Glib::ustring path, std::vector const &exclusions = {}); + +void get_foldernames_from_path(std::vector &files, Glib::ustring path, + std::vector exclusions = {}); + +void get_filenames_from_path(std::vector &files, std::string const &path, + std::vector const &extensions = {}, + std::vector const &exclusions = {}); + + +char const *profile_path(); +char *profile_path(const char *filename); +char *homedir_path(const char *filename); +char *log_path(const char *filename); + +} + +} + +} + +#endif +/* + 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:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3