CommentQueries.h header

#include <ew/app/CommentQueries.h>

Namespace ew::app

CommentThread struct

struct ew::app::CommentThread

A top-level comment together with the replies in its thread, ready for threaded display in the review UI.

Members

const ew::core::Comment* ew::app::CommentThread::root = nullptr

The thread's root comment: a top-level comment, i.e. one whose parent is absent from the set. Never null in a thread returned by commentThreadsForTarget().

std::vector<const ew::core::Comment*> ew::app::CommentThread::replies

Every reply in the thread – all transitive descendants of root – ordered by creation time (then id). Empty for a lone comment with no replies.

Functions

std::vector< const ew::core::Comment * > ew::app::collectComments(const ew::core::Project &project)

Collects every comment in project, in ascending id order. The returned pointers are owned by project and stay valid only as long as it is unchanged. Callers collect once and pass the result to the analysis helpers below (which never re-scan the project).

std::vector< const ew::core::Comment * > ew::app::collectComments(const MountedLibraries &libraries, const ew::core::Project &mainProject)

Collects every comment across mainProject and all of libraries' mounted repos, deduplicated by id and in ascending id order – the review view that spans a shared universe.

std::vector< CommentThread > ew::app::commentThreadsForTarget(const std::vector< const ew::core::Comment * > &comments, ew::core::ContentId targetId)

Groups the comments in comments that annotate targetId into threads: each root comment with all of its (transitive) replies. Threads are ordered by their root's creation time; replies within a thread by their own creation time. A reply whose parent is absent from the set is treated as a root so no comment is ever dropped, and parent cycles are broken defensively.

std::vector< ew::core::ContentId > ew::app::commentedTargets(const std::vector< const ew::core::Comment * > &comments)

Returns the ids of objects that at least one comment in comments annotates (its non-null targets), deduplicated and in ascending order.

std::vector< const ew::core::Comment * > ew::app::commentsForTarget(const std::vector< const ew::core::Comment * > &comments, ew::core::ContentId targetId)

Returns the comments in comments that annotate targetId, ordered by creation time (then id for stability).

int ew::app::openCommentCount(const std::vector< const ew::core::Comment * > &comments)

Returns the number of unresolved (open) comments in comments.

int ew::app::openCommentCountForTarget(const std::vector< const ew::core::Comment * > &comments, ew::core::ContentId targetId)

Returns the number of unresolved (open) comments in comments that annotate targetId.

bool ew::app::threadHasOpenComment(const CommentThread &thread)

Returns whether thread still has any unresolved (open) comment – its root or any reply. The review UI keeps a thread visible while it has open work even after its root has been resolved (resolving a root while a reply stays open is ordinary), so the "(N open)" count never points at a hidden thread.