[glom] file_utils: Put in FileUtils namespace.



commit a0ae27a6109bab709bcbd8c511c5e50ced4fe0c0
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Mar 17 13:59:10 2016 +0100

    file_utils: Put in FileUtils namespace.

 glom/appwindow.cc                                  |    4 ++--
 glom/glom_create_from_example.cc                   |    2 +-
 .../connectionpool_backends/postgres_self.cc       |    2 +-
 glom/libglom/connectionpool_backends/sqlite.cc     |    4 ++--
 .../data_structure/layout/layoutitem_image.cc      |    2 +-
 glom/libglom/document/document.cc                  |    2 +-
 glom/libglom/file_utils.cc                         |    6 +++---
 glom/libglom/file_utils.h                          |    4 ++--
 glom/libglom/report_builder.cc                     |    4 ++--
 glom/main.cc                                       |    4 ++--
 glom/utility_widgets/imageglom.cc                  |    2 +-
 tests/import/utils.cc                              |    2 +-
 .../python/test_python_execute_func_with_record.cc |    2 +-
 tests/test_document_autosave.cc                    |    2 +-
 tests/test_document_load_and_save.cc               |    2 +-
 tests/test_selfhosting_new_then_backup_restore.cc  |    2 +-
 tests/test_selfhosting_utils.cc                    |    2 +-
 tests/translations_po/test_document_export_po.cc   |    4 ++--
 18 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index c61d2b9..2bd496b 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -2171,7 +2171,7 @@ Glib::ustring AppWindow::ui_file_select_save(const Glib::ustring& old_file_uri)
       const auto uri_chosen = fileChooser_Save->get_uri();
 
       //Change the URI, to put the file (and its data folder) in a folder:
-      const auto uri = Utils::get_file_uri_without_extension(uri_chosen);
+      const auto uri = FileUtils::get_file_uri_without_extension(uri_chosen);
 
       //Check whether the file exists, and that we have rights to it:
       auto file = Gio::File::create_for_uri(uri);
@@ -2377,7 +2377,7 @@ void AppWindow::on_menu_developer_export_backup()
   // Start with a name based on the existing name.
   const auto fileuri_old = document->get_file_uri();
   const Glib::RefPtr<const Gio::File> file_old =
-    Gio::File::create_for_uri( Utils::get_file_uri_without_extension(fileuri_old) );
+    Gio::File::create_for_uri( FileUtils::get_file_uri_without_extension(fileuri_old) );
   const auto old_basename = file_old->get_basename();
   Glib::TimeVal timeval;
   timeval.assign_current_time();
diff --git a/glom/glom_create_from_example.cc b/glom/glom_create_from_example.cc
index 974b948..6e340d7 100644
--- a/glom/glom_create_from_example.cc
+++ b/glom/glom_create_from_example.cc
@@ -377,7 +377,7 @@ int main(int argc, char* argv[])
 
   //Save a copy, specifying the path to file in a directory:
   filepath_dir = 
