Class editorObject

Class Documentation

class editorObject

The main editor object for managing project data.

This class provides a high-level interface for interacting with the editor, including file I/O, version control, and data rendering.

Public Functions

inline git_repository *getMixRepo()

Gets the Git repository for the mix data.

Returns:

A pointer to the Git repository, or nullptr if not available.

inline git_repository *getMusicRepo(const UNSANITIZED &Title)

Gets the Git repository for a specific music entry.

Parameters:

Title – The unsanitized title of the music.

Returns:

A pointer to the Git repository, or nullptr if not found.

inline git_repository *getNoteRepo()

Gets the Git repository for the note data.

Returns:

A pointer to the Git repository, or nullptr if not available.

inline git_repository *getKVRepo()

Gets the Git repository for the key-value data.

Returns:

A pointer to the Git repository, or nullptr if not available.

template<typename EDIT_ARG_TYPE>
bool AddLine(const EDIT_ARG_TYPE &obj)

Adds a new line of data to the editor.

Template Parameters:

EDIT_ARG_TYPE – The type of data to add.

Parameters:

obj – The data object to add.

Returns:

true if the line was added successfully, false otherwise.

bool AddLine(const UNSANITIZED &musicName, const DONT_SANITIZE &firstBeat)

Adds a new music entry with a specified first Beat.

Parameters:
  • musicName – The unsanitized name of the music.

  • firstBeat – The first Beat of the music.

Returns:

true if the line was added successfully, false otherwise.

int deleteLine(const EDIT_ARG_MIX &obj, bool skipType, bool skipDetail)

Deletes a line of mix data.

Parameters:
  • obj – The mix data to delete.

  • skipType – Whether to skip matching the type field.

  • skipDetail – Whether to skip matching the details field.

Returns:

The number of lines deleted.

template<typename EDIT_ARG_TYPE>
int deleteLine(const EDIT_ARG_TYPE &obj)

Deletes a line of data from the editor.

Template Parameters:

EDIT_ARG_TYPE – The type of data to delete.

Parameters:

obj – The data object to delete.

Returns:

The number of lines deleted.

bool render(const UNSANITIZED &trackTitle, litedb &ROOTDB)

Renders the project data to the root database.

Parameters:
  • trackTitle – The unsanitized title of the track to render.

  • ROOTDB – The root database to render to.

Returns:

true if the rendering was successful, false otherwise.

void demoPlayInit(std::shared_ptr<audioPlayer> &player, unsigned int frameBufferSize, const UNSANITIZED &trackTitle)

Initializes a demo player for a given track.

Parameters:
  • player[out] A shared pointer to the audio player to initialize.

  • frameBufferSize – The frame buffer size for the player.

  • trackTitle – The unsanitized title of the track to play.

bool pushToRootDB(litedb &ROOTDB, const UNSANITIZED &trackTitleToPush)

Pushes a track to the root database.

Parameters:
  • ROOTDB – The root database to push to.

  • trackTitleToPush – The unsanitized title of the track to push.

Returns:

true if the push was successful, false otherwise.

bool pushToRootDB(litedb &ROOTDB, const UNSANITIZED &musicTitle, const UNSANITIZED &musicComposer)

Pushes a music entry to the root database.

Parameters:
  • ROOTDB – The root database to push to.

  • musicTitle – The unsanitized title of the music.

  • musicComposer – The unsanitized composer of the music.

Returns:

true if the push was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
void getAll(std::function<void(const EDIT_ARG_TYPE &obj)> jsonCallback)

Gets all data of a specific type from the editor.

Template Parameters:

EDIT_ARG_TYPE – The type of data to get.

Parameters:

jsonCallback – A callback function to process each data object.

template<typename EDIT_ARG_TYPE>
bool Undo()

Undoes the last operation.

Template Parameters:

EDIT_ARG_TYPE – The type of data to undo.

Returns:

true if the undo was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
bool Undo(const UNSANITIZED &musicName)

Undoes the last operation for a specific music entry.

Template Parameters:

