JMEditorEnvironment
Loading...
Searching...
No Matches
SimResourceManager Class Reference

Singleton resource manager class for all SimEnvironment instances. Handles saving and loading, as well as sharing data between environments. More...

#include <SimEnvironment.h>

Public Member Functions

 SimResourceManager (SimResourceManager &)=delete
SimResourceManageroperator= (const SimResourceManager)=delete
void save (JMwindow *window)
 Saves all SimEnvironment objects in the vector to the stored filepath, or opens a file dialog if the file path is empty.
void saveAs (JMwindow *window)
void load (JMwindow *window)
 Opens a file dialog and loads a project from the selected file.
void save (std::string filepath)
void load (std::string filepath)
void recoverBackup ()
 Loads the backup save file if it exists.
void saveBackup ()
 Saves a backup file.
void makeNameUnique (SimObject *obj)
 Generates a new name for the object if it matches any other objects in any SimEnvironment.
SimObjectfindObject (std::string name)
 Searches for an object by name in all environments and returns a pointer to it if found, else returns nullptr.
std::vector< SimObject * > allSimObjects ()
 Returns a vector of pointers to all sim objects in all sim environments.

Static Public Member Functions

static SimResourceManagergetInstance ()

Public Attributes

std::vector< SimEnvironment * > allEnvironments
std::string projectName = "unsaved project"
std::string infoBarMessage = ""
std::string fileExtension = ".jmeditor"

Detailed Description

Singleton resource manager class for all SimEnvironment instances. Handles saving and loading, as well as sharing data between environments.

Member Data Documentation

◆ fileExtension

std::string SimResourceManager::fileExtension = ".jmeditor"

The file extension used when saving and loading. Will only be able to open files with this extension. Only set once for all simEnvironments, as it's in the singleton resource manager. Must start with '.'


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