FileBuffer


Object Hierarchy:

Object hierarchy for FileBuffer

Description:

public interface FileBuffer : Object

Interface for file buffer operations.

Provides a unified interface for accessing file contents in OLLMchat, whether in GUI contexts (using GTK SourceView buffers) or non-GUI contexts (using in-memory buffers). This architecture ensures consistent file access patterns across the application while maintaining separation between GUI and non-GUI code.

The buffer system provides:

  • Unified Interface: Same API for GTK and non-GTK contexts
  • Type Safety: No set_data/get_data - buffers are properly typed
  • Separation of Concerns: GUI code in liboccoder, non-GUI code in libocfiles
  • Memory Management: Automatic cleanup of old buffers
  • File Tracking: Automatic last_viewed timestamp updates
  • Backup System: Automatic backups for database files
  • Modtime Checking: GTK buffers auto-reload when files change on disk

Buffers are stored directly on File objects via the buffer property. Each File object has at most one buffer instance, created lazily when needed. Buffer type depends on BufferProvider implementation (GTK vs non-GTK).

Line Numbering

All buffer methods use 0-based line numbers internally. External APIs and user-facing operations use 1-based line numbers. Tools must convert between 1-based (user input) and 0-based (buffer API).

Example:

// User provides: start_line=6, end_line=15 (1-based)
// Convert to 0-based for buffer API
int start = start_line - 1; // 5
int end = end_line - 1; // 14
var snippet = file.buffer.get_text(start, end);

All known implementing classes:

Namespace: OLLMfiles
Package: ollmchat

Content:

Properties:

Methods:

Inherited Members:

All known members inherited from class GLib.Object