LineBudgets.h header

#include <ew/app/branching/LineBudgets.h>

Namespace ew::app::branching

Functions

bool ew::app::branching::overCharacterBudget(const QString &text, const ew::core::branching::LineBudget &budget)

Whether text is over budget's character limit. False when there is no limit.

bool ew::app::branching::overDurationBudget(const QString &text, const ew::core::branching::LineBudget &budget, int wordsPerMinute)

Whether text is over budget's duration limit at wordsPerMinute. False when there is no limit.

ew::core::branching::LineBudget ew::app::branching::resolveLineBudget(const ew::core::project::Project &project, const ew::core::branching::BranchNode &node)

What node's text is actually allowed to cost, resolved from the project.

Three places can set a limit and the nearest wins: the line's own override, then the speaker's budget, then the project-wide default. Each of the two numbers is resolved independently, so a line may override its length without losing the speaker's duration limit – the alternative (the whole budget or none) would make the per-line override a way of switching the other check off by accident.

The returned budget's speakerId is the node's speaker, for a caller that wants to say whose budget was applied. A 0 in either field means nothing limits it.