Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convenience functions #1825

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

darbyjohnston
Copy link
Contributor

Summarize your change.

Add a few convenience functions:

  • Add a TimeRange constructor that takes three doubles; the start time, duration, and rate. This allows you to construct a TimeRange like: TimeRange(0.0, 48.0, 24.0), which is a bit more convenient than: TimeRange(RationalTime(0.0, 24.0), RationalTime(48.0, 24.0)).
  • Add RationalTime::is_valid_time() to complement RationalTime::is_invalid_time(). This can be a bit easier to read: if (time.is_valid_time()), instead of: if (!time.is_invalid_time()).
  • Add TimeRange::is_invalid_range() and TimeRange::is_valid_range() to match RationalTime.

Small fix:

  • Remove explicit from TimeRange constructors. The explicit keyword only needs to be used with constructors that take a single argument.

Signed-off-by: Darby Johnston <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.80%. Comparing base (c0e97b0) to head (235d812).
Report is 35 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1825      +/-   ##
==========================================
+ Coverage   84.11%   84.80%   +0.68%     
==========================================
  Files         198      176      -22     
  Lines       22241    12742    -9499     
  Branches     4687     1181    -3506     
==========================================
- Hits        18709    10806    -7903     
+ Misses       2610     1758     -852     
+ Partials      922      178     -744     
Flag Coverage Δ
py-unittests 84.80% <100.00%> (+0.68%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/opentime/rationalTime.h 95.83% <100.00%> (+1.15%) ⬆️
src/opentime/timeRange.h 98.30% <100.00%> (-0.79%) ⬇️
...lineio/opentime-bindings/opentime_rationalTime.cpp 94.87% <100.00%> (+0.27%) ⬆️
...imelineio/opentime-bindings/opentime_timeRange.cpp 98.07% <100.00%> (-1.93%) ⬇️
tests/test_opentime.py 99.75% <100.00%> (+<0.01%) ⬆️

... and 124 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4183d22...235d812. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants