libglom-1.32 1.32.0

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Glom::Field Class Reference
Inheritance diagram for Glom::Field:
[legend]
Collaboration diagram for Glom::Field:
[legend]

## Public Types
enum | sql_format { sql_format::POSTGRES, sql_format::SQLITE }
enum | glom_field_type { glom_field_type::INVALID, glom_field_type::NUMERIC, glom_field_type::TEXT, glom_field_type::DATE, glom_field_type::TIME, glom_field_type::BOOLEAN, glom_field_type::IMAGE }
typedef std::vector< Glib::ustring > | type_list_strings
typedef std::unordered_map< glom_field_type, Glib::ustring > | type_map_type_names
Public Types inherited from Glom::TranslatableItem
enum | enumTranslatableItemType { enumTranslatableItemType::INVALID, enumTranslatableItemType::FIELD, enumTranslatableItemType::RELATIONSHIP, enumTranslatableItemType::LAYOUT_ITEM, enumTranslatableItemType::CUSTOM_TITLE, enumTranslatableItemType::PRINT_LAYOUT, enumTranslatableItemType::REPORT, enumTranslatableItemType::TABLE, enumTranslatableItemType::BUTTON, enumTranslatableItemType::TEXTOBJECT, enumTranslatableItemType::IMAGEOBJECT, enumTranslatableItemType::CHOICEVALUE, enumTranslatableItemType::DATABASE_TITLE, enumTranslatableItemType::STATIC_TEXT }
typedef std::unordered_map< Glib::ustring, Glib::ustring, std::hash< std::string > > | type_map_locale_to_translations

## Public Member Functions
| Field ()
| Field (const Field& src)=default
| Field (Field&& src)=default
Field& | operator= (const Field& src)=default
Field& | operator= (Field&& src)=default
bool | operator== (const Field& src) const
bool | operator!= (const Field& src) const
Field* | clone () const
glom_field_type | get_glom_type () const
void | set_glom_type (glom_field_type fieldtype)
Glib::ustring | get_name () const noexcept override
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_name, so that we can use it in the same std::find_if lambda. More...
void | set_name (const Glib::ustring& value) noexcept override
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_name, for convenience. More...
bool | get_auto_increment () const
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_auto_increment. More...
void | set_auto_increment (bool val=true)
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_auto_increment. More...
bool | get_primary_key () const
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_primary_key. More...
void | set_primary_key (bool val=true)
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_primary_key. More...
bool | get_unique_key () const
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_unique_key. More...
void | set_unique_key (bool val=true)
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_unique_key. More...
Gnome::Gda::Value | get_default_value () const
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_default_value. More...
void | set_default_value (const Gnome::Gda::Value& value)
| This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_default_value. More...
Glib::RefPtr< Gnome::Gda::Column > | get_field_info ()
Glib::RefPtr< const Gnome::Gda::Column > | get_field_info () const
void | set_field_info (const Glib::RefPtr< Gnome::Gda::Column >& fieldInfo)
bool | field_info_from_database_is_equal (const Glib::RefPtr< const Gnome::Gda::Column >& field)
| Ignores any part of FieldAttributes that libgda does not properly fill. More...
bool | get_is_lookup () const
std::shared_ptr< Relationship > | get_lookup_relationship () const
void | set_lookup_relationship (const std::shared_ptr< Relationship >& strRelationship)
Glib::ustring | get_lookup_field () const
void | set_lookup_field (const Glib::ustring& strField)
Glib::ustring | get_sql_type () const
Glib::ustring | get_gda_type_name () const
Glib::ustring | sql (const Gnome::Gda::Value& value, const Glib::RefPtr< Gnome::Gda::Connection >& connection) const
| Escape and quote the value so that it can be used in a SQL command. More...
Glib::ustring | to_file_format (const Gnome::Gda::Value& value) const
| Get the canonical format for a file, for instance for a default value or for example data. More...
Gnome::Gda::Value | from_file_format (const Glib::ustring& str, bool& success) const
| Parse the value from the canonical file format. More...
Glib::ustring | sql_find (const Gnome::Gda::Value& value, const Glib::RefPtr< Gnome::Gda::Connection >& connection) const
| Escape the value so that it can be used in a SQL command for a find. More...
Gnome::Gda::SqlOperatorType | sql_find_operator () const
| Get a suitable operator to use when finding records. More...
Glib::ustring | get_calculation () const
void | set_calculation (const Glib::ustring& calculation)
bool | get_has_calculation () const
type_list_strings | get_calculation_relationships () const
void | set_visible (bool val=true)
bool | get_visible () const
Public Member Functions inherited from Glom::TranslatableItem
| TranslatableItem () noexcept
| TranslatableItem (const TranslatableItem& src)=default
| TranslatableItem (TranslatableItem&& src)=default
virtual | ~TranslatableItem ()=default
TranslatableItem& | operator= (const TranslatableItem& src)=default
TranslatableItem& | operator= (TranslatableItem&& src)=default
bool | operator== (const TranslatableItem& src) const noexcept
bool | operator!= (const TranslatableItem& src) const noexcept
bool | get_name_not_empty () const noexcept
virtual Glib::ustring | get_title_or_name (const Glib::ustring& locale) const noexcept
virtual Glib::ustring | get_title (const Glib::ustring& locale) const noexcept
| Get the title's translation for the specified locale, falling back to the original text if there is no translation. More...
virtual Glib::ustring | get_title_original () const noexcept
| Get the title's original (non-translated, usually English) text. More...
Glib::ustring | get_title_translation (const Glib::ustring& locale, bool fallback=true) const noexcept
| Get the title's translation for the specified locale, optionally falling back to a locale of the same language, and then falling back to the original. More...
void | set_title (const Glib::ustring& title, const Glib::ustring& locale) noexcept
| Set the title's translation for the specified locale. More...
void | set_title_original (const Glib::ustring& title) noexcept
| Set the title's original (non-translated, usually English) text. More...
void | clear_title_in_all_locales () noexcept
| Clear the original title and any translations of the title. More...
bool | get_has_translations () const noexcept
enumTranslatableItemType | get_translatable_item_type () const noexcept

## Static Public Member Functions
static Glib::ustring | to_file_format (const Gnome::Gda::Value& value, glom_field_type glom_type)
| See to_file_format(const Gnome::Gda::Value& value). More...
static Gnome::Gda::Value | from_file_format (const Glib::ustring& str, glom_field_type glom_type, bool& success, bool old_image_format=false)
static type_map_type_names | get_type_names ()
| Get canonical type names for internal use, such as in the XML of the document. More...
static type_map_type_names | get_type_names_ui ()
| Get translated type names. More...
static type_map_type_names | get_usable_type_names ()
| Get translated type names of types that should be offered to the user. More...
static Glib::ustring | get_type_name_ui (glom_field_type glom_type)
| Get the translated name for a glom type. More...
static glom_field_type | get_type_for_ui_name (const Glib::ustring& glom_type)
| Get the type from a translated name. More...
static glom_field_type | get_glom_type_for_gda_type (GType gda_type)
static GType | get_gda_type_for_glom_type (Field::glom_field_type glom_type)
static bool | get_conversion_possible (glom_field_type field_type_src, glom_field_type field_type_dest)
Static Public Member Functions inherited from Glom::TranslatableItem
static Glib::ustring | get_translatable_type_name (enumTranslatableItemType item_type) noexcept
static Glib::ustring | get_translatable_type_name_nontranslated (enumTranslatableItemType item_type) noexcept
| The non-translated name is used for the context in gettext .po files. More...

## Public Attributes
Formatting | m_default_formatting

## Additional Inherited Members
Protected Attributes inherited from Glom::TranslatableItem
enumTranslatableItemType | m_translatable_item_type

## Member Typedef Documentation

## ◆ type_list_strings

typedef std::vector<Glib::ustring> Glom::Field::type_list_strings

## ◆ type_map_type_names

typedef std::unordered_map<glom_field_type, Glib::ustring> Glom::Field::type_map_type_names

## Member Enumeration Documentation

## ◆ glom_field_type

enum Glom::Field::glom_field_type
| strong

Enumerator
INVALID |
NUMERIC |
TEXT |
DATE |
TIME |
BOOLEAN |
IMAGE |

## ◆ sql_format

enum Glom::Field::sql_format
| strong

Enumerator
POSTGRES |
SQLITE |