EDIT_ARG_TYPE – The type of data to undo.

Parameters:

musicName – The unsanitized name of the music.

Returns:

true if the undo was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
bool Redo()

Redoes the last undone operation.

Template Parameters:

EDIT_ARG_TYPE – The type of data to redo.

Returns:

true if the redo was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
bool Redo(const UNSANITIZED &musicName)

Redoes the last undone operation for a specific music entry.

Template Parameters:

EDIT_ARG_TYPE – The type of data to redo.

Parameters:

musicName – The unsanitized name of the music.

Returns:

true if the redo was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)

Switches to a specific branch or commit.

Template Parameters:

EDIT_ARG_TYPE – The type of data to operate on.

Parameters:
  • branchName – The name of the branch to switch to.

  • commitOID – A oid string to the commit ID to switch to.

Returns:

true if the operation was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
DONT_SANITIZE GetLogWithJSONGraph()

Gets the commit log as a JSON graph.

Template Parameters:

EDIT_ARG_TYPE – The type of data to get the log for.

Returns:

The commit log as a JSON string.

template<typename EDIT_ARG_TYPE>
DONT_SANITIZE GetLogWithJSONGraph(const UNSANITIZED &musicName)

Gets the commit log for a specific music entry as a JSON graph.

Template Parameters:

EDIT_ARG_TYPE – The type of data to get the log for.

Parameters:

musicName – The unsanitized name of the music.

Returns:

The commit log as a JSON string.

template<typename EDIT_ARG_TYPE>
bool UpdateLog()

Updates the commit log.

Template Parameters:

EDIT_ARG_TYPE – The type of data to update the log for.

Returns:

true if the update was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
bool UpdateLog(const DONT_SANITIZE &branchName)

Updates the commit log for a specific branch.

Template Parameters:

EDIT_ARG_TYPE – The type of data to update the log for.

Parameters:

branchName – The name of the branch to update.

Returns:

true if the update was successful, false otherwise.

template<typename EDIT_ARG_TYPE>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)

Gets the diff between two timestamps.

Template Parameters:

EDIT_ARG_TYPE – The type of data to get the diff for.

Parameters:
  • oldTimeStamp – The old timestamp.

  • newTimeStamp – The new timestamp.

Returns:

A DiffResult object containing the diff.

nj &operator[](const DONT_SANITIZE &key)

Provides access to the underlying JSON data for key-value pairs.

Parameters:

key – The key to access.

Returns:

A reference to the JSON value.

DONT_SANITIZE DESTROY_PROJECT()

Destroys the entire project.

Warning

This operation is irreversible.

Returns:

A string indicating the result of the operation.

bool ConfigNewMusic(const UNSANITIZED &NewMusicName, const UNSANITIZED &composer, const fs::path &musicPath, const DONT_SANITIZE &firstBeat = "0")

Configures a new music entry.

Parameters:
  • NewMusicName – The unsanitized name of the new music.

  • composer – The unsanitized composer of the new music.

  • musicPath – The path to the music file.

  • firstBeat – The first Beat of the music (defaults to “0”).

Returns:

true if the configuration was successful, false otherwise.

bool Open(const fs::path &projectPath)

Opens an existing editor project. if PDJE called InitEditor, you don’t need to call this again.

Parameters:

projectPath – The path to the project.

Returns:

true if the project was opened successfully, false otherwise.

editorObject() = delete
inline editorObject(const DONT_SANITIZE &auth_name, const DONT_SANITIZE &auth_email)

Constructs a new editor object with author information.

Parameters:
  • auth_name – The name of the author.

  • auth_email – The email of the author.

