Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Olympe::CommentManager Class Reference

Singleton that owns all GraphComment instances for the active graph. More...

#include <GraphComment.h>

Public Member Functions

int AddComment (const GraphComment &comment)
 Adds a comment and assigns it a unique ID.
 
void RemoveComment (int commentId)
 Removes the comment with the given ID.
 
GraphCommentGetComment (int commentId)
 Returns a pointer to the comment with the given ID.
 
void UpdateComment (int commentId, const GraphComment &comment)
 Replaces the stored comment data for the given ID.
 
int GetCommentCount () const
 Returns the total number of comments managed.
 
void Clear ()
 Removes all comments and resets the ID counter.
 
void SaveToJson (nlohmann::json &j) const
 
void LoadFromJson (const nlohmann::json &j)
 

Static Public Member Functions

static CommentManagerGet ()
 Returns the single shared instance.
 

Private Member Functions

 CommentManager ()
 

Private Attributes

std::vector< GraphCommentm_Comments
 
int m_NextCommentId
 

Detailed Description

Singleton that owns all GraphComment instances for the active graph.

Typical usage:

c.text = "Patrol loop entry";
c.posX = 100.0f; c.posY = 200.0f;
int id = cm.AddComment(c);
cm.RemoveComment(id);
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
static CommentManager & Get()
Returns the single shared instance.
A rectangular comment box placed on the graph canvas.
std::string text
Text content displayed inside the box.

Definition at line 67 of file GraphComment.h.

Constructor & Destructor Documentation

◆ CommentManager()

Olympe::CommentManager::CommentManager ( )
private

Definition at line 79 of file GraphComment.cpp.

Member Function Documentation

◆ AddComment()

int Olympe::CommentManager::AddComment ( const GraphComment comment)

Adds a comment and assigns it a unique ID.

Returns
The assigned comment ID.

Definition at line 88 of file GraphComment.cpp.

References GetComponentTypeID_Static(), Olympe::GraphComment::id, m_Comments, and m_NextCommentId.

+ Here is the call graph for this function:

◆ Clear()

void Olympe::CommentManager::Clear ( )

Removes all comments and resets the ID counter.

Definition at line 139 of file GraphComment.cpp.

References m_Comments, and m_NextCommentId.

Referenced by LoadFromJson().

+ Here is the caller graph for this function:

◆ Get()

CommentManager & Olympe::CommentManager::Get ( )
static

Returns the single shared instance.

Definition at line 73 of file GraphComment.cpp.

◆ GetComment()

GraphComment * Olympe::CommentManager::GetComment ( int  commentId)

Returns a pointer to the comment with the given ID.

Returns
Pointer, or nullptr if not found.

Definition at line 108 of file GraphComment.cpp.

References GetComponentTypeID_Static(), and m_Comments.

+ Here is the call graph for this function:

◆ GetCommentCount()

int Olympe::CommentManager::GetCommentCount ( ) const

Returns the total number of comments managed.

Definition at line 134 of file GraphComment.cpp.

References m_Comments.

◆ LoadFromJson()

void Olympe::CommentManager::LoadFromJson ( const nlohmann::json j)

Definition at line 157 of file GraphComment.cpp.

References Clear(), Olympe::GraphComment::FromJson(), GetComponentTypeID_Static(), m_Comments, and m_NextCommentId.

+ Here is the call graph for this function:

◆ RemoveComment()

void Olympe::CommentManager::RemoveComment ( int  commentId)

Removes the comment with the given ID.

No-op if not found.

Definition at line 96 of file GraphComment.cpp.

References GetComponentTypeID_Static(), and m_Comments.

+ Here is the call graph for this function:

◆ SaveToJson()

void Olympe::CommentManager::SaveToJson ( nlohmann::json j) const

Definition at line 149 of file GraphComment.cpp.

References GetComponentTypeID_Static(), and m_Comments.

+ Here is the call graph for this function:

◆ UpdateComment()

void Olympe::CommentManager::UpdateComment ( int  commentId,
const GraphComment comment 
)

Replaces the stored comment data for the given ID.

Definition at line 118 of file GraphComment.cpp.

References GetComponentTypeID_Static(), Olympe::GraphComment::id, m_Comments, and SYSTEM_LOG.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_Comments

std::vector<GraphComment> Olympe::CommentManager::m_Comments
private

◆ m_NextCommentId

int Olympe::CommentManager::m_NextCommentId
private

Definition at line 117 of file GraphComment.h.

Referenced by AddComment(), Clear(), and LoadFromJson().


The documentation for this class was generated from the following files: