xo-unit: ++ xquantity docs

This commit is contained in:
Roland Conybeare 2024-05-24 10:17:56 -04:00
commit d36829994f
7 changed files with 45 additions and 5 deletions

View file

@ -5,7 +5,7 @@ xo_docdir_doxygen_config()
xo_docdir_sphinx_config(
index.rst examples.rst glossary.rst install.rst implementation.rst
quantity-reference.rst quantity-class.rst quantity-factoryfunctions.rst quantity-unitvars.rst quantity-source-code.rst
xquantity-reference.rst xquantity-class.rst
xquantity-reference.rst xquantity-class.rst xquantity-source-code.rst
scaled-unit-reference.rst scaled-unit-class.rst scaled-unit-constants.rst
natural-unit-class.rst
bpu-class.rst

View file

@ -127,8 +127,8 @@ Amount-preserving conversion to quantities with different units and/or represent
.. doxygengroup:: quantity-unit-conversion
Arithmetic Operators
--------------------
Arithmetic
----------
.. doxygengroup:: quantity-operators

View file

@ -3,9 +3,9 @@
Quantity Source Code
====================
github: `quantity.hpp @github.com`_
github: `quantity.hpp @github`_
.. _`quantity.hpp @github.com`: https://github.com/rconybea/xo-unit/blob/main/include/xo/unit/quantity.hpp
.. _`quantity.hpp @github`: https://github.com/rconybea/xo-unit/blob/main/include/xo/unit/quantity.hpp
.. literalinclude:: ../include/xo/unit/quantity.hpp
:language: c++

View file

@ -69,7 +69,19 @@ Access Methods
.. doxygengroup:: xquantity-access-methods
Constants
---------
.. doxygengroup:: xquantity-constants
General Methods
---------------
.. doxygengroup:: xquantity-methods
Arithmetic
----------
Support methods for arithmetic operations
.. doxygengroup:: xquantity-arithmetic-support

View file

@ -26,3 +26,4 @@ Xquantity Reference
:maxdepth: 2
xquantity-class
xquantity-source-code

View file

@ -0,0 +1,11 @@
.. _xquantity-source-code:
Xquantity Source Code
=====================
github: `xquantity.hpp @github`_
.. _`xquantity.hpp @github`: https://github.com/rconybea/xo-unit/blob/main/include/xo/unit/xquantity.hpp
.. literalinclude:: ../include/xo/unit/xquantity.hpp
:language: c++

View file

@ -86,8 +86,16 @@ namespace xo {
///@}
/** defgroup xqautnity-constants static xquantity constants **/
///@{
/** false since unit information may be unknown at compile time.
* Coordinates with quantity::always_constexpr_unit
**/
static constexpr bool always_constexpr_unit = false;
///@}
/** @defgroup xquantity-access-methods xquantity access methods **/
///@{
@ -107,6 +115,9 @@ namespace xo {
/** @defgroup xquantity-methods xquantity methods **/
///@{
/** @defgroup xquantity-arithmetic-support **/
///@{
/** create unit quantity with same unit as @c this **/
constexpr xquantity unit_qty() const { return xquantity(1, unit_); }
@ -116,6 +127,11 @@ namespace xo {
/** create quantity representing reciprocal of @c this **/
constexpr xquantity reciprocal() const { return xquantity(1.0 / scale_, unit_.reciprocal()); }
///@}
/** @defgroup xquantity-methods xquantity methods **/
///@{
/** create quantity representing the same value, but in units of @p unit2 **/
constexpr
auto rescale(const natural_unit<Int> & unit2) const {