Skip to content

Commit

Permalink
chore: update fmt and spdlog
Browse files Browse the repository at this point in the history
  • Loading branch information
Latios96 committed Mar 9, 2023
1 parent 033d015 commit de21c22
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 7 deletions.
4 changes: 2 additions & 2 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[requires]
fmt/8.1.1
spdlog/1.10.0
fmt/9.1.0
spdlog/1.11.0
catch2/2.13.7
fakeit/2.0.9
cli11/2.3.2
Expand Down
3 changes: 3 additions & 0 deletions src/crayg/src/basics/BoundingBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "Ray.h"
#include "Vector3f.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -32,4 +33,6 @@ class BoundingBox {

}

template <> struct fmt::formatter<crayg::BoundingBox> : ostream_formatter {};

#endif // CRAYG_BOUNDINGBOX_H
4 changes: 4 additions & 0 deletions src/crayg/src/basics/Color.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef CRAYG_COLOR_H
#define CRAYG_COLOR_H

#include <fmt/ostream.h>
#include <ostream>
#include <tuple>

Expand Down Expand Up @@ -55,4 +56,7 @@ class Color {
};

} // namespace crayg

template <> struct fmt::formatter<crayg::Color> : ostream_formatter {};

#endif // CRAYG_COLOR_H
5 changes: 5 additions & 0 deletions src/crayg/src/basics/Gradient.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Color.h"
#include "utils/ToStringHelper.h"
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <ostream>
#include <vector>

Expand Down Expand Up @@ -85,4 +86,8 @@ template <typename T> T Gradient<T>::lerp(const T &firstValue, const T &secondVa

} // crayg

template <typename T> struct fmt::formatter<crayg::Gradient<T>> : ostream_formatter {};

template <typename T> struct fmt::formatter<crayg::GradientStop<T>> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_BASICS_GRADIENT_H_
4 changes: 4 additions & 0 deletions src/crayg/src/basics/Matrix4x4f.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CRAYG_SRC_CRAYG_SRC_BASICS_MATRIX4X4F_H_

#include "Vector3f.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -32,4 +33,7 @@ class Matrix4x4f {
};

}

template <> struct fmt::formatter<crayg::Matrix4x4f> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_BASICS_MATRIX4X4F_H_
3 changes: 3 additions & 0 deletions src/crayg/src/basics/OrthonormalBasis.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "Vector3f.h"
#include "utils/ToStringHelper.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -30,4 +31,6 @@ class OrthonormalBasis {

} // crayg

template <> struct fmt::formatter<crayg::OrthonormalBasis> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_BASICS_ORTHONORMALBASIS_H_
3 changes: 3 additions & 0 deletions src/crayg/src/basics/Ray.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CRAYG_RAY_H

#include "Vector3f.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -32,4 +33,6 @@ struct Ray {

}

template <> struct fmt::formatter<crayg::Ray> : ostream_formatter {};

#endif // CRAYG_RAY_H
3 changes: 3 additions & 0 deletions src/crayg/src/basics/Resolution.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef CRAYG_SRC_CRAYG_SRC_BASICS_RESOLUTION_H_
#define CRAYG_SRC_CRAYG_SRC_BASICS_RESOLUTION_H_

#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand All @@ -27,4 +28,6 @@ struct Resolution {

}

template <> struct fmt::formatter<crayg::Resolution> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_BASICS_RESOLUTION_H_
3 changes: 3 additions & 0 deletions src/crayg/src/basics/Transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "Matrix4x4f.h"
#include "Ray.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -32,4 +33,6 @@ class Transform {

}

template <> struct fmt::formatter<crayg::Transform> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_BASICS_TRANSFORM_H_
3 changes: 3 additions & 0 deletions src/crayg/src/basics/Vector2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CRAYG_SRC_CRAYG_SRC_BASICS_VECTOR2_H_

#include "utils/ToStringHelper.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -53,4 +54,6 @@ typedef Vector2<int> Vector2i;

}

template <typename T> struct fmt::formatter<crayg::Vector2<T>> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_BASICS_VECTOR2_H_
4 changes: 4 additions & 0 deletions src/crayg/src/basics/Vector3f.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CRAYG_VECTOR3F_H

#include <cmath>
#include <fmt/ostream.h>
#include <limits>
#include <ostream>

Expand Down Expand Up @@ -49,4 +50,7 @@ class Vector3f {
};

}

