Webdar 1.0.0
Web user interface to libdar
css_library.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef CSS_LIBRARY_HPP
25#define CSS_LIBRARY_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35#include <string>
36
37 // webdar headers
38#include "css_class.hpp"
39
41
44
46{
47public:
48
49 css_library() = default;
50 css_library(const css_library & ref) = default;
51 css_library(css_library && ref) noexcept = default;
52 css_library & operator = (const css_library & ref) = default;
53 css_library & operator = (css_library && ref) noexcept = default;
54 ~css_library() = default;
55
57 void add(const css_class & value);
58
60 void add(const std::string & name, const css & value);
61
63 bool class_exists(const std::string & name) const;
64
66 bool get_value(const std::string & name, std::string & stored_value) const;
67
69 void del(const std::string & name);
70
72 unsigned int size() const { return content.size(); };
73
75 std::string get_html_class_definitions() const;
76
77private:
78 std::map<std::string, std::string> content;
79
80};
81
82#endif
class css_class gather css attributed under a given label
Definition: css_class.hpp:51
class css_library
Definition: css_library.hpp:46
bool get_value(const std::string &name, std::string &stored_value) const
obtain the definition of the given class
Definition: css_library.cpp:67
std::string get_html_class_definitions() const
provide a css definition of all classes of the library suitable for HTML headers or CSS files
Definition: css_library.cpp:90
unsigned int size() const
return the number of class in that library
Definition: css_library.hpp:72
void add(const css_class &value)
add a new class to the library (must not already exist in the library)
Definition: css_library.cpp:43
void del(const std::string &name)
remove a class from the library
Definition: css_library.cpp:80
bool class_exists(const std::string &name) const
check whether a class has a definition in this library object
Definition: css_library.cpp:60
class managing Cascading Style Sheets attributes
Definition: css.hpp:48