Comment.h header
#include <ew/core/Comment.h>
Namespace ew::core
Comment class
class ew::core::Comment
A review comment or annotation attached to the content graph – the primitive behind async collaboration and margin notes. A Comment is a first-class content object so it can be listed, searched, shared through a library, and undone/redone like anything else, rather than living as hidden metadata on the thing it discusses.
Each comment annotates a target object (a document, entity, map, ...) and may optionally pin itself to a locator within that target via an anchor (a quoted snippet, a field name, an offset range – the meaning is left to the target's editor). Comments thread: a reply carries the id of the comment it answers as its parentId, so a target grows a tree of discussion rather than a flat list. A comment records who wrote it, when it was created and last edited, and whether the thread has been resolved (settled and dismissible from the active view). Timestamps are supplied by the caller (the app passes the current UTC time; tests pass fixed values) so the core stays deterministic.
Members
ew::core::Comment::Comment(ContentId id, ContentId targetId, QString author, QString body, QDateTime createdAt)
Creates a comment with identity id that annotates targetId, authored by author with text body, created at createdAt. The last-edited time starts equal to createdAt; the anchor and parent start empty (a top-level, whole-object comment) and it starts unresolved.
ContentId ew::core::Comment::targetId() const
The content object this comment annotates. May be null for a comment not tied to any object (a free-standing project note).
void ew::core::Comment::setTargetId(ContentId targetId)
Sets the annotated target object.
ContentId ew::core::Comment::parentId() const
The comment this one replies to, forming a discussion thread; null for a top-level comment that starts a thread.
void ew::core::Comment::setParentId(ContentId parentId)
Sets the parent comment this one replies to.
const QString & ew::core::Comment::anchor() const
The optional locator within the target that this comment pins to (a quoted snippet, a field name, an encoded text range – interpreted by the target's editor). Empty means the comment applies to the whole target.
void ew::core::Comment::setAnchor(QString anchor)
Sets the in-target anchor locator.
const QString & ew::core::Comment::author() const
The display name of whoever wrote the comment.
void ew::core::Comment::setAuthor(QString author)
Sets the author's display name.
const QString & ew::core::Comment::body() const
The comment text (Markdown is permitted).
void ew::core::Comment::setBody(QString body)
Sets the comment text.
const QDateTime & ew::core::Comment::createdAt() const
When the comment was first created (UTC).
void ew::core::Comment::setCreatedAt(QDateTime createdAt)
Sets the creation time.
const QDateTime & ew::core::Comment::updatedAt() const
When the comment was last edited (UTC); equals createdAt until the first edit.
void ew::core::Comment::setUpdatedAt(QDateTime updatedAt)
Sets the last-edited time.
bool ew::core::Comment::isResolved() const
Whether the comment (and, by convention, its thread) has been resolved and may be hidden from the active review view.
void ew::core::Comment::setResolved(bool resolved)
Sets whether the comment is resolved.