Files | |
file | forms.c |
Forms interface. | |
file | forms.h |
Form interface. | |
Data Structures | |
struct | Form |
Structure describing a single form. More... | |
struct | FormField |
Structure describing a single form field. More... | |
Defines | |
#define | FRM_ERROR "frm_error" |
The field name that holds form error messages. | |
Enumerations | |
enum | FieldType { FT_NONE, FT_TEXT, FT_PWD, FT_FILENAME } |
Form Field type. More... | |
enum | FieldRelevance { FR_OPTIONAL, FR_REQUIRED } |
Field Relevance. More... | |
Functions | |
FormField * | fld_add (FormField *fld, char *nm) |
Add a new field with the given name. | |
int | fld_count (FormField *fld) |
Get the number of form fields. | |
FormField * | fld_free (FormField *fld) |
Free the specified field and return NULL. | |
FormField * | fld_get (FormField *fld, int i) |
Get the 'i'th field in the list rooted at 'fld'. | |
char * | fld_get_help (FormField *fld) |
Retrieve the help text for the subject field. | |
FormField * | fld_get_last (FormField *fld) |
Find the last field in the list rooted at 'fld'. | |
char * | fld_get_name (FormField *fld) |
Get the name of the specified field. | |
FieldRelevance | fld_get_relevance (FormField *fld) |
Get the relevance of this field. | |
char * | fld_get_tip (FormField *fld) |
Get the tip text for the specified field. | |
FieldType | fld_get_type (FormField *fld) |
Get the field type. | |
char * | fld_get_value (FormField *fld) |
Get the value text from the field. | |
char * | fld_get_value_by_name (FormField *fld, char *nm) |
Search the field list rooted at 'fld', and return the value of the field with the name 'nm'. | |
FormField * | fld_new (char *nm) |
Allocate a new field named 'nm'. | |
FormField * | fld_next (FormField *fld) |
Return the next field in the list after 'fld'. | |
void | fld_set_help (FormField *fld, char *hlp) |
Set the help text for the field. | |
FormField * | fld_set_name (FormField *fld, char *nm) |
Set the name of the field. | |
void | fld_set_relevance (FormField *fld, FieldRelevance r) |
Set the relevance of the field. | |
void | fld_set_tip (FormField *fld, char *txt) |
Set the tip text for the field. | |
void | fld_set_type (FormField *fld, FieldType typ) |
Set the type of the field. | |
void | fld_set_value (FormField *fld, char *val) |
Set the value of the field. | |
char * | fld_set_value_by_name (FormField *fld, char *nm, char *val) |
Search the field list rooted at 'fld', and set the value of the field(s) with the name 'nm' to 'val'. | |
ABuf * | frm_check_fields (Form *frm) |
Creates a pane from a form. | |
void | frm_clear_fields (Form *frm) |
Clears the values of all fields, but doesn't free them. | |
Form * | frm_free (Form *f) |
Free the specified form. | |
FormField * | frm_add_field (Form *frm, char *nm, char *val) |
Add a new field to the form. | |
FormField * | frm_get_field (Form *frm, int n) |
Get the 'n'th field from the form. | |
FieldType | frm_get_field_type (Form *frm, int n) |
Get the type of the 'n'th field from the form. | |
int | frm_get_field_count (Form *frm) |
Get the number of fields in the form. | |
char * | frm_get_field_name (Form *frm, int i) |
Get the name of the 'i'th field on the form. | |
char * | frm_get_title (Form *frm) |
Get the form title. | |
char * | frm_get_value (Form *frm, int i) |
Get the value of the 'i'th field on the form. | |
char * | frm_get_value_by_name (Form *frm, char *nm) |
Get the value of the form field with the name 'nm'. | |
FormField * | frm_last_field (Form *frm) |
Get the last field on the form. | |
int | frm_match (Form *frm1, Form *frm2) |
Compare two forms to see if they are identical. | |
Form * | frm_new (Form *frm) |
Allocate a new form. | |
int | frm_save_file (Form *frm, char *fn) |
Save the Form to a file. | |
void | frm_set_field_type (Form *frm, int id, int typ) |
Set the type of the 'i'th field on the form. | |
Form * | frm_set_title (Form *f, char *ttl) |
Set the title of the form. | |
void | frm_set_value_by_name (Form *frm, char *nm, char *val) |
Set the value of the form field(s) named 'nm'. |
|
Field Relevance. Marks the field as optional or compulsory. Definition at line 40 of file forms.h. Referenced by fld_get_relevance(), fld_set_relevance(), and frm_check_fields(). |
|
Form Field type.
Definition at line 32 of file forms.h. Referenced by fld_get_type(), fld_set_type(), and frm_get_field_type(). |
|
Add a new field with the given name.
Definition at line 63 of file forms.c. References fld_new(), and FormField::next. Referenced by frm_add_field(). |
|
Get the number of form fields.
Definition at line 86 of file forms.c. References FormField::next. Referenced by frm_get_field_count(). |
|
Free the specified field and return NULL.
Definition at line 101 of file forms.c. References fld_set_name(), fld_set_value(), and FormField::next. Referenced by frm_clear(), and frm_free(). |
|
Get the 'i'th field in the list rooted at 'fld'.
Definition at line 118 of file forms.c. References FormField::next. Referenced by frm_get_field(). |
|
Retrieve the help text for the subject field.
Definition at line 133 of file forms.c. References FormField::help. Referenced by frm_print(), and frm_save_file(). |
|
Get the name of the specified field.
Definition at line 178 of file forms.c. References FormField::name. Referenced by frm_check_fields(), frm_copy(), frm_get_field_name(), frm_print(), and frm_save_file(). |
|
Get the relevance of this field.
Definition at line 143 of file forms.c. References FieldRelevance, FR_OPTIONAL, and FormField::rel. Referenced by frm_check_fields(). |
|
Get the tip text for the specified field.
Definition at line 153 of file forms.c. References FormField::tip. Referenced by frm_print(), and frm_save_file(). |
|
Get the field type.
Definition at line 168 of file forms.c. References FieldType, FT_NONE, and FormField::type. Referenced by frm_get_field_type(). |
|
Get the value text from the field.
Definition at line 188 of file forms.c. References FormField::value. Referenced by frm_check_fields(), frm_get_value(), frm_print(), and frm_save_file(). |
|
Set the help text for the field.
Definition at line 242 of file forms.c. References FormField::help. Referenced by frm_define_field(). |
|
Set the relevance of the field.
Definition at line 256 of file forms.c. References FieldRelevance, and FormField::rel. Referenced by register_XPath(). |
|
Set the tip text for the field.
Definition at line 266 of file forms.c. References FormField::tip. Referenced by frm_define_field(), register_PostgreSQL(), and register_XPath(). |
|
Set the type of the field.
Definition at line 232 of file forms.c. References FieldType, and FormField::type. Referenced by frm_set_field_type(), register_PostgreSQL(), and register_XPath(). |
|
Set the value of the field.
Definition at line 298 of file forms.c. References FormField::value. Referenced by fld_free(), fld_set_value_by_name(), frm_add_field(), and frm_clear_fields(). |
|
Add a new field to the form. Returns a pointer to the added field. Definition at line 325 of file forms.c. References Form::fld, fld_add(), fld_set_value(), and frm_last_field(). Referenced by frm_copy(), frm_define_field(), register_PostgreSQL(), and register_XPath(). |
|
Creates a pane from a form.
Definition at line 386 of file forms.c. References buf_str_shrinkbyone(), buf_strcat(), FieldRelevance, fld_get_name(), fld_get_relevance(), fld_get_value(), FR_REQUIRED, frm_get_field(), and frm_get_field_count(). Referenced by db_connect_dialog_reconnect(). |
|
Clears the values of all fields, but doesn't free them.
Definition at line 430 of file forms.c. References Form::fld, fld_set_value(), and FormField::next. Referenced by pg_DBurl_to_form(), and xp_DBurl_to_form(). |
|
Get the value of the 'i'th field on the form.
Definition at line 517 of file forms.c. References Form::fld, fld_get_value(), and frm_get_field(). Referenced by frm_match(). |
|
Compare two forms to see if they are identical.
Definition at line 596 of file forms.c. References frm_get_field_count(), frm_get_field_name(), frm_get_value(), and frm_get_value_by_name(). |
|
Save the Form to a file.
Definition at line 653 of file forms.c. References _a_buf::b_dat, buf_free(), buf_new(), buf_strcat(), buf_strcpy(), Form::fld, fld_get_help(), fld_get_name(), fld_get_tip(), fld_get_value(), fld_next(), FRM_ERROR, frm_get_title(), and frm_set_value_by_name(). |