template <> struct fmt::formatter<crayg::Vector3f> : ostream_formatter {};

#endif // CRAYG_VECTOR3F_H
3 changes: 3 additions & 0 deletions src/crayg/src/image/ImageBucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CRAYG_SRC_CRAYG_SRC_IMAGE_IMAGEBUCKET_H_

#include "basics/Vector2.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -32,4 +33,6 @@ template <> struct hash<crayg::ImageBucket> {
};
}

template <> struct fmt::formatter<crayg::ImageBucket> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_IMAGE_IMAGEBUCKET_H_
3 changes: 3 additions & 0 deletions src/crayg/src/image/PixelBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "basics/Color.h"
#include "basics/Resolution.h"
#include "basics/Vector2.h"
#include <fmt/ostream.h>
#include <memory>
#include <ostream>
#include <variant>
Expand Down Expand Up @@ -51,4 +52,6 @@ class PixelBuffer {

} // crayg

template <> struct fmt::formatter<crayg::PixelBuffer> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_IMAGE_PIXELBUFFER_H_
3 changes: 3 additions & 0 deletions src/crayg/src/integrators/IntegratorSettings.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef CRAYG_SRC_CRAYG_SRC_INTEGRATORS_INTEGRATORSETTINGS_H_
#define CRAYG_SRC_CRAYG_SRC_INTEGRATORS_INTEGRATORSETTINGS_H_
#include <fmt/ostream.h>
#include <ostream>
#include <unordered_map>
#include <variant>
Expand All @@ -22,4 +23,6 @@ class IntegratorSettings {

} // crayg

template <> struct fmt::formatter<crayg::IntegratorSettings> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_INTEGRATORS_INTEGRATORSETTINGS_H_
4 changes: 4 additions & 0 deletions src/crayg/src/scene/camera/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "scene/Transformable.h"
#include "spdlog/fmt/ostr.h"
#include "utils/ToStringHelper.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -51,4 +52,7 @@ class Camera : public Transformable {
};

}

template <> struct fmt::formatter<crayg::Camera> : ostream_formatter {};

#endif // CRAYG_CAMERA_H
3 changes: 3 additions & 0 deletions src/crayg/src/scene/lights/Light.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ class Light : public Transformable, public Imageable {
};

}

template <> struct fmt::formatter<crayg::Light::Radiance> : ostream_formatter {};

#endif // CRAYG_L
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CRAYG_SRC_CRAYG_SRC_BASICS_BARYCENTRICCOORDINATES_H_

#include "scene/primitives/trianglemesh/Triangle.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand All @@ -28,4 +29,6 @@ template <typename T> T BarycentricCoordinates::interpolateLinear(const T &value

} // crayg

template <> struct fmt::formatter<crayg::BarycentricCoordinates> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_BASICS_BARYCENTRICCOORDINATES_H_
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "TriangleMeshAbstractPrimVar.h"
#include "scene/primitives/trianglemesh/BarycentricCoordinates.h"
#include "utils/ToStringHelper.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -58,4 +59,6 @@ template <typename T> class TriangleMeshPerFacePrimVar : public TriangleMeshAbst
};
}

template <typename T> struct fmt::formatter<crayg::TriangleMeshPerFacePrimVar<T>> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_SCENE_TRIANGLEMESHPERFACEPRIMVAR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "TriangleMeshAbstractPrimVar.h"
#include "scene/primitives/trianglemesh/BarycentricCoordinates.h"
#include "utils/ToStringHelper.h"
#include <fmt/ostream.h>

namespace crayg {

Expand Down Expand Up @@ -41,7 +42,7 @@ template <typename T> class TriangleMeshPerPointPrimVar : public TriangleMeshAbs
}

template <typename OStream>
friend std::ostream &operator<<(std::ostream &os, const TriangleMeshPerPointPrimVar &var) {
friend std::ostream &operator<<(std::ostream &os, const TriangleMeshPerPointPrimVar<T> &var) {
os << ToStringHelper("TriangleMeshPerPointPrimVar").addMember("pointData", var.pointData).finish();
return os;
}
Expand All @@ -64,4 +65,6 @@ template <typename T> class TriangleMeshPerPointPrimVar : public TriangleMeshAbs

} // crayg

template <typename T> struct fmt::formatter<crayg::TriangleMeshPerPointPrimVar<T>> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_SCENE_TRIANGLEMESHPERPOINTPRIMVAR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "TriangleMeshAbstractPrimVar.h"
#include "scene/primitives/trianglemesh/BarycentricCoordinates.h"
#include "utils/ToStringHelper.h"
#include <fmt/ostream.h>
#include <ostream>

namespace crayg {
Expand Down Expand Up @@ -74,7 +75,7 @@ template <typename T> class TriangleMeshPerVertexPrimVar : public TriangleMeshAb
}

template <typename OStream>
friend std::ostream &operator<<(std::ostream &os, const TriangleMeshPerVertexPrimVar &var) {
friend std::ostream &operator<<(std::ostream &os, const TriangleMeshPerVertexPrimVar<T> &var) {
os << ToStringHelper("TriangleMeshPerVertexPrimVar").addMember("vertexData", var.vertexData).finish();
return os;
}
Expand All @@ -96,4 +97,8 @@ template <typename T> class TriangleMeshPerVertexPrimVar : public TriangleMeshAb
};
}

template <typename T> struct fmt::formatter<crayg::VertexData<T>> : ostream_formatter {};

template <typename T> struct fmt::formatter<crayg::TriangleMeshPerVertexPrimVar<T>> : ostream_formatter {};

#endif // CRAYG_SRC_CRAYG_SRC_SCENE_TRIANGLEMESHPERVERTEXPRIMVAR_H_
11 changes: 11 additions & 0 deletions src/crayg/src/sceneIO/usd/CraygUsdBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <fmt/format.h>
#include <pxr/base/tf/token.h>
#include <pxr/usd/sdf/path.h>
#include <pxr/usd/sdf/valueTypeName.h>

template <> struct fmt::formatter<pxr::TfToken> {
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) {
Expand All @@ -24,4 +25,14 @@ template <> struct fmt::formatter<pxr::SdfPath> {
};
};

template <> struct fmt::formatter<pxr::SdfValueTypeName> {
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) {
return ctx.begin();
}

template <typename FormatContext> auto format(pxr::SdfValueTypeName const &sdfValueTypeName, FormatContext &ctx) {
return fmt::format_to(ctx.out(), sdfValueTypeName.GetAsToken().GetString());
};
};

#endif // CRAYG_SRC_CRAYGUSD_SRC_CRAYGUSDBASE_H_
7 changes: 4 additions & 3 deletions src/crayg/src/utils/DtoUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
template <> struct fmt::formatter<std::vector<crayg::Name>> { \
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) { return ctx.begin(); } \
\
template <typename FormatContext> auto format(std::vector<crayg::Name> const &dtos, FormatContext &ctx) { \
template <typename FormatContext> \
auto format(std::vector<crayg::Name> const &dtos, FormatContext &ctx) const { \
return fmt::format_to(ctx.out(), "[{}]", fmt::join(dtos, ", ")); \
}; \
};
Expand All @@ -38,7 +39,7 @@
template <> struct fmt::formatter<crayg::Name> { \
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) { return ctx.begin(); } \
\
template <typename FormatContext> auto format(crayg::Name const &dto, FormatContext &ctx) { \
template <typename FormatContext> auto format(crayg::Name const &dto, FormatContext &ctx) const { \
return fmt::format_to(ctx.out(), "{}{{{}={},{}={}}}", #Name, #FirstName, dto.FirstName, #SecondName, \
dto.SecondName); \
}; \
Expand Down Expand Up @@ -72,7 +73,7 @@
template <> struct fmt::formatter<crayg::Name> { \
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) { return ctx.begin(); } \
\
template <typename FormatContext> auto format(crayg::Name const &dto, FormatContext &ctx) { \
template <typename FormatContext> auto format(crayg::Name const &dto, FormatContext &ctx) const { \
return fmt::format_to(ctx.out(), "{}{{{}={},{}={},{}={}}}", #Name, #FirstName, dto.FirstName, #SecondName, \
dto.SecondName, #ThirdName, dto.ThirdName); \
}; \
Expand Down
2 changes: 2 additions & 0 deletions src/standalonegui/widgets/PanAndZoomArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ class PanAndZoomArea : public QScrollArea {

} // crayg

template <> struct fmt::formatter<crayg::ZoomFactor> : ostream_formatter {};

#endif // CRAYG_SRC_STANDALONEGUI_PANANDZOOMAREA_H_

0 comments on commit de21c22

Please sign in to comment.