Commit 6eaa6965 authored by Murray Cumming's avatar Murray Cumming
Browse files

Keep utils.h out of headers.

parent ce862fef
......@@ -37,6 +37,7 @@
#include <libglom/db_utils.h>
#include <libglom/db_utils_export.h>
#include <libglom/privs.h>
#include <libglom/utils.h>
#include <glom/python_embed/python_ui_callbacks.h>
#include <glom/python_embed/glom_python.h>
#include <libglom/spawn_with_feedback.h>
......
......@@ -26,6 +26,7 @@
#include <libglom/standard_table_prefs_fields.h>
#include <libglom/document/document.h>
#include <libglom/data_structure/glomconversions.h>
#include <libglom/utils.h>
#include <glom/mode_design/layout/dialog_choose_field.h>
//#ifndef GLOM_ENABLE_CLIENT_ONLY
......
......@@ -29,7 +29,6 @@
#include <libglom/data_structure/foundset.h>
#include <libglom/data_structure/privileges.h>
#include <libglom/data_structure/system_prefs.h>
#include <libglom/utils.h>
#include <libglom/calcinprogress.h>
#include <libglom/document/bakery/view/view.h>
#include <glom/bakery/busy_cursor.h>
......
......@@ -25,6 +25,7 @@
#include <glom/python_embed/glom_python.h>
#include <glom/utils_ui.h>
#include <libglom/db_utils.h>
#include <libglom/utils.h>
#include <sstream>
#include <iostream>
#include <glibmm/i18n.h>
......
......@@ -21,6 +21,7 @@
#include <glom/box_withbuttons.h>
#include <glom/appwindow.h> //AppWindow.
#include <glom/utils_ui.h>
#include <libglom/utils.h>
#include <libglom/appstate.h>
#include <sstream> //For stringstream
......
......@@ -22,6 +22,7 @@
#include <glom/mode_design/layout/dialog_layout_export.h>
#include <glom/utils_ui.h>
#include <glom/glade_utils.h>
#include <libglom/utils.h>
#include <glibmm/i18n.h>
namespace Glom
......
......@@ -64,6 +64,7 @@
#include <glom/filechooser_export.h>
#include <libglom/privs.h>
#include <libglom/utils.h>
#include <libglom/db_utils.h>
#include <libglom/db_utils_export.h>
#include <sstream> //For stringstream.
......
......@@ -43,7 +43,6 @@
#include "dialog_connection.h"
#include <gtkmm/applicationwindow.h>
#include <libglom/utils.h>
#include "mode_data/box_data_list_related.h" //only for m_HackToFixLinkerError.
......
......@@ -21,9 +21,8 @@
#include "dialog_import_csv.h"
#include <glom/import_csv/file_encodings.h>
#include <libglom/libglom_config.h>
#include <libglom/utils.h>
#include <libglom/data_structure/glomconversions.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/cellrenderercombo.h>
#include <glom/utils_ui.h>
......
......@@ -27,7 +27,6 @@
#include <libglom/data_structure/numeric_format.h>
#include <libglom/data_structure/relationship.h>
#include <libglom/data_structure/layout/custom_title.h>
#include <libglom/algorithms_utils.h>
namespace Glom
{
......@@ -159,34 +158,6 @@ private:
std::shared_ptr<CustomTitle> m_title_custom; //translatable.
};
/**
* Find the element in the container which is a LayoutItem_Field which refers
* to the same field, without comparing irrelevant stuff such as formatting.
* This assumes that the element is a shared_ptr<>.
*/
template
<typename T_Container>
bool find_if_layout_item_field_is_same_field_exists(T_Container& container, const std::shared_ptr<const LayoutItem_Field>& layout_item)
{
return Utils::find_if_exists(container,
[&layout_item](const typename T_Container::value_type& element)
{
//Assume that element is a shared_ptr<>.
if(!layout_item && !element)
return true;
//Allow this to be used on a container of LayoutItems,
//as well as just of LayoutItem_Fields.
const auto element_field = std::dynamic_pointer_cast<const LayoutItem_Field>(element);
if(!element_field)
return false;
return layout_item && layout_item->is_same_field(element_field);
}
);
}
} //namespace Glom
#endif //GLOM_DATASTRUCTURE_LAYOUTITEM_FIELD_H
......
......@@ -20,7 +20,6 @@
#define GLOM_BAKERY_VIEW_COMPOSITE_H
#include <libglom/document/bakery/view/view.h>
#include <libglom/algorithms_utils.h>
#include <vector>
#include <algorithm> //For std::find
......@@ -55,7 +54,7 @@ public:
virtual void remove_view(type_view* pView)
{
auto iter = Glom::Utils::find(m_vecViews, pView);
auto iter = std::find(std::begin(m_vecViews), std::end(m_vecViews), pView);
if(iter != m_vecViews.end())
m_vecViews.erase(iter);
}
......
......@@ -24,8 +24,8 @@
#include <libglom/data_structure/field.h>
#include <libglom/data_structure/numeric_format.h>
#include <libglom/document/document.h>
#include <libglom/data_structure/layout/layoutitem_field.h>
#include <libglom/algorithms_utils.h>
#include <libgdamm/sqlexpr.h>
#include <giomm/file.h>
......@@ -265,6 +265,35 @@ to_utype(E enumerator) noexcept
return static_cast<typename std::underlying_type<E>::type>(enumerator);
}
/**
* Find the element in the container which is a LayoutItem_Field which refers
* to the same field, without comparing irrelevant stuff such as formatting.
* This assumes that the element is a shared_ptr<>.
*/
template
<typename T_Container>
bool find_if_layout_item_field_is_same_field_exists(T_Container& container, const std::shared_ptr<const LayoutItem_Field>& layout_item)
{
return Utils::find_if_exists(container,
[&layout_item](const typename T_Container::value_type& element)
{
//Assume that element is a shared_ptr<>.
if(!layout_item && !element)
return true;
//Allow this to be used on a container of LayoutItems,
//as well as just of LayoutItem_Fields.
const auto element_field = std::dynamic_pointer_cast<const LayoutItem_Field>(element);
if(!element_field)
return false;
return layout_item && layout_item->is_same_field(element_field);
}
);
}
} //namespace Utils
} //namespace Glom
......
......@@ -30,6 +30,7 @@
#include <glom/python_embed/python_ui_callbacks.h>
#include <glom/appwindow.h>
#include <libglom/libglom_config.h>
#include <libglom/utils.h>
#include <iostream>
#include <glibmm/i18n.h>
......
......@@ -23,6 +23,7 @@
#include <glom/utils_ui.h>
#include <glom/appwindow.h>
#include <libglom/data_structure/glomconversions.h>
#include <libglom/utils.h>
#include <libglom/db_utils.h>
#include <glom/frame_glom.h> //For show_ok_dialog()
#include <glom/glade_utils.h>
......
......@@ -26,6 +26,7 @@
#include <libglom/data_structure/relationship.h>
#include <libglom/data_structure/glomconversions.h>
#include <libglom/db_utils.h>
#include <libglom/utils.h>
#include <glom/mode_design/layout/dialog_layout_details.h>
#include <glom/glade_utils.h>
#include <glom/utils_ui.h>
......@@ -306,7 +307,7 @@ bool Box_Data_Details::fill_from_database()
bool index_primary_key_found = false;
unsigned int index_primary_key = 0; //Arbitrary default.
//g_warning("primary_key name = %s", m_field_primary_key->get_name().c_str());
if(!find_if_layout_item_field_is_same_field_exists(fieldsToGet, layout_item_pk))
if(!Utils::find_if_layout_item_field_is_same_field_exists(fieldsToGet, layout_item_pk))
{
fieldsToGet.emplace_back(layout_item_pk);
index_primary_key = fieldsToGet.size() - 1;
......
......@@ -24,6 +24,7 @@
#include <libglom/data_structure/glomconversions.h>
#include <libglom/db_utils.h>
#include <libglom/privs.h>
#include <libglom/utils.h>
#include <glom/glade_utils.h>
#include <glom/frame_glom.h> //For show_ok_dialog()
#include <glom/utils_ui.h> //For bold_message()).
......
......@@ -21,6 +21,7 @@
#include <glom/mode_data/box_data_portal.h>
#include <libglom/data_structure/glomconversions.h>
#include <libglom/db_utils.h>
#include <libglom/utils.h>
#include <glom/glade_utils.h>
#include <glom/frame_glom.h> //For show_ok_dialog()
#include <glom/utils_ui.h> //For bold_message()).
......
......@@ -24,6 +24,7 @@
#include <glom/dialog_invalid_data.h>
#include <libglom/data_structure/glomconversions.h>
#include <glom/appwindow.h>
#include <libglom/utils.h>
#include <glibmm/i18n.h>
//#include <sstream> //For stringstream
......
......@@ -22,6 +22,7 @@
#include <glom/mode_data/datawidget/treemodel_db_withextratext.h>
#include <libglom/data_structure/glomconversions.h>
#include <libglom/privs.h>
#include <libglom/utils.h>
#include <glom/utils_ui.h>
#include <glom/appwindow.h>
#include <gtkmm/liststore.h>
......
......@@ -37,6 +37,7 @@
#include <glom/utils_ui.h>
#include <glom/glade_utils.h>
#include <libglom/db_utils.h>
#include <libglom/utils.h>
#include <glibmm/i18n.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment