![]() |
Webdar 1.0.0
Web user interface to libdar
|
class body_builder is the root class of object generating HTML body More...
#include <body_builder.hpp>
Public Member Functions | |
body_builder () | |
constructor | |
body_builder (const body_builder &ref) | |
copy constructor More... | |
body_builder (body_builder &&ref) noexcept=delete | |
move constructor More... | |
body_builder & | operator= (const body_builder &ref) |
assignment operator drops all existing children More... | |
body_builder & | operator= (body_builder &&ref) noexcept=delete |
move operator More... | |
virtual | ~body_builder () |
the (virtual) destructor | |
void | set_prefix (const chemin &prefix) |
void | adopt (body_builder *obj) |
bool | is_adopted () const |
whether the object has currently a parent (= is adopted) | |
void | foresake (body_builder *obj) |
void | set_visible (bool mode) |
ask for the object to become visible in HTML page or temporarily hidden More... | |
bool | get_visible () const |
returns the current visible status of the object More... | |
bool | get_visible_recursively () const |
return the effective visible status of an object taking into account all of ancestors that adopted it | |
void | add_css_class (const std::string &name) |
set this object with a additional css_class (assuming it is defined in a css_library available for this object) | |
void | add_css_class (const css_class_group &cg) |
set this object with an additional set of css_classes (assuming they are all defined in a css_library available for this object) | |
bool | has_css_class (const std::string &name) const |
check the presence of the given class name | |
void | remove_css_class (const std::string &name) |
remove the provided css_class name from the list of css_class names this object has been assigned to | |
void | remove_css_class (const css_class_group &cg) |
remove the provided css_class_group from the list | |
void | clear_css_classes () |
clear the whole list of css_class names | |
const std::set< std::string > & | get_css_classes_as_a_set () const |
provide the list of css_class names that this object has been set with | |
css_class_group | get_css_class_group () const |
provide the list of css_class names as a css_class_group | |
std::string | get_css_classes (const std::string &extra="") const |
return the class_name as inlined css, suitable to be added in a html marker More... | |
void | define_css_class_in_library (const css_class &csscl) |
void | define_css_class_in_library (const std::string &name, const css &cssdef) |
bool | is_css_class_defined_in_library (const std::string &name) const |
check whether a css_class of given name already exists in a reachable css_library | |
std::string | get_body_part (const chemin &path, const request &req) |
void | ignore_body_changed_from_my_children (bool mode) |
ignore my_body_part_has_changed() invoked from adopted children and myself More... | |
bool | get_ignore_body_changed_from_my_children () const |
get the current status of ignore_body_changed_from_my_children() | |
void | set_no_CR (bool no_cr=true) |
ask for the implementation not to add a new line after this control More... | |
void | assign_anchor (bool mode) |
assign an anchor to this object (the object's inherited_get_body_part() will be wrapped into an HTML anchor: ) More... | |
std::string | get_assigned_anchor () const |
return the anchor value that has been assiged to this object (without the leading #) More... | |
virtual void | bind_to_anchor (const std::string &val) |
ask inherited components to use this anchor in case they redirect to an new URL or generate new URLs within their body part. More... | |
Protected Member Functions | |
virtual std::string | inherited_get_body_part (const chemin &path, const request &req)=0 |
implementation of get_body_part() method for inherited classes More... | |
void | my_body_part_has_changed () |
let a class record a change in what inherited_get_body_part() would return if it was called again with the same request More... | |
virtual void | my_visibility_has_changed () |
available for inherited class to be informed when their visibility changes More... | |
bool | has_my_body_part_changed () const |
obtain the body_part changed status More... | |
chemin | get_path () const |
return the path of 'this' according to its descent in the body_builder tree of adopted children | |
std::string | get_recorded_name () const |
void | store_css_library () |
this creates a css_library accessible from adopted objects to hold html class definitions More... | |
bool | has_local_css_library () const |
return true if this object has a css_library locally stored (not from a adopter object) | |
std::unique_ptr< css_library > & | lookup_css_library () const |
lookup toward registered parent body_builder object for the closest stored css_library More... | |
std::string | get_body_part_from_target_child (const chemin &path, const request &req) |
std::string | get_body_part_from_all_children (const chemin &path, const request &req) |
virtual void | path_has_changed () |
For inherited classes, called when the path has changed,. More... | |
virtual void | has_adopted (body_builder *obj) |
Be informed that a new child has been adopted. More... | |
virtual void | will_foresake (body_builder *obj) |
Be informed that a child is about to be foresaken. More... | |
virtual void | has_been_adopted_by (body_builder *obj) |
Be informed that we have been adopted by obj, our new parent. | |
virtual void | will_be_foresaken_by (body_builder *obj) |
Be informed that we are about to be foresaken by obj, our soon former parent. | |
virtual void | css_classes_have_changed () |
Be informed about css class modification. More... | |
virtual void | new_css_library_available () |
unsigned int | size () const |
access to adopted childs | |
body_builder * | operator[] (unsigned int i) |
access to adopted childs | |
body_builder * | get_parent () const |
return the parent object or nullptr if no object has adopted this object | |
template<class T > | |
void | closest_ancestor_of_type (T *&ancestor) |
access to the closest ancestor (parent) matching (dynamic_cast) the provided type More... | |
void | orphan_all_children () |
orphan all adopted children | |
bool | get_no_CR () const |
true if it has been requested no to add Carriage Return after the HTML object | |
class body_builder is the root class of object generating HTML body
body_builder::body_builder | ( | const body_builder & | ref | ) |
copy constructor
|
deletenoexcept |
move constructor
void body_builder::adopt | ( | body_builder * | obj | ) |
Common interface for classes that have to ask other body_builder to contribute in building their body_part()
this call is not mandatory, but let a body_builder object the possibility to rely on the set of body_builder available protected routines to recursively build the body part from the list of adopted children. An object can only have one parent.
void body_builder::assign_anchor | ( | bool | mode | ) |
assign an anchor to this object (the object's inherited_get_body_part() will be wrapped into an HTML anchor: )
The objective is for page updates to stay scrolled down with the corresponding body builder object at the top of the viewport when the URL ends by "#value". The value is selected by the body builder class to provide unicity between all objects having been assigned an anchor.
[in] | mode | if true an anchor is assigned to the object and inserted before its body builder part. If set to false (which is the default), no anchor is inserted before the body builder part of the object. |
|
inlinevirtual |
ask inherited components to use this anchor in case they redirect to an new URL or generate new URLs within their body part.
Reimplemented in guichet, html_button, html_ciphering, html_compression_params, html_double_button, html_entrepot, html_entrepot_landing, html_form_fieldset, html_fsa_scope, html_mask_form_filename, html_mask_form_path, html_slicing, html_url, and html_form.
|
inlineprotected |
access to the closest ancestor (parent) matching (dynamic_cast) the provided type
[in] | ancestor | point to the found ancestor if found (points to nullptr else) |
|
inlineprotectedvirtual |
Be informed about css class modification.
Reimplemented in html_button, html_ciphering, html_compression_params, html_derouleur, html_double_button, html_entrepot, html_entrepot_landing, html_form_radio, html_mask_form_filename, html_mask_form_path, and html_slicing.
void body_builder::define_css_class_in_library | ( | const css_class & | csscl | ) |
add a css definition on a css_library reachable by this object
void body_builder::foresake | ( | body_builder * | obj | ) |
Common interface for class that have to ask other body_builder to provide their own body_part()
this call is not mandatory, it is the opposite action of adopt(). After this call the given object is no more sollicited to build a body part.
|
inline |
return the anchor value that has been assiged to this object (without the leading #)
ask the object to provide a part of the body to answer the request
[in] | path | is the full path, but the path.index points to the asked object name |
[in] | req | is the request to be answered, the uri's path part targets the choice of child to use for the sub-response |
|
protected |
let a parent obtain the body part from all children in the order the have been adopted
[in] | path | is the body_builder path, it can be empty. If not the front member is poped from the target even if the poped part of the path does not match the name of the consulted child object |
[in] | req | this is the request exactly as received from the get_body_part call |
|
protected |
let a parent obtain the body part from one of its children given its official name and seen the path of the request
[in] | path | is the path exactly as received from the get_body_part call: the first member is the name of a child object. |
[in] | req | is the request exactly as received from the get_body_part call |
string body_builder::get_css_classes | ( | const std::string & | extra = "" | ) | const |
return the class_name as inlined css, suitable to be added in a html marker
[in] | extra | a space sperated list of additional classes to add beside the ones assigned to this object. The use case for extra parameter is to temporarily add a css class without having the object considered modified (and his inherited_get_body_part() re-evaluated). |
|
protected |
returns the name of 'this' if it has been adopted by a parent body_builder object
|
inline |
returns the current visible status of the object
|
inlineprotectedvirtual |
Be informed that a new child has been adopted.
Reimplemented in html_label, html_tooltip, html_form_fieldset, html_hr, html_level, and html_void.
|
inlineprotected |
obtain the body_part changed status
|
inline |
ignore my_body_part_has_changed() invoked from adopted children and myself
some object (like html_statistics) are ever changing, but rely on some component that will trigger my_body_part_has_changed() to reflect the new value, leading the parent (here html_statistics) to be recorded as changed and the cycle is complete this process never ends. This call avoids propagating any future body_changed status toward the parents and set the caller as if it was a static, never changing, object.
|
protectedpure virtual |
implementation of get_body_part() method for inherited classes
Implemented in arriere_boutique< T >, arriere_boutique< html_entrepot_landing >, arriere_boutique< html_mask_form_filename >, arriere_boutique< html_mask_form_path >, arriere_boutique< html_compression_params >, arriere_boutique< html_slicing >, arriere_boutique< html_ciphering >, arriere_boutique< html_form_sig_block_size >, arriere_boutique< html_form_overwrite_action >, arriere_boutique< html_options_test >, arriere_boutique< html_options_compare >, arriere_boutique< html_options_read >, arriere_boutique< html_options_create >, arriere_boutique< html_options_isolate >, arriere_boutique< html_options_merge >, arriere_boutique< html_options_repair >, arriere_boutique< html_options_extract >, guichet, html_aiguille, html_archive_compare, html_archive_create, html_archive_extract, html_archive_isolate, html_archive_merge, html_archive_read, html_archive_repair, html_bibliotheque, html_button, html_ciphering, html_compression_params, html_datetime, html_derouleur, html_dir_tree, html_div, html_double_button, html_entrepot, html_entrepot_landing, html_fichier, html_focus, html_form, html_form_dynamic_table, html_form_fieldset, html_form_gnupg_list, html_form_ignore_as_symlink, html_form_input, html_form_input_file, html_form_mask_bool, html_form_mask_expression, html_form_mask_file, html_form_mask_subdir, html_form_overwrite_action, html_form_overwrite_base_criterium, html_form_overwrite_combining_criterium, html_form_radio, html_form_same_fs, html_form_select, html_form_sig_block_size, html_fsa_scope, html_hr, html_image, html_label, html_legend, html_level, html_libdar_running_page, html_libdar_running_popup, html_mask_form_filename, html_mask_form_path, html_menu, html_options_compare, html_options_create, html_options_extract, html_options_isolate, html_options_list, html_options_merge, html_options_read, html_options_repair, html_options_test, html_over_guichet, html_page, html_popup, html_select_file, html_slicing, html_span, html_statistics, html_table, html_tabs, html_text, html_url, html_void, html_web_user_interaction, and saisie.
|
protected |
lookup toward registered parent body_builder object for the closest stored css_library
|
protected |
let a class record a change in what inherited_get_body_part() would return if it was called again with the same request
method provided to inherited class to signal a change since the previous time inherited_get_body_part() has changed. This should not concern changes that are triggered by a call to inherited_get_body_part():
|
inlineprotectedvirtual |
available for inherited class to be informed when their visibility changes
Reimplemented in html_libdar_running_popup, html_void, and html_web_user_interaction.
|
inlineprotectedvirtual |
this is a trigger, ran when a css_library becomes available in a parent or "this"
Reimplemented in arriere_boutique< T >, arriere_boutique< html_entrepot_landing >, arriere_boutique< html_mask_form_filename >, arriere_boutique< html_mask_form_path >, arriere_boutique< html_compression_params >, arriere_boutique< html_slicing >, arriere_boutique< html_ciphering >, arriere_boutique< html_form_sig_block_size >, arriere_boutique< html_form_overwrite_action >, arriere_boutique< html_options_test >, arriere_boutique< html_options_compare >, arriere_boutique< html_options_read >, arriere_boutique< html_options_create >, arriere_boutique< html_options_isolate >, arriere_boutique< html_options_merge >, arriere_boutique< html_options_repair >, arriere_boutique< html_options_extract >, guichet, html_archive_compare, html_archive_create, html_archive_extract, html_archive_isolate, html_archive_merge, html_archive_read, html_archive_repair, html_bibliotheque, html_ciphering, html_compression_params, html_demo, html_derouleur, html_dir_tree, html_disconnect, html_entrepot, html_entrepot_landing, html_error, html_form_dynamic_table, html_form_gnupg_list, html_form_ignore_as_symlink, html_form_input, html_form_input_file, html_form_input_unit, html_form_mask_bool, html_form_mask_expression, html_form_mask_file, html_form_mask_subdir, html_form_overwrite_combining_criterium, html_form_overwrite_conditional_action, html_form_radio, html_form_same_fs, html_form_sig_block_size, html_listing_page, html_menu, html_options_compare, html_options_create, html_options_extract, html_options_isolate, html_options_list, html_options_merge, html_options_read, html_options_repair, html_options_test, html_popup, html_select_file, html_slicing, html_statistics, html_summary_page, html_tabs, html_tooltip, html_version, html_web_user_interaction, html_yes_no_box, and saisie.
|
deletenoexcept |
move operator
body_builder & body_builder::operator= | ( | const body_builder & | ref | ) |
assignment operator drops all existing children
|
inlineprotectedvirtual |
For inherited classes, called when the path has changed,.
Reimplemented in html_button.
void body_builder::set_no_CR | ( | bool | no_cr = true | ) |
ask for the implementation not to add a new line after this control
void body_builder::set_prefix | ( | const chemin & | prefix | ) |
set the root path at which this object will be located in the URL path
void body_builder::set_visible | ( | bool | mode | ) |
ask for the object to become visible in HTML page or temporarily hidden
|
inlineprotected |
this creates a css_library accessible from adopted objects to hold html class definitions
|
inlineprotectedvirtual |
Be informed that a child is about to be foresaken.
Reimplemented in html_focus, html_level, and html_void.