Skip to content

Cout#3

Merged
VPRamon merged 11 commits intomainfrom
cout
Feb 24, 2026
Merged

Cout#3
VPRamon merged 11 commits intomainfrom
cout

Conversation

@VPRamon
Copy link
Member

@VPRamon VPRamon commented Feb 24, 2026

This pull request introduces a consistent mechanism for associating unit symbols with quantity types and improves the usability of the library by enabling formatted output of quantities with their units. The main changes include adding a default symbol() method to the UnitTraits template, specializing it for many units, and implementing a stream insertion operator for quantities. Additionally, SPDX license headers have been added to several files.

Unit Symbol Support and Output Formatting

  • Added a default symbol() method to the UnitTraits template in ffi_core.hpp, allowing unit traits to provide a string symbol for each unit. This method is specialized for a wide range of units in the length.hpp, mass.hpp, and angular.hpp files, enabling each unit to return its appropriate symbol (e.g., "m" for meters, "kg" for kilograms). [1] [2] [3] [4]
  • Implemented a stream insertion operator (operator<<) for the Quantity class in ffi_core.hpp. This allows quantities to be printed directly to output streams along with their value and unit symbol, improving debuggability and user experience.

Licensing and Documentation

  • Added SPDX license identifiers and copyright statements to length.hpp, mass.hpp, and power.hpp for legal clarity and compliance. [1] [2] [3]

Other Minor Improvements

  • Included <ostream> in ffi_core.hpp to support the new stream insertion operator.
  • Minor formatting and line wrapping improvements in length.hpp for readability.

These changes enhance the clarity, maintainability, and usability of the codebase, especially for displaying and working with quantities and their units.

VPRamon added 2 commits February 24, 2026 01:48
…units

- Enhanced UnitTraits for mass units (e.g., Yoctogram, Kilogram) to include symbol definitions.
- Added SPDX license header to mass.hpp, power.hpp, time.hpp, and velocity.hpp files.
- Updated UnitTraits for power units (e.g., Yoctowatt, Kilowatt) to include symbol definitions.
- Enhanced UnitTraits for time units (e.g., Attosecond, Minute) to include symbol definitions.
- Introduced support for compound units in velocity, including common velocity types with appropriate symbols.
@VPRamon VPRamon self-assigned this Feb 24, 2026
VPRamon added 9 commits February 24, 2026 02:07
…ialization support

- Added SPDX license and copyright information to all relevant files.
- Improved documentation in `qtty.hpp` and `serialization.hpp` for better clarity on usage and functionality.
- Reordered includes in `qtty.hpp` and `serialization.hpp` for consistency.
- Simplified inline functions in `qtty.hpp` and `serialization.hpp` for better readability.
- Enhanced JSON serialization and deserialization functions to ensure robust error handling.
- Added unit tests for serialization in `test_serialization.cpp` to validate JSON round-trip conversions.
- Updated tests across various dimensions (length, mass, time, etc.) for consistency in formatting and readability.
- Ensured all test cases utilize modern C++ practices for better maintainability.
- Created CMakeDoxyfile.in for Doxygen configuration generation.
- Added Doxyfile.qtty_cpp for project-specific Doxygen settings.
- Updated main.rs to allow for an optional 6th field in CSV parsing.
- Enhanced ffi_core.hpp with compound unit type traits and conversion logic.
- Modified literals.hpp to include angular units and clean up operator overloads.
- Expanded serialization.hpp to support JSON serialization/deserialization for derived quantities.
- Updated length.hpp and velocity.hpp to improve compound unit handling and conversions.
- Added comprehensive tests for derived quantities, including conversion and arithmetic operations.
@VPRamon VPRamon merged commit 8855aa5 into main Feb 24, 2026
6 checks passed
@VPRamon VPRamon deleted the cout branch February 24, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant