add doxygen via opencode
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
/*! \file piunits_value.h
|
||||
* \ingroup Core
|
||||
* \~\brief
|
||||
* \~english Unit value
|
||||
* \~russian Единица измерения
|
||||
*/
|
||||
//! \~english Unit value class
|
||||
//! \~russian Класс значения единицы
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Unit value
|
||||
@@ -31,27 +27,67 @@
|
||||
|
||||
namespace PIUnits {
|
||||
|
||||
//! \~english Unit value representation
|
||||
//! \~russian Представление значения единицы
|
||||
class PIP_EXPORT Value {
|
||||
public:
|
||||
//! \~english Constructor
|
||||
//! \~russian Конструктор
|
||||
//! \param v Value
|
||||
//! \param t Unit type
|
||||
Value(double v = 0., int t = Class::Invalid);
|
||||
|
||||
//! \~english Check if value is valid
|
||||
//! \~russian Проверить значение на корректность
|
||||
//! \return true if valid
|
||||
bool isValid() const { return m_type >= 0 && m_class; }
|
||||
|
||||
//! \~english Check if value is not valid
|
||||
//! \~russian Проверить значение на некорректность
|
||||
//! \return true if not valid
|
||||
bool isNotValid() const { return m_type < 0 || !m_class; }
|
||||
|
||||
//! \~english Get raw value
|
||||
//! \~russian Получить сырое значение
|
||||
double value() const { return m_value; }
|
||||
|
||||
//! \~english Convert to string
|
||||
//! \~russian Преобразовать в строку
|
||||
//! \param format Format specifier
|
||||
//! \param prec Precision
|
||||
//! \return String representation
|
||||
PIString toString(char format = 'g', int prec = 5) const;
|
||||
|
||||
//! \~english Convert to different unit type
|
||||
//! \~russian Преобразовать в другой тип единицы
|
||||
//! \param type_to Target unit type
|
||||
//! \return true if successful
|
||||
bool convert(int type_to);
|
||||
|
||||
//! \~english Get converted value
|
||||
//! \~russian Получить преобразованное значение
|
||||
//! \param type_to Target unit type
|
||||
//! \return Converted value
|
||||
Value converted(int type_to);
|
||||
|
||||
private:
|
||||
double m_value = 0.;
|
||||
int m_type = -1;
|
||||
Class::Internal::ClassBase * m_class = nullptr;
|
||||
//! \~english Numeric value
|
||||
//! \~russian Числовое значение
|
||||
double m_value;
|
||||
|
||||
//! \~english Unit type
|
||||
//! \~russian Тип единицы
|
||||
int m_type;
|
||||
|
||||
//! \~english Class pointer
|
||||
//! \~russian Указатель на класс
|
||||
Class::Internal::ClassBase * m_class;
|
||||
};
|
||||
|
||||
}; // namespace PIUnits
|
||||
|
||||
//! \~english Output stream operator
|
||||
//! \~russian Оператор вывода в поток
|
||||
inline PICout operator<<(PICout s, const PIUnits::Value & v) {
|
||||
s << v.toString();
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user