fxos/shell/session.h

58 lines
1.1 KiB
C++

//---
// fxos-shell.session: All the data used in an interactive session
//---
#ifndef FXOS_SESSION_H
#define FXOS_SESSION_H
#include <fxos/vspace.h>
#include <map>
#include <string>
#include <filesystem>
using namespace FxOS;
namespace fs = std::filesystem;
struct Session
{
/* Empty session with a single empty virtual space */
Session();
//---
// Environment
//---
/* Search path, folders from FXOS_LIBRARY essentially */
std::vector<fs::path> path;
/* Find file by name by searching through the path */
fs::path file(std::string name);
//---
// Virtual spaces
//---
/* Virtual spaces organized by name */
std::map<std::string, std::unique_ptr<VirtualSpace>> spaces;
/* Find a virtual space by name */
VirtualSpace *get_space(std::string name);
/* Current virtual space */
VirtualSpace *current_space;
/* Find an unused name from this prefix. If force_suffix is set, always
adds a suffix even if the name itself is free */
std::string generate_space_name(std::string prefix,
bool force_suffix=false);
//---
//
//---
/* Current cursor location */
uint32_t pc;
};
#endif /* FXOS_SESSION_H */