-    Glom::Utils::get_file_path_without_extension(
+    Glom::FileUtils::get_file_path_without_extension(
       Glib::build_filename(
         group.m_arg_filepath_dir_output,
         group.m_arg_filepath_name_output));
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc 
b/glom/libglom/connectionpool_backends/postgres_self.cc
index 8d8753b..90b353b 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -213,7 +213,7 @@ Backend::InitErrors PostgresSelfHosted::initialize(const SlotProgress& slot_prog
   // initdb creates a new postgres database cluster:
 
   //Get file:// URI for the tmp/ directory:
-  const auto temp_pwfile = Utils::get_temp_file_path("glom_initdb_pwfile");
+  const auto temp_pwfile = FileUtils::get_temp_file_path("glom_initdb_pwfile");
   const auto temp_pwfile_uri = Glib::filename_to_uri(temp_pwfile);
   const auto pwfile_creation_succeeded = create_text_file(temp_pwfile_uri, password);
   g_assert(pwfile_creation_succeeded);
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index a9f07dd..e712980 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -52,7 +52,7 @@ Glib::RefPtr<Gnome::Gda::Connection> Sqlite::connect(const Glib::ustring& databa
   auto db_dir = Gio::File::create_for_uri(m_database_directory_uri);
   auto db_file = db_dir->get_child(database + ".db");
 
-  const auto file_exists = Glom::Utils::file_exists(db_file);
+  const auto file_exists = Glom::FileUtils::file_exists(db_file);
   if(!file_exists)
   {
     //We don't warn here because the caller gets an exception anyway,
@@ -96,7 +96,7 @@ Glib::RefPtr<Gnome::Gda::Connection> Sqlite::connect(const Glib::ustring& databa
   {
     // If the database directory is valid, then only the database (file) is
     // missing, otherwise we pretend the "server" is not running.
-    if(Glom::Utils::file_exists(db_dir) &&
+    if(Glom::FileUtils::file_exists(db_dir) &&
       (db_dir->query_file_type() == Gio::FILE_TYPE_DIRECTORY))
     {
       throw ExceptionConnection(ExceptionConnection::failure_type::NO_DATABASE);
diff --git a/glom/libglom/data_structure/layout/layoutitem_image.cc 
b/glom/libglom/data_structure/layout/layoutitem_image.cc
index e1e58be..54df0d4 100644
--- a/glom/libglom/data_structure/layout/layoutitem_image.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_image.cc
@@ -84,7 +84,7 @@ void LayoutItem_Image::set_image(const Gnome::Gda::Value& image)
 
 Glib::ustring LayoutItem_Image::create_local_image_uri() const
 {
-  return Utils::create_local_image_uri(m_image);
+  return FileUtils::create_local_image_uri(m_image);
 }
 
 } //namespace Glom
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 5cfe53f..219dbe0 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -5065,7 +5065,7 @@ Glib::ustring Document::extract_backup_file(const Glib::ustring& backup_uri, std
       std::string contents_backup_file;
       read_archive_entry_file_contents(a, entry, contents_backup_file);
 
-      backup_path = Utils::get_temp_file_path("glom_backup");
+      backup_path = FileUtils::get_temp_file_path("glom_backup");
       Glib::file_set_contents(backup_path, contents_backup_file);
       //std::cout << "debug: backup data path: " << backup_path << std::endl;
     }
diff --git a/glom/libglom/file_utils.cc b/glom/libglom/file_utils.cc
index b4e576d..fe21caa 100644
--- a/glom/libglom/file_utils.cc
+++ b/glom/libglom/file_utils.cc
@@ -31,7 +31,7 @@
 namespace Glom
 {
 
-namespace Utils
+namespace FileUtils
 {
 
 bool file_exists(const Glib::ustring& uri)
@@ -97,7 +97,7 @@ static Glib::ustring get_directory_child_with_suffix(const Glib::ustring& uri_di
     {
       //Check the filename:
       const std::string basename = child->get_basename();
-      if(string_remove_suffix(basename, suffix) != basename)
+      if(Utils::string_remove_suffix(basename, suffix) != basename)
         return child->get_uri();
     }
     else if(recursive && file_type == Gio::FILE_TYPE_DIRECTORY)
@@ -275,6 +275,6 @@ Glib::ustring create_local_image_uri(const Gnome::Gda::Value& value)
 }
 
 
-} //namespace Utils
+} //namespace FileUtils
 
 } //namespace Glom
diff --git a/glom/libglom/file_utils.h b/glom/libglom/file_utils.h
index 7894df9..688ac6d 100644
--- a/glom/libglom/file_utils.h
+++ b/glom/libglom/file_utils.h
@@ -27,7 +27,7 @@
 namespace Glom
 {
 
-namespace Utils
+namespace FileUtils
 {
 
 bool file_exists(const Glib::ustring& uri);
@@ -62,7 +62,7 @@ std::string get_temp_directory_path(const std::string& prefix = std::string());
  */
 Glib::ustring get_temp_directory_uri(const std::string& prefix = std::string());
 
-} //namespace Utils
+} //namespace FileUtils
 
 } //namespace Glom
 
diff --git a/glom/libglom/report_builder.cc b/glom/libglom/report_builder.cc
index 1394d5e..687c0c7 100644
--- a/glom/libglom/report_builder.cc
+++ b/glom/libglom/report_builder.cc
@@ -485,7 +485,7 @@ bool ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp:
 
   //Handle the value:
   if(field_type == Field::glom_field_type::IMAGE)
-     nodeField->set_attribute("image_uri", Utils::create_local_image_uri(value));
+     nodeField->set_attribute("image_uri", FileUtils::create_local_image_uri(value));
   else
   {
     Glib::ustring text_value = Conversions::get_text_for_gda_value(field_type, value, m_locale, 
field->get_formatting_used().m_numeric_format);
@@ -580,7 +580,7 @@ std::string ReportBuilder::report_build_and_save(const FoundSet& found_set, cons
   const auto contents = report_build(found_set, report);
 
  //Save it to a temporary file and show it in a browser:
-  const auto temp_uri = Utils::get_temp_file_uri("glom_printout", "html");
+  const auto temp_uri = FileUtils::get_temp_file_uri("glom_printout", "html");
   std::cout << G_STRFUNC << ": temp_uri=" << temp_uri << std::endl;
 
   auto file = Gio::File::create_for_uri(temp_uri);
diff --git a/glom/main.cc b/glom/main.cc
index 5b9a501..662c7eb 100644
--- a/glom/main.cc
+++ b/glom/main.cc
@@ -253,7 +253,7 @@ bool check_postgres_is_available_with_warning()
   if(!binpath.empty())
   {
     const auto uri_binpath = Glib::filename_to_uri(binpath);
-    if(Utils::file_exists(uri_binpath))
+    if(FileUtils::file_exists(uri_binpath))
       return true;
   }
 
@@ -308,7 +308,7 @@ bool check_mysql_is_available_with_warning()
   if(!binpath.empty())
   {
     const auto uri_binpath = Glib::filename_to_uri(binpath);
-    if(Utils::file_exists(uri_binpath))
+    if(FileUtils::file_exists(uri_binpath))
       return true;
   }
 
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 59b6c9b..4974914 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -618,7 +618,7 @@ static void make_file_read_only(const Glib::ustring& uri)
 
 Glib::ustring ImageGlom::save_to_temp_file(bool show_progress)
 {
-  Glib::ustring uri = Utils::get_temp_file_uri("glom_image");
+  Glib::ustring uri = FileUtils::get_temp_file_uri("glom_image");
   if(uri.empty())
   {
     std::cerr << G_STRFUNC << ": : uri is empty.\n";
diff --git a/tests/import/utils.cc b/tests/import/utils.cc
index c5fc981..a3eeb40 100644
--- a/tests/import/utils.cc
+++ b/tests/import/utils.cc
@@ -22,7 +22,7 @@ bool check(const std::string& name, bool test, std::stringstream& report)
 // Returns the file URI of the temporary created file, which will contain the buffer's contents.
 static Glib::ustring create_file_from_buffer(const char* input, guint input_size)
 {
-  const auto file_uri = Glom::Utils::get_temp_file_uri("glom_import_testdata");
+  const auto file_uri = Glom::FileUtils::get_temp_file_uri("glom_import_testdata");
   if(file_uri.empty())
   {
     std::cerr << G_STRFUNC << ": file_uri was empty.\n";
diff --git a/tests/python/test_python_execute_func_with_record.cc 
b/tests/python/test_python_execute_func_with_record.cc
index 3a3a121..fee242a 100644
--- a/tests/python/test_python_execute_func_with_record.cc
+++ b/tests/python/test_python_execute_func_with_record.cc
@@ -49,7 +49,7 @@ int main()
     return EXIT_FAILURE;
   }
 
-  g_assert( Glom::Utils::file_exists(uri) );
+  g_assert( Glom::FileUtils::file_exists(uri) );
   //std::cout << "URI=" << uri << std::endl;
 
 
diff --git a/tests/test_document_autosave.cc b/tests/test_document_autosave.cc
index caa11b6..cfd6987 100644
--- a/tests/test_document_autosave.cc
+++ b/tests/test_document_autosave.cc
@@ -59,7 +59,7 @@ int main()
 {
   Glom::libglom_init();
 
-  file_uri = Glom::Utils::get_temp_file_uri("testglom_document_autosave", ".glom");
+  file_uri = Glom::FileUtils::get_temp_file_uri("testglom_document_autosave", ".glom");
   
   //Make sure that the file does not exist yet:
   cleanup();
diff --git a/tests/test_document_load_and_save.cc b/tests/test_document_load_and_save.cc
index 24ffa6d..c37f2df 100644
--- a/tests/test_document_load_and_save.cc
+++ b/tests/test_document_load_and_save.cc
@@ -106,7 +106,7 @@ int main(int argc, char* argv[])
   // Save the document:
   document->set_allow_autosave(false);
   const Glib::ustring temp_uri = 
-    Glom::Utils::get_temp_file_uri("testglom_document", ".glom");
+    Glom::FileUtils::get_temp_file_uri("testglom_document", ".glom");
   document->set_file_uri(temp_uri);
   document->set_modified(); //TODO: Let save() succeed without this.
   const auto saved = document->save();
diff --git a/tests/test_selfhosting_new_then_backup_restore.cc 
b/tests/test_selfhosting_new_then_backup_restore.cc
index 68a00d8..d8a8a2e 100644
--- a/tests/test_selfhosting_new_then_backup_restore.cc
+++ b/tests/test_selfhosting_new_then_backup_restore.cc
@@ -47,7 +47,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
       return false;
     }
 
-    const auto backup_uri = Glom::Utils::get_temp_directory_uri();
+    const auto backup_uri = Glom::FileUtils::get_temp_directory_uri();
     backup_uri_tarball = document->save_backup_file(
       backup_uri,
       sigc::ptr_fun(&on_backup_progress));
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index bc48b50..716d312 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -187,7 +187,7 @@ bool test_create_and_selfhost_new_empty(const std::shared_ptr<Glom::Document>& d
   //For instance, /tmp/testglom/testglom.glom");
   const std::string temp_filename = "testglom";
   temp_filepath_dir = 
-    Glom::Utils::get_temp_directory_path(temp_filename);
+    Glom::FileUtils::get_temp_directory_path(temp_filename);
   if(!subdirectory_path.empty())
     temp_filepath_dir = Glib::build_filename(temp_filepath_dir, subdirectory_path);
   const auto temp_filepath = Glib::build_filename(temp_filepath_dir, temp_filename);
diff --git a/tests/translations_po/test_document_export_po.cc 
b/tests/translations_po/test_document_export_po.cc
index 4a7af78..38e1cf5 100644
--- a/tests/translations_po/test_document_export_po.cc
+++ b/tests/translations_po/test_document_export_po.cc
@@ -100,7 +100,7 @@ int main()
     return EXIT_FAILURE;
   }
 
-  const auto po_file_uri = Glom::Utils::get_temp_file_uri("glom_export.po");
+  const auto po_file_uri = Glom::FileUtils::get_temp_file_uri("glom_export.po");
   if(po_file_uri.empty())
   {
     std::cerr << G_STRFUNC << ": Could not generate a temporary file URI=\n";
@@ -154,7 +154,7 @@ int main()
   //Check that the .po file is valid:
   check_po_file(po_file_path);
 
-  Glom::Utils::delete_file(po_file_uri);
+  Glom::FileUtils::delete_file(po_file_uri);
 
   Glom::libglom_deinit();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]