/** * @file buffer.h * @brief Buffer management for handling multiple open files */ #ifndef BUFFER_H_ #define BUFFER_H_ #include "data.h" /** * @brief Creates a new buffer for a file * @param filename Path to the file * @return Buffer ID on success, -1 on failure */ int bufferCreate(const char *filename); /** * @brief Switches to a specific buffer by ID * @param buffer_id The buffer ID to switch to * @return 0 on success, -1 on failure */ int bufferSwitch(int buffer_id); struct buffer_t *bufferFindById(int buffer_id); /** * @brief Closes a buffer by ID * @param buffer_id The buffer ID to close * @return 0 on success, -1 on failure */ int bufferClose(int buffer_id); /** * @brief Gets the current active buffer * @return Pointer to current buffer_t, NULL if none */ struct buffer_t *bufferGetCurrent(void); /** * @brief Lists all open buffers * @return Number of open buffers */ int bufferListAll(void); /** * @brief Saves current buffer to disk * @return 0 on success, -1 on failure */ int bufferSave(void); /** * @brief Saves all buffers to disk * @return 0 on success, -1 on failure */ int bufferSaveAll(void); #endif