From af365474a7c19b95fc7cfa8f71eaf96576e03be0 Mon Sep 17 00:00:00 2001 From: groche97 Date: Mon, 1 Jun 2020 23:24:24 +0200 Subject: [PATCH] add doxygen --- ClienteTFG.pro.user | 2 +- conexion.h | 23 ++++++++++++++--- conexion_ssl.h | 22 ++++++++++++++-- config_reader.h | 12 +++++++++ container_window.h | 6 +++++ controller_info.h | 24 ++++++++++++++++++ controller_install.h | 16 +++++++++++- controller_user_info.h | 29 +++++++++++++++++++++ dialog_add_user.h | 15 ++++++++++- read_uses.h | 15 +++++++++++ session_manager.h | 57 +++++++++++++++++++++++++++++++++++++++++- view_info.h | 8 ++++++ view_install.h | 4 +++ view_loggin.h | 9 +++++++ view_user_info.h | 9 ++++++- 15 files changed, 241 insertions(+), 10 deletions(-) diff --git a/ClienteTFG.pro.user b/ClienteTFG.pro.user index 9448cf7..87220ea 100644 --- a/ClienteTFG.pro.user +++ b/ClienteTFG.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/conexion.h b/conexion.h index d594e3a..9062606 100644 --- a/conexion.h +++ b/conexion.h @@ -5,10 +5,27 @@ class conexion { public: + /** + * @brief conexion + * Create a conexion + * @param conf Config file to give the parameters of conexion + */ conexion(config_reader &conf); - - virtual ssize_t read_string(std::string &entrada, int size); - virtual ssize_t write_string(std::string entrada); + /** + * @brief read_string + * Read a string in the socket + * @param input String readed + * @param size Length to read + * @return Size of bytes readed + */ + virtual ssize_t read_string(std::string &input, int size); + /** + * @brief write_string + * Write a sitring in the socket + * @param output String to send + * @return bytes sended + */ + virtual ssize_t write_string(std::string output); protected: config_reader *config; int fd; diff --git a/conexion_ssl.h b/conexion_ssl.h index 17c172d..b51268c 100644 --- a/conexion_ssl.h +++ b/conexion_ssl.h @@ -6,9 +6,27 @@ class conexion_ssl : public conexion { public: + /** + * @brief conexion_ssl + * Create a secure conexion + * @param conf Config file to give the parameters of conexion + */ conexion_ssl(config_reader &conf); - ssize_t read_string(std::string &entrada, int size); - ssize_t write_string(std::string entrada); + /** + * @brief read_string + * Read a string in the SSL socket + * @param input String readed + * @param size Length to read + * @return Size of bytes readed + */ + ssize_t read_string(std::string &input, int size); + /** + * @brief write_string + * Write a sitring in the secure socket + * @param output String to send + * @return bytes sended + */ + ssize_t write_string(std::string output); private: SSL* ssl; }; diff --git a/config_reader.h b/config_reader.h index ab5b8d6..9df6cbf 100644 --- a/config_reader.h +++ b/config_reader.h @@ -6,7 +6,19 @@ class config_reader { public: + /** + * @brief config_reader + * Generate a objet to extract info to a config file + * @param path File path to extract the file + */ config_reader(std::string); + /** + * @brief get_param + * Permit extract a value in a config file + * @param variable Name of a field to extract the info + * @param value Info extracted + * @return True if the field exists, false if not + */ bool get_param(std::string variable, std::string &value); private: std::ifstream file; diff --git a/container_window.h b/container_window.h index 08918a8..b1c993c 100644 --- a/container_window.h +++ b/container_window.h @@ -16,6 +16,12 @@ class container_window: public Gtk::Window { public: + /** + * @brief container_window + * Windos that contains all views and controlers + * @param con Conexion used in the aplication + * @param app App that contains the gtk loop + */ container_window(conexion *con, Glib::RefPtr< Gtk::Application > app); private: Glib::RefPtr< Gtk::Application > app; diff --git a/controller_info.h b/controller_info.h index e7cfabc..af8fb04 100644 --- a/controller_info.h +++ b/controller_info.h @@ -7,13 +7,37 @@ class controller_info { public: + /** + * @brief controller_info + * View controler that expose package information + * @param view View to controle + * @param sesion Model to have the funcionality + */ controller_info(view_info *view, session_manager *sesion); private: view_info *view; session_manager *sesion; + /** + * @brief load_info + * Load the info in the table + */ void load_info(); + /** + * @brief get_first + * Get the firs string until the special character ":" + * @param info String to divide, the string have substract the string returned, and the first ":" + * @return The string substracted + */ std::string get_first(std::string &info); + /** + * @brief on_button_clicked + * Button function + */ void on_button_clicked(); + /** + * @brief add_controlers + * Add controlers to the bottons + */ void add_controlers(); }; diff --git a/controller_install.h b/controller_install.h index 8df626e..9a7c098 100644 --- a/controller_install.h +++ b/controller_install.h @@ -6,11 +6,25 @@ class controller_install { public: - controller_install(view_install*, session_manager*); + /** + * @brief controller_install + * View controler that send a name package to build + * @param view View to controle + * @param sesion Model to have the funcionality + */ + controller_install(view_install* view, session_manager* sesion); private: view_install *vis; session_manager *sesi; + /** + * @brief add_controlers + * Add controlers to the bottons + */ void add_controlers(); + /** + * @brief on_button_clicked + * Button function + */ void on_button_clicked(); }; diff --git a/controller_user_info.h b/controller_user_info.h index 36665a6..807da23 100644 --- a/controller_user_info.h +++ b/controller_user_info.h @@ -7,15 +7,44 @@ class controller_user_info { public: + /** + * @brief controller_user_info + * Controller that expose users info + * @param view View to controle + * @param session Model that have funcionality + * @param container Container of the aplication + */ controller_user_info(view_user_info *view, session_manager *session, Gtk::Window *container); private: view_user_info *view; session_manager *sesion; Gtk::Window *container; + /** + * @brief load_info + * Load the info in the table + */ void load_info(); + /** + * @brief add_controlers + * Add controlers to the bottons + */ void add_controlers(); + /** + * @brief on_button_clicked_add + * Button add function + */ void on_button_clicked_add(); + /** + * @brief on_button_clicked_remove + * button remove function + */ void on_button_clicked_remove(); + /** + * @brief get_first + * Get the firs string until the special character ":" + * @param info String to divide, the string have substract the string returned, and the first ":" + * @return The string substracted + */ std::string get_first(std::string &info); }; diff --git a/dialog_add_user.h b/dialog_add_user.h index 5c0a9a4..054f319 100644 --- a/dialog_add_user.h +++ b/dialog_add_user.h @@ -12,6 +12,12 @@ class dialog_add_user : public Gtk::Dialog { public: + /** + * @brief dialog_add_user + * Dialog to add users + * @param win Window to stop + * @param sesion Model to implement te funcionality + */ dialog_add_user(Gtk::Window *win, session_manager *sesion); private: session_manager *sesion; @@ -29,8 +35,15 @@ private: Gtk::CheckButton c_admin; Gtk::Button b_add; - + /** + * @brief on_button_clicked + * Button function + */ void on_button_clicked(); + /** + * @brief add_elements + * Add controlers to the bottons + */ void add_elements(); }; diff --git a/read_uses.h b/read_uses.h index 68ff653..84819da 100644 --- a/read_uses.h +++ b/read_uses.h @@ -7,8 +7,23 @@ class read_uses { public: + /** + * @brief read_uses + * Object that read configuration for a package + * @param name Name from a package + */ read_uses(std::string name); + /** + * @brief get_uses + * Get the content of a config file + * @return Content of a config file + */ std::string* get_uses(); + /** + * @brief exist_file + * Say if a package have config file + * @return True if package exists, false if not + */ bool exist_file(); private: std::ifstream file; diff --git a/session_manager.h b/session_manager.h index 6d82853..ed9a6bb 100644 --- a/session_manager.h +++ b/session_manager.h @@ -9,16 +9,71 @@ class session_manager { public: + /** + * @brief session_manager + * Object that manage the session, and gide on it + * @param con Conexion of the session + */ session_manager(conexion* con); - conexion* con; + /** + * @brief loggin + * Loggin function + * @param username Username to try to start session + * @param passwd Password to the user + * @return True if the username have these password, false if not or the user not exists + */ bool loggin(std::string username, std::string passwd); + /** + * @brief admin + * Get user privileges + * @return true if the admin can manage other users, false if not + */ bool admin(); + /** + * @brief install_command + * Send name of the package to build + * @param package Name of the package + * @return positive if it is build well, or negative if not + */ int install_command(std::string package); + /** + * @brief remove_command + * Send name of the package to remove + * @param package Name of the package + * @return positive if it is removed well, or negative if not + */ int remove_command(std::string package); + /** + * @brief get_packages_info + * Get all packages information + * @return List of strings that contains all package information. + * Every package have the information separated with the sepacial character ":" + */ std::list get_packages_info(); + /** + * @brief get_users_info + * Get all users username and privileges + * @return List of strings that contains all users information. + * Every users have the username first, and after separated with a ":" + * a t or a f, t if they have privileges or f if not + */ std::list get_users_info(); + /** + * @brief create_user + * Create a new user + * @param username Username for a new user + * @param password Password for a new user + * @param admin Privileges of a new user + */ void create_user(std::string username, std::string password, bool admin); + /** + * @brief remove_user + * Remove a created user + * @param username Name of these + */ void remove_user(std::string username); +private: + conexion* con; }; #endif // SESSION_MANAGER_H diff --git a/view_info.h b/view_info.h index cc6f140..c74048b 100644 --- a/view_info.h +++ b/view_info.h @@ -9,6 +9,10 @@ class view_info: public Gtk::Box { public: + /** + * @brief view_info + * View to show all package information + */ view_info(); Gtk::TreeView tree; class ModelColumns : public Gtk::TreeModel::ColumnRecord @@ -26,6 +30,10 @@ public: Glib::RefPtr m_refTreeModel; Gtk::ButtonBox b_box; Gtk::Button b_remove; + /** + * @brief restart_table + * Rescan all packages information + */ void restart_table(); }; diff --git a/view_install.h b/view_install.h index 37e49c3..da80826 100644 --- a/view_install.h +++ b/view_install.h @@ -9,6 +9,10 @@ class view_install : public Gtk::Box { public: + /** + * @brief view_install + * View to send name package to compile it + */ view_install(); Gtk::Button m_button; Gtk::Box m_VBox; diff --git a/view_loggin.h b/view_loggin.h index 808ad7a..0810a17 100644 --- a/view_loggin.h +++ b/view_loggin.h @@ -11,6 +11,11 @@ class view_loggin : public Gtk::Window { public: + /** + * @brief view_loggin + * View that permit show a loggig, include a minimal controler + * @param sesi Model that implements the funcionality + */ view_loggin(session_manager *sesi); session_manager *sesi; @@ -25,6 +30,10 @@ public: Gtk::Button button; Gtk::Box box; + /** + * @brief on_button_clicked + * Function of a button + */ void on_button_clicked(); bool login; diff --git a/view_user_info.h b/view_user_info.h index c08e6ae..62f43e4 100644 --- a/view_user_info.h +++ b/view_user_info.h @@ -9,6 +9,10 @@ class view_user_info: public Gtk::Box { public: + /** + * @brief view_user_info + * View to show all users information + */ view_user_info(); Gtk::TreeView tree; class ModelColumns : public Gtk::TreeModel::ColumnRecord @@ -26,7 +30,10 @@ public: Gtk::ButtonBox b_box; Gtk::Button b_add_user; Gtk::Button b_dell_user; - + /** + * @brief restart_table + * Rescan all users information + */ void restart_table(); };