~editorObject() = default
template<>
bool AddLine(const EDIT_ARG_MUSIC &obj)
template<>
bool AddLine(const EDIT_ARG_MIX &obj)
template<>
bool AddLine(const EDIT_ARG_NOTE &obj)
template<>
bool AddLine(const EDIT_ARG_KEY_VALUE &obj)
template<>
int deleteLine(const EDIT_ARG_NOTE &obj)
template<>
int deleteLine(const EDIT_ARG_KEY_VALUE &obj)
template<>
int deleteLine(const EDIT_ARG_MUSIC &obj)
template<>
bool Undo()
template<>
bool Undo()
template<>
bool Undo()
template<>
bool Undo(const UNSANITIZED &musicName)
template<>
bool AddLine(const EDIT_ARG_NOTE &obj)
template<>
bool AddLine(const EDIT_ARG_MIX &obj)
template<>
bool AddLine(const EDIT_ARG_KEY_VALUE &obj)
template<>
bool AddLine(const EDIT_ARG_MUSIC &obj)
template<>
int deleteLine(const EDIT_ARG_NOTE &obj)
template<>
int deleteLine(const EDIT_ARG_KEY_VALUE &obj)
template<>
int deleteLine(const EDIT_ARG_MUSIC &obj)
template<>
void getAll(std::function<void(const EDIT_ARG_NOTE &obj)> jsonCallback)
template<>
void getAll(std::function<void(const EDIT_ARG_MIX &obj)> jsonCallback)
template<>
void getAll(std::function<void(const EDIT_ARG_KEY_VALUE &obj)> jsonCallback)
template<>
void getAll(std::function<void(const EDIT_ARG_MUSIC &obj)> jsonCallback)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DONT_SANITIZE GetLogWithJSONGraph()
template<>
DONT_SANITIZE GetLogWithJSONGraph()
template<>
DONT_SANITIZE GetLogWithJSONGraph()
template<>
DONT_SANITIZE GetLogWithJSONGraph()
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Redo()
template<>
bool Redo()
template<>
bool Redo()
template<>
bool Redo(const UNSANITIZED &musicName)
template<>
bool Undo()
template<>
bool Undo()
template<>
bool Undo()
template<>
bool Undo(const UNSANITIZED &musicName)
template<>
bool UpdateLog()
template<>
bool UpdateLog(const DONT_SANITIZE &branchName)
template<>
bool UpdateLog()
template<>
bool UpdateLog(const DONT_SANITIZE &branchName)
template<>
bool UpdateLog()
template<>
bool UpdateLog(const DONT_SANITIZE &branchName)
template<>
bool UpdateLog()
template<>
bool UpdateLog(const UNSANITIZED &musicName)
template<>
void getAll(std::function<void(const EDIT_ARG_KEY_VALUE &obj)> jsonCallback)
template<>
void getAll(std::function<void(const EDIT_ARG_MIX &obj)> jsonCallback)
template<>
void getAll(std::function<void(const EDIT_ARG_NOTE &obj)> jsonCallback)
template<>
void getAll(std::function<void(const EDIT_ARG_MUSIC &obj)> jsonCallback)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DiffResult GetDiff(const gitwrap::commit &oldTimeStamp, const gitwrap::commit &newTimeStamp)
template<>
DONT_SANITIZE GetLogWithJSONGraph()
template<>
DONT_SANITIZE GetLogWithJSONGraph()
template<>
DONT_SANITIZE GetLogWithJSONGraph()
template<>
DONT_SANITIZE GetLogWithJSONGraph(const UNSANITIZED &musicName)
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Go(const DONT_SANITIZE &branchName, const DONT_SANITIZE &commitOID)
template<>
bool Redo()
template<>
bool Redo()
template<>
bool Redo(const UNSANITIZED &musicName)
template<>
bool Redo()
template<>
bool Undo()
template<>
bool Undo()
template<>
bool Undo(const UNSANITIZED &musicName)
template<>
bool Undo()
template<>
bool UpdateLog()
template<>
bool UpdateLog(const DONT_SANITIZE &branchName)
template<>
bool UpdateLog()
template<>
bool UpdateLog(const DONT_SANITIZE &branchName)
template<>
bool UpdateLog()
template<>
bool UpdateLog(const DONT_SANITIZE &branchName)
template<>
bool UpdateLog()
template<>
bool UpdateLog(const UNSANITIZED &musicName)