libglom-1.30  1.30.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:
Inheritance graph
[legend]
Collaboration diagram for Glom::Field:
Collaboration graph
[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::ustringtype_list_strings
 
typedef std::map< glom_field_type, Glib::ustringtype_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::map< Glib::ustring, Glib::ustringtype_map_locale_to_translations
 

Public Member Functions

 Field ()
 
 Field (const Field& src)
 
 Field (Field&& src)=delete
 
 ~Field ()
 
Fieldoperator= (const Field& src)
 
Fieldoperator= (Field&& src)=delete
 
bool operator== (const Field& src) const
 
bool operator!= (const Field& src) const
 
Fieldclone () const
 
glom_field_type get_glom_type () const
 
void set_glom_type (glom_field_type fieldtype)
 
Glib::ustring get_name () const noexceptoverride
 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) noexceptoverride
 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< Relationshipget_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) noexcept
 
 TranslatableItem (TranslatableItem&& src) noexcept
 
virtual ~TranslatableItem ()
 
TranslatableItemoperator= (const TranslatableItem& src) noexcept
 
TranslatableItemoperator= (TranslatableItem&& src) noexcept
 
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

Member Enumeration Documentation

Enumerator
INVALID 
NUMERIC 
TEXT 
DATE 
TIME 
BOOLEAN 
IMAGE 
Enumerator
POSTGRES 
SQLITE 

Constructor & Destructor Documentation

Glom::Field::Field ( )
Glom::Field::Field ( const Field src)
Glom::Field::Field ( Field&&  src)
delete
Glom::Field::~Field ( )

Member Function Documentation

Field* Glom::Field::clone ( ) const
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.

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.

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
bool Glom::Field::get_auto_increment ( ) const

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

Glib::ustring Glom::Field::get_calculation ( ) const
type_list_strings Glom::Field::get_calculation_relationships ( ) const
static bool Glom::Field::get_conversion_possible ( glom_field_type  field_type_src,
glom_field_type  field_type_dest 
)
static
Gnome::Gda::Value Glom::Field::get_default_value ( ) const

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

Glib::RefPtr<Gnome::Gda::Column> Glom::Field::get_field_info ( )
Glib::RefPtr<const Gnome::Gda::Column> Glom::Field::get_field_info ( ) const
static GType Glom::Field::get_gda_type_for_glom_type ( Field::glom_field_type  glom_type)
static
Glib::ustring Glom::Field::get_gda_type_name ( ) const
glom_field_type Glom::Field::get_glom_type ( ) const
static glom_field_type Glom::Field::get_glom_type_for_gda_type ( GType  gda_type)
static
bool Glom::Field::get_has_calculation ( ) const
bool Glom::Field::get_is_lookup ( ) const
Glib::ustring Glom::Field::get_lookup_field ( ) const
std::shared_ptr<Relationship> Glom::Field::get_lookup_relationship ( ) const
Glib::ustring Glom::Field::get_name ( ) const
overridevirtualnoexcept

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.

bool Glom::Field::get_primary_key ( ) const

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

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

Get the type from a translated name.

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

Get the translated name for a glom type.

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.

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

Get translated type names.

bool Glom::Field::get_unique_key ( ) const

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

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.

bool Glom::Field::get_visible ( ) const
bool Glom::Field::operator!= ( const Field src) const
Field& Glom::Field::operator= ( const Field src)
Field& Glom::Field::operator= ( Field&&  src)
delete
bool Glom::Field::operator== ( const Field src) const
void Glom::Field::set_auto_increment ( bool  val = true)

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

void Glom::Field::set_calculation ( const Glib::ustring calculation)
void Glom::Field::set_default_value ( const Gnome::Gda::Value &  value)

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

void Glom::Field::set_field_info ( const Glib::RefPtr< Gnome::Gda::Column > &  fieldInfo)
void Glom::Field::set_glom_type ( glom_field_type  fieldtype)
void Glom::Field::set_lookup_field ( const Glib::ustring strField)
void Glom::Field::set_lookup_relationship ( const std::shared_ptr< Relationship >&  strRelationship)
void Glom::Field::set_name ( const Glib::ustring value)
overridevirtualnoexcept

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

Reimplemented from Glom::TranslatableItem.

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

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

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

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

void Glom::Field::set_visible ( bool  val = true)
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.

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.

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.

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.

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

Formatting Glom::Field::m_default_formatting

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