1 /* === S Y N F I G ========================================================= */ 2 /*! \file canvasfilenaming.h 3 ** \brief CanvasFileNaming Header 4 ** 5 ** $Id$ 6 ** 7 ** \legal 8 ** ......... ... 2016 Ivan Mahonin 9 ** 10 ** This package is free software; you can redistribute it and/or 11 ** modify it under the terms of the GNU General Public License as 12 ** published by the Free Software Foundation; either version 2 of 13 ** the License, or (at your option) any later version. 14 ** 15 ** This package is distributed in the hope that it will be useful, 16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 ** General Public License for more details. 19 ** \endlegal 20 */ 21 /* ========================================================================= */ 22 23 /* === S T A R T =========================================================== */ 24 25 #ifndef __SYNFIG_CANVASFILENAMING_H 26 #define __SYNFIG_CANVASFILENAMING_H 27 28 /* === H E A D E R S ======================================================= */ 29 30 31 #include "canvas.h" 32 #include "filesystem.h" 33 #include "filecontainerzip.h" 34 #include "string.h" 35 36 /* === M A C R O S ========================================================= */ 37 38 /* === T Y P E D E F S ===================================================== */ 39 40 /* === C L A S S E S & S T R U C T S ======================================= */ 41 42 namespace synfig { 43 44 class CanvasFileNaming 45 { 46 public: 47 static const String container_prefix; 48 static const String container_directory_separator; 49 static const String container_canvas_filename; 50 51 static String filename_base(const String &filename); 52 static String filename_extension_lower(const String &filename); 53 static String append_directory_separator(const String &path); 54 55 static String content_folder_by_extension(const String &ext); content_folder_by_filename(const String & filename)56 static String content_folder_by_filename(const String &filename) 57 { return content_folder_by_extension(filename_extension_lower(filename)); } 58 59 static bool is_container_extension(const String &ext); is_container_filename(const String & filename)60 static bool is_container_filename(const String &filename) 61 { return is_container_extension(filename_extension_lower(filename)); } 62 63 static String make_short_filename(const String &canvas_filename, const String &filename); 64 static String make_full_filename(const String &canvas_filename, const String &filename); 65 static String make_canvas_independent_filename(const String &canvas_filename, const String &filename); 66 static String make_local_filename(const String &canvas_filename, const String &filename); 67 68 static FileSystem::Handle make_filesystem_container(const String &filename, FileContainerZip::file_size_t truncate_storage_size = 0, bool create_new = false); 69 static FileSystem::Handle make_filesystem(const FileSystem::Handle &filesystem_container); 70 static FileSystem::Handle make_filesystem(const String &filename, FileContainerZip::file_size_t truncate_storage_size = 0, bool create_new = false); 71 72 static String project_file(const FileSystem::Handle &canvas_filesystem); 73 static String project_file(const String &filename); 74 75 static bool is_embeded(const String &filename); 76 static bool is_embeded(const String &canvas_filename, const String &filename); 77 static bool can_embed(const String &filename); 78 static String generate_container_filename(const FileSystem::Handle &canvas_filesystem, const String &filename); 79 static String container_canvas_full_filename(); 80 }; // END of class CanvasFileNaming 81 82 }; // END of namespace synfig 83 84 /* === E N D =============================================================== */ 85 86 #endif 87