## Constructor & Destructor Documentation

## ◆ Field() [1/3]

Glom::Field::Field | ( |  | ) |

## ◆ Field() [2/3]

Glom::Field::Field | ( | const Field& | src | ) |
| default

## ◆ Field() [3/3]

Glom::Field::Field | ( | Field&& | src | ) |
| default

## Member Function Documentation

## ◆ clone()

Field* Glom::Field::clone | ( |  | ) | const

## ◆ field_info_from_database_is_equal()

bool Glom::Field::field_info_from_database_is_equal | ( | const Glib::RefPtr< const Gnome::Gda::Column > & | field | ) |

Ignores any part of FieldAttributes that libgda does not properly fill.

## ◆ from_file_format() [1/2]

Gnome::Gda::Value Glom::Field::from_file_format | ( | const Glib::ustring & | str,
|  | bool & | success
| ) |  | const

Parse the value from the canonical file format.

See to_file_format() This does note remove quotes from text values so the caller may need to do that.

## ◆ from_file_format() [2/2]

static Gnome::Gda::Value Glom::Field::from_file_format | ( | const Glib::ustring & | str,
|  | glom_field_type | glom_type,
|  | bool & | success,
|  | bool | old_image_format = `false`
| ) |  |
| static

## ◆ get_auto_increment()

bool Glom::Field::get_auto_increment | ( |  | ) | const

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_auto_increment.

## ◆ get_calculation()

Glib::ustring Glom::Field::get_calculation | ( |  | ) | const

## ◆ get_calculation_relationships()

type_list_strings Glom::Field::get_calculation_relationships | ( |  | ) | const

## ◆ get_conversion_possible()

static bool Glom::Field::get_conversion_possible | ( | glom_field_type | field_type_src,
|  | glom_field_type | field_type_dest
| ) |  |
| static

## ◆ get_default_value()

Gnome::Gda::Value Glom::Field::get_default_value | ( |  | ) | const

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_default_value.

## ◆ get_field_info() [1/2]

Glib::RefPtr<Gnome::Gda::Column> Glom::Field::get_field_info | ( |  | ) |

## ◆ get_field_info() [2/2]

Glib::RefPtr<const Gnome::Gda::Column> Glom::Field::get_field_info | ( |  | ) | const

## ◆ get_gda_type_for_glom_type()

static GType Glom::Field::get_gda_type_for_glom_type | ( | Field::glom_field_type | glom_type | ) |
| static

## ◆ get_gda_type_name()

Glib::ustring Glom::Field::get_gda_type_name | ( |  | ) | const

## ◆ get_glom_type()

glom_field_type Glom::Field::get_glom_type | ( |  | ) | const

## ◆ get_glom_type_for_gda_type()

static glom_field_type Glom::Field::get_glom_type_for_gda_type | ( | GType | gda_type | ) |
| static

## ◆ get_has_calculation()

bool Glom::Field::get_has_calculation | ( |  | ) | const

## ◆ get_is_lookup()

bool Glom::Field::get_is_lookup | ( |  | ) | const

## ◆ get_lookup_field()

Glib::ustring Glom::Field::get_lookup_field | ( |  | ) | const

## ◆ get_lookup_relationship()

std::shared_ptr<Relationship> Glom::Field::get_lookup_relationship | ( |  | ) | const

## ◆ get_name()

Glib::ustring Glom::Field::get_name | ( |  | ) | const
| override virtual noexcept

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_name, so that we can use it in the same std::find_if lambda.

Reimplemented from Glom::TranslatableItem.

## ◆ get_primary_key()

bool Glom::Field::get_primary_key | ( |  | ) | const

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_primary_key.

## ◆ get_sql_type()

Glib::ustring Glom::Field::get_sql_type | ( |  | ) | const

## ◆ get_type_for_ui_name()

static glom_field_type Glom::Field::get_type_for_ui_name | ( | const Glib::ustring & | glom_type | ) |
| static

Get the type from a translated name.

## ◆ get_type_name_ui()

static Glib::ustring Glom::Field::get_type_name_ui | ( | glom_field_type | glom_type | ) |
| static

Get the translated name for a glom type.

## ◆ get_type_names()

static type_map_type_names Glom::Field::get_type_names | ( |  | ) |
| static

Get canonical type names for internal use, such as in the XML of the document.

## ◆ get_type_names_ui()

static type_map_type_names Glom::Field::get_type_names_ui | ( |  | ) |
| static

Get translated type names.

## ◆ get_unique_key()

bool Glom::Field::get_unique_key | ( |  | ) | const

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::get_unique_key.

## ◆ get_usable_type_names()

static type_map_type_names Glom::Field::get_usable_type_names | ( |  | ) |
| static

Get translated type names of types that should be offered to the user.

## ◆ get_visible()

bool Glom::Field::get_visible | ( |  | ) | const

## ◆ operator!=()

bool Glom::Field::operator!= | ( | const Field& | src | ) | const

## ◆ operator=() [1/2]

Field& Glom::Field::operator= | ( | const Field& | src | ) |
| default

## ◆ operator=() [2/2]

Field& Glom::Field::operator= | ( | Field&& | src | ) |
| default

## ◆ operator==()

bool Glom::Field::operator== | ( | const Field& | src | ) | const

## ◆ set_auto_increment()

void Glom::Field::set_auto_increment | ( | bool | val = `true` | ) |

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_auto_increment.

## ◆ set_calculation()

void Glom::Field::set_calculation | ( | const Glib::ustring & | calculation | ) |

## ◆ set_default_value()

void Glom::Field::set_default_value | ( | const Gnome::Gda::Value & | value | ) |

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_default_value.

## ◆ set_field_info()

void Glom::Field::set_field_info | ( | const Glib::RefPtr< Gnome::Gda::Column > & | fieldInfo | ) |

## ◆ set_glom_type()

void Glom::Field::set_glom_type | ( | glom_field_type | fieldtype | ) |

## ◆ set_lookup_field()

void Glom::Field::set_lookup_field | ( | const Glib::ustring & | strField | ) |

## ◆ set_lookup_relationship()

void Glom::Field::set_lookup_relationship | ( | const std::shared_ptr< Relationship >& | strRelationship | ) |

## ◆ set_name()

void Glom::Field::set_name | ( | const Glib::ustring & | value | ) |
| override virtual noexcept

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_name, for convenience.

Reimplemented from Glom::TranslatableItem.

## ◆ set_primary_key()

void Glom::Field::set_primary_key | ( | bool | val = `true` | ) |

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_primary_key.

## ◆ set_unique_key()

void Glom::Field::set_unique_key | ( | bool | val = `true` | ) |

This forwards to the Glib::RefPtr<Gnome::Gda::Column>::set_unique_key.

## ◆ set_visible()

void Glom::Field::set_visible | ( | bool | val = `true` | ) |

## ◆ sql()

Glib::ustring Glom::Field::sql | ( | const Gnome::Gda::Value & | value,
|  | const Glib::RefPtr< Gnome::Gda::Connection > & | connection
| ) |  | const

Escape and quote the value so that it can be used in a SQL command.

## ◆ sql_find()

Glib::ustring Glom::Field::sql_find | ( | const Gnome::Gda::Value & | value,
|  | const Glib::RefPtr< Gnome::Gda::Connection > & | connection
| ) |  | const

Escape the value so that it can be used in a SQL command for a find.

## ◆ sql_find_operator()

Gnome::Gda::SqlOperatorType Glom::Field::sql_find_operator | ( |  | ) | const

Get a suitable operator to use when finding records.

For instance, == for numbers, or LIKE for text.

## ◆ to_file_format() [1/2]

Glib::ustring Glom::Field::to_file_format | ( | const Gnome::Gda::Value & | value | ) | const

Get the canonical format for a file, for instance for a default value or for example data.

This does not add quotes for text fields so the caller may need to do that. Note that this does not do any extra escaping such as an XML file might need. However, this will escape data as per the CSV RFC.

## ◆ to_file_format() [2/2]

static Glib::ustring Glom::Field::to_file_format | ( | const Gnome::Gda::Value & | value,
|  | glom_field_type | glom_type
| ) |  |
| static

See to_file_format(const Gnome::Gda::Value& value).

## Member Data Documentation

## ◆ m_default_formatting

Formatting Glom::Field::m_default_formatting

The documentation for this class was generated from the following file:

- libglom/data_structure/field.h