<commit_before>#pragma once

#include <cmath>
#include <limits>

#include "float.hh"

// ----------------------------------------------------------------------

namespace _acmacs_base_internal
{
    template <char Tag> class SizeScale
    {
     public:
        inline SizeScale() : mValue(0) {}
        inline explicit SizeScale(double aValue) : mValue(aValue) {}
          // inline SizeScale(const SizeScale& a) = default;
        inline bool operator==(SizeScale<Tag> a) const { return float_equal(mValue, a.mValue); }
        inline bool operator<(SizeScale<Tag> a) const { return mValue < a.mValue; }
        inline SizeScale& operator = (double aValue) { mValue = aValue; return *this; }
        inline double value() const { return mValue; }
        inline SizeScale operator / (double a) const { return SizeScale{mValue / a}; }
        inline SizeScale operator * (double a) const { return SizeScale{mValue * a}; }
        inline SizeScale& operator *= (double a) { mValue *= a; return *this; }
        inline SizeScale operator - () const { return SizeScale{- mValue}; }
        inline SizeScale operator - (SizeScale<Tag> a) const { return SizeScale{mValue - a.mValue}; }
        inline SizeScale operator + (SizeScale<Tag> a) const { return SizeScale{mValue + a.mValue}; }
        inline SizeScale& operator += (SizeScale<Tag> a) { mValue += a.mValue; return *this; }
        inline bool empty() const { return std::isnan(mValue); }
        static SizeScale make_empty() { return SizeScale(std::numeric_limits<double>::quiet_NaN()); }

     private:
        double mValue;
    };
}

using Pixels = _acmacs_base_internal::SizeScale<'P'>; // size in pixels, indepenent from the surface internal coordinate system
using Scaled = _acmacs_base_internal::SizeScale<'S'>; // size in the surface internal coordinate system

// ----------------------------------------------------------------------

using Aspect = _acmacs_base_internal::SizeScale<'A'>;
using Rotation = _acmacs_base_internal::SizeScale<'R'>;

#include "acmacs-base/global-constructors-push.hh"

const Rotation NoRotation{0.0};
const Aspect AspectNormal{1.0};

#include "acmacs-base/diagnostics-pop.hh"

inline Rotation RotationDegrees(double aAngle)
{
    return Rotation{aAngle * M_PI / 180.0};
}

// ----------------------------------------------------------------------
/// Local Variables:
/// eval: (if (fboundp 'eu-rename-buffer) (eu-rename-buffer))
/// End:
<commit_msg><<(ostream, Pixels, Scaled, Aspect, Rotation)<commit_after>#pragma once

#include <cmath>
#include <limits>

#include "float.hh"

// ----------------------------------------------------------------------

namespace _acmacs_base_internal
{
    template <char Tag> class SizeScale
    {
     public:
        inline SizeScale() : mValue(0) {}
        inline explicit SizeScale(double aValue) : mValue(aValue) {}
          // inline SizeScale(const SizeScale& a) = default;
        inline bool operator==(SizeScale<Tag> a) const { return float_equal(mValue, a.mValue); }
        inline bool operator<(SizeScale<Tag> a) const { return mValue < a.mValue; }
        inline SizeScale& operator = (double aValue) { mValue = aValue; return *this; }
        inline double value() const { return mValue; }
        inline SizeScale operator / (double a) const { return SizeScale{mValue / a}; }
        inline SizeScale operator * (double a) const { return SizeScale{mValue * a}; }
        inline SizeScale& operator *= (double a) { mValue *= a; return *this; }
        inline SizeScale operator - () const { return SizeScale{- mValue}; }
        inline SizeScale operator - (SizeScale<Tag> a) const { return SizeScale{mValue - a.mValue}; }
        inline SizeScale operator + (SizeScale<Tag> a) const { return SizeScale{mValue + a.mValue}; }
        inline SizeScale& operator += (SizeScale<Tag> a) { mValue += a.mValue; return *this; }
        inline bool empty() const { return std::isnan(mValue); }
        static SizeScale make_empty() { return SizeScale(std::numeric_limits<double>::quiet_NaN()); }

     private:
        double mValue;
    };
}

using Pixels = _acmacs_base_internal::SizeScale<'P'>; // size in pixels, indepenent from the surface internal coordinate system
using Scaled = _acmacs_base_internal::SizeScale<'S'>; // size in the surface internal coordinate system

// ----------------------------------------------------------------------

using Aspect = _acmacs_base_internal::SizeScale<'A'>;
using Rotation = _acmacs_base_internal::SizeScale<'R'>;

#include "acmacs-base/global-constructors-push.hh"

const Rotation NoRotation{0.0};
const Aspect AspectNormal{1.0};

#include "acmacs-base/diagnostics-pop.hh"

inline Rotation RotationDegrees(double aAngle)
{
    return Rotation{aAngle * M_PI / 180.0};
}

// ----------------------------------------------------------------------

inline std::ostream& operator<<(std::ostream& out, Pixels aPixels) { return out << "Pixels{" << aPixels.value() << '}'; }
inline std::ostream& operator<<(std::ostream& out, Scaled aScaled) { return out << "Scaled{" << aScaled.value() << '}'; }
inline std::ostream& operator<<(std::ostream& out, Aspect aAspect) { if (aAspect == AspectNormal) return out << "AspectNormal"; else return out << "Aspect{" << aAspect.value() << '}'; }
inline std::ostream& operator<<(std::ostream& out, Rotation aRotation) { if (aRotation == NoRotation) return out << "NoRotation"; else return out << "Rotation{" << aRotation.value() << '}'; }

// ----------------------------------------------------------------------
/// Local Variables:
/// eval: (if (fboundp 'eu-rename-buffer) (eu-rename-buffer))
/// End:

{'fraction_non_alphanumeric': 0.21365090650551014, 'fraction_numerical': 0.003199431212228937, 'mean_word_length': 2.5955271565495206, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6369007', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1609, 'n_words': 438}