QuasarAppLib/helpdata.h

81 lines
2.5 KiB
C
Raw Normal View History

2020-05-23 02:13:32 +03:00
/*
2023-12-31 09:23:23 +01:00
* Copyright (C) 2018-2024 QuasarApp.
2020-05-23 02:13:32 +03:00
* Distributed under the lgplv3 software license, see the accompanying
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
2020-02-18 22:28:17 +03:00
#ifndef HELPDATA_H
#define HELPDATA_H
#include <QMap>
#include "quasarapp_global.h"
2020-02-18 22:28:17 +03:00
namespace QuasarAppUtils{
/**
* @brief Help namespace contains functions for printing help in to console. All Print fucntions automaticly calc width of the console and aligns the text to fit the window.
*/
2020-02-18 22:28:17 +03:00
namespace Help {
2020-02-22 12:41:14 +03:00
/**
2021-04-26 12:01:08 +03:00
* @brief Options this is list of **key-descriptions** pairs of help.
* The **key** is name of the available argument and **description** is description of the available argument.
*
2021-04-26 12:01:08 +03:00
* **Example**:
*
* @code{cpp}
* Options myOptionsList = {{"argument1", "This is test argumetn1 of my application."},
2021-07-26 13:17:06 +03:00
* {"argument2", "This is test argumetn2 of my application."}};
*
* @endcode
2020-02-22 12:41:14 +03:00
*/
2020-08-14 10:14:38 +03:00
typedef QMultiMap<QString, QString> Options;
2020-02-22 12:41:14 +03:00
/**
* @brief Section This is list of the help Sections. The one section it is Title of the section and Help::Options list.
*
2021-04-26 12:01:08 +03:00
* **Example:**
* @code{cpp}
* Options myOptionsList = {{"argument1", "This is test argumetn1 of my application."},
2021-07-26 13:17:06 +03:00
* {"argument2", "This is test argumetn2 of my application."}};
* Section mySections = {{"This Is main section of the help", myOptionsList}};
* QuasarAppUtils::Help::print(mySections);
* @endcode
2020-02-22 12:41:14 +03:00
*/
typedef QMultiMap<QString, Options> Section;
/**
* @brief Charters is wraper of the Section type.
* @warning This type is depricated. Use the Help:Section type.
*/
typedef Section Charters;
2020-02-18 22:28:17 +03:00
/**
* @brief width This method return current width of the cosole window.
* @return width in pxels of the cosole window.
2020-02-18 22:28:17 +03:00
*/
int width();
2020-02-18 22:28:17 +03:00
/**
* @brief print This method print a one options list.
* @param oprionsList This is options list.
2020-02-18 22:28:17 +03:00
*/
void QUASARAPPSHARED_EXPORT print(const Options& oprionsList);
2020-02-18 22:28:17 +03:00
/**
* @brief print This method print all sections of the help.
* @note This is main method for printing helps.
* @param help This is sections list.
2020-02-18 22:28:17 +03:00
*/
void QUASARAPPSHARED_EXPORT print(const Section& help);
2020-02-18 22:28:17 +03:00
/**
* @brief setLineLength sets new length of the help line (width of the console window). If you set this into -1 then the window width will be selected automatically.
* @param newLength This is a new size of the console window.
2020-02-18 22:28:17 +03:00
*/
void QUASARAPPSHARED_EXPORT setLineLength(int newLength);
2020-02-18 22:28:17 +03:00
}
}
#endif // HELPDATA_H