Webdar 1.0.0
Web user interface to libdar
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
html_aiguille Class Reference

class html_aiguille is a pure virtual class More...

#include <html_aiguille.hpp>

Inheritance diagram for html_aiguille:
Inheritance graph
[legend]
Collaboration diagram for html_aiguille:
Collaboration graph
[legend]

Public Member Functions

 html_aiguille (const html_aiguille &ref)=delete
 
 html_aiguille (html_aiguille &&ref) noexcept=delete
 
html_aiguilleoperator= (const html_aiguille &ref)=delete
 
html_aiguilleoperator= (html_aiguille &&ref) noexcept=delete
 
void clear ()
 clear all adopted data and remove all sections
 
void add_section (const std::string &name, const std::string &title)
 add a new sections More...
 
void adopt_in_section (const std::string &section_name, body_builder *obj)
 adopt another objet in the section which name is provided More...
 
void adopt_in_section (signed int num, body_builder *obj)
 adopt an object in seection which number is provided
 
void clear_section (const std::string &section_name)
 foresake all adopted objets in the given section
 
void clear_section (signed int num)
 foresake all adopted objects in the given section
 
void remove_section (const std::string &section_name)
 foresake objects and remove section of that name More...
 
void remove_section (signed int num)
 foresake objects and remove section at that index
 
void set_active_section (const std::string &name)
 manually set the visible section, based on section name
 
void set_active_section (signed int num)
 manually set the visible section number (numbered by ordre or addition, starting at zero)
 
signed int get_active_section () const
 get the current active section
 
unsigned int size () const
 return the total number of section
 
unsigned int section_name_to_num (const std::string &name) const
 return the index of the provided section name
 
std::string num_to_section_name (unsigned int num) const
 return the name of the section knowing its index
 
virtual void void_child_will_foresake (body_builder *voidobj, body_builder *obj) override
 inherited from html_void_parent_notifier More...
 
- Public Member Functions inherited from body_builder
 body_builder ()
 constructor
 
 body_builder (const body_builder &ref)
 copy constructor More...
 
 body_builder (body_builder &&ref) noexcept=delete
 move constructor More...
 
body_builderoperator= (const body_builder &ref)
 assignment operator drops all existing children More...
 
body_builderoperator= (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...
 
- Public Member Functions inherited from html_void_parent_notifier
 html_void_parent_notifier (const html_void_parent_notifier &ref)=default
 
 html_void_parent_notifier (html_void_parent_notifier &&ref) noexcept=default
 
html_void_parent_notifieroperator= (const html_void_parent_notifier &ref)=default
 
html_void_parent_notifieroperator= (html_void_parent_notifier &&ref) noexcept=default
 
virtual void void_child_visibility_has_changed (body_builder *voidobj)
 propagates body_builder::my_visibility_has_changed() More...
 
virtual void void_child_has_adopted (body_builder *voidobj, body_builder *obj)
 propagates body_builder::has_adopted() More...
 
virtual void void_child_will_foresake (body_builder *voidobj, body_builder *obj)
 propagates body_builder::will_foresake() More...
 

Static Public Attributes

static constexpr const signed int noactive = -1
 

Protected Member Functions

virtual std::string inherited_get_body_part (const chemin &path, const request &req) override
 implementation of get_body_part() method for inherited classes More...
 
virtual void section_added (const std::string &name, const std::string &title)
 
virtual void section_removed (const std::string &name)
 
void adopt (body_builder *obj)
 
- Protected Member Functions inherited from body_builder
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_builderoperator[] (unsigned int i)
 access to adopted childs
 
body_builderget_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
 

Detailed Description

class html_aiguille is a pure virtual class

it groups adopted objets under several labeled sections at most one section is visible at a time and can be changed calling set_active_section(). If given "noactive" to set_active_section() no section will show. By default no section is created, one has to be created calling add_section() for the object to be able to adopt other objects. adopt() method from body_builder is replaced by adopt_in_section()

Member Function Documentation

◆ add_section()

void html_aiguille::add_section ( const std::string &  name,
const std::string &  title 
)

add a new sections

Parameters
[in]nameis the name of the section, not two sections can have the same name, this is code internal information which can be used to be referred to.
[in]titleis what can shows as a section title, may be the the same title of another section, can also be tranlated for localization, code should not assume anything based in the value of this field.

◆ adopt()

void body_builder::adopt ( body_builder obj)
protected

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.

Note
this call semantic is that the adopted object becomes a child of the body_builder. The adopted child stays managed by its real parent, the adoption relationship builds a tree of dependant objects using one another to provide a body_part (see get_body_part() method). this tree is automatically broken when an object is destroyed, in that way all recorded children exist (the recorded addresses always points to real existing objects)

◆ adopt_in_section()

void html_aiguille::adopt_in_section ( const std::string &  section_name,
body_builder obj 
)

adopt another objet in the section which name is provided

Note
adopt_in_section replaces body_builder::adopt() but forsake() is still available do revent this action.

◆ inherited_get_body_part()

string html_aiguille::inherited_get_body_part ( const chemin path,
const request req 
)
overrideprotectedvirtual

implementation of get_body_part() method for inherited classes

Note
this method defines what the class will return from the public method body_builder::get_body_part() which also make some housekeeping at body_builder level. In particular, the body_builder class record the "body_changed" status that is reset before calling inherited_get_body_part() and modified by the inherited class when they call the my_body_part_has_changed(). get_body_part() also caches the result of inherited_get_body_part() to avoid calling inherited_get_body_part() if for the same request it has not signaled (calling my_body_part_has_changed()) that for example an event lead its status to change and would require inherited_get_body_part() to be reevaluated

Implements body_builder.

◆ remove_section()

void html_aiguille::remove_section ( const std::string &  section_name)

foresake objects and remove section of that name

clear_section succeeded, and we don't ???

◆ void_child_will_foresake()

void html_aiguille::void_child_will_foresake ( body_builder voidobj,
body_builder obj 
)
overridevirtual

inherited from html_void_parent_notifier

Reimplemented from html_void_parent_notifier.


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