From 75ad418c741931a69aea2303ccbd644e526c64ee Mon Sep 17 00:00:00 2001 From: heinezen Date: Sat, 29 Jul 2023 17:07:21 +0200 Subject: [PATCH] curve: Align name of 'sync' for curve and keyframe container. --- doc/code/curves.md | 7 +++---- libopenage/curve/base_curve.h | 4 ++-- libopenage/curve/keyframe_container.h | 20 ++++++++++---------- libopenage/curve/tests/curve_types.cpp | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/code/curves.md b/doc/code/curves.md index 3233bafb42..d345fdb94f 100644 --- a/doc/code/curves.md +++ b/doc/code/curves.md @@ -131,10 +131,9 @@ for specific curve types. **Copy** -| Method | Description | -| ---------------------- | ----------------------------------------------------------------------------------------- | -| `sync(Curve, t)` | copy keyframes from `Curve`, starting at time `t`; delete all keyframes after time `t` | -| `sync_after(Curve, t)` | copy keyframes from `Curve`, starting after time `t`; delete all keyframes after time `t` | +| Method | Description | +| ---------------- | -------------------------------------------------------------------------------------- | +| `sync(Curve, t)` | copy keyframes from `Curve`, starting at time `t`; delete all keyframes after time `t` | #### Discrete diff --git a/libopenage/curve/base_curve.h b/libopenage/curve/base_curve.h index 77be819139..8c56586637 100644 --- a/libopenage/curve/base_curve.h +++ b/libopenage/curve/base_curve.h @@ -283,7 +283,7 @@ template void BaseCurve::sync(const BaseCurve &other, const time::time_t &start) { // Copy keyframes between containers for t >= start - this->last_element = this->container.sync_after(other.container, start); + this->last_element = this->container.sync(other.container, start); // Check if this->get() returns the same value as other->get() for t = start // If not, insert a new keyframe at start @@ -302,7 +302,7 @@ void BaseCurve::sync(const BaseCurve &other, const std::function &converter, const time::time_t &start) { // Copy keyframes between containers for t >= start - this->last_element = this->container.sync_after(other.get_container(), converter, start); + this->last_element = this->container.sync(other.get_container(), converter, start); // Check if this->get() returns the same value as other->get() for t = start // If not, insert a new keyframe at start diff --git a/libopenage/curve/keyframe_container.h b/libopenage/curve/keyframe_container.h index c61ac5105a..1d7079498b 100644 --- a/libopenage/curve/keyframe_container.h +++ b/libopenage/curve/keyframe_container.h @@ -280,8 +280,8 @@ class KeyframeContainer { * Using the default value replaces ALL keyframes of \p this with * the keyframes of \p other. */ - iterator sync_after(const KeyframeContainer &other, - const time::time_t &start = std::numeric_limits::min()); + iterator sync(const KeyframeContainer &other, + const time::time_t &start = std::numeric_limits::min()); /** * Copy keyframes from another container (with a different element type) to this container. @@ -296,9 +296,9 @@ class KeyframeContainer { * the keyframes of \p other. */ template - iterator sync_after(const KeyframeContainer &other, - const std::function &converter, - const time::time_t &start = std::numeric_limits::min()); + iterator sync(const KeyframeContainer &other, + const std::function &converter, + const time::time_t &start = std::numeric_limits::min()); /** * Debugging method to be used from gdb to understand bugs better. @@ -512,8 +512,8 @@ KeyframeContainer::erase(KeyframeContainer::iterator e) { template typename KeyframeContainer::iterator -KeyframeContainer::sync_after(const KeyframeContainer &other, - const time::time_t &start) { +KeyframeContainer::sync(const KeyframeContainer &other, + const time::time_t &start) { // Delete elements after start time iterator at = this->last_before(start, this->end()); at = this->erase_after(at); @@ -536,9 +536,9 @@ KeyframeContainer::sync_after(const KeyframeContainer &other, template template typename KeyframeContainer::iterator -KeyframeContainer::sync_after(const KeyframeContainer &other, - const std::function &converter, - const time::time_t &start) { +KeyframeContainer::sync(const KeyframeContainer &other, + const std::function &converter, + const time::time_t &start) { // Delete elements after start time iterator at = this->last_before(start, this->end()); at = this->erase_after(at); diff --git a/libopenage/curve/tests/curve_types.cpp b/libopenage/curve/tests/curve_types.cpp index ab75fb5408..cab8473bc3 100644 --- a/libopenage/curve/tests/curve_types.cpp +++ b/libopenage/curve/tests/curve_types.cpp @@ -168,7 +168,7 @@ void curve_types() { // TODO: test c.insert_overwrite and c.insert_after KeyframeContainer c2; - c2.sync_after(c, 1); + c2.sync(c, 1); // now c2 should be [-inf: 0, 1: 15, 2: 20, 3: 25] TESTEQUALS(c2.last(0)->value, 0); TESTEQUALS(c2.last(1)->value, 15);