Adafruit Library
Classes | Public Types | Public Member Functions | List of all members
Adafruit_FloppyImage Class Reference

Read-only identification and root catalogs for decoded floppy images. The caller supplies bounded byte reads from an image file or sector cache. This class does not control a drive, decode flux, or write filesystem data. More...

#include <Adafruit_FloppyImage.h>

Classes

struct  Entry
 One root-directory entry; valid only during the visitor call. More...
 

Public Types

enum  Format {
  UNKNOWN, FAT12, AMIGA_OFS, AMIGA_FFS,
  CBM_DOS, APPLE_DOS33, APPLE_PRODOS
}
 Filesystems identified by their structures, not file extensions. More...
 
typedef bool(* Read) (void *context, uint32_t offset, uint8_t *data, size_t length)
 Read exactly length bytes; return false for missing/bad sectors.
 
typedef bool(* Visit) (void *context, const Entry &entry)
 Visit an entry; return false to stop a successful listing early.
 

Public Member Functions

 Adafruit_FloppyImage (Read reader, void *context, uint32_t imageBytes)
 Bind a reader without reading or modifying its image. More...
 
bool identify ()
 Identify a supported filesystem from validated on-disk structures. More...
 
bool listRoot (Visit visitor, void *context)
 Enumerate the root directory with bounded traversal and read checks. More...
 
Format format () const
 Return the last successfully identified format. More...
 
const char * formatName () const
 Return a human-readable filesystem name without guessing the host OS. More...
 
const char * volumeName () const
 Return the volume label, or an empty string when none is present. More...
 
const char * error () const
 Explain the last failed operation. More...
 

Detailed Description

Read-only identification and root catalogs for decoded floppy images. The caller supplies bounded byte reads from an image file or sector cache. This class does not control a drive, decode flux, or write filesystem data.

Member Enumeration Documentation

◆ Format

Filesystems identified by their structures, not file extensions.

Enumerator
UNKNOWN 

Unknown, unsupported, or invalid filesystem.

FAT12 

FAT12, shared by PC DOS and many Atari ST disks.

AMIGA_OFS 

Amiga original filesystem, including international mode.

AMIGA_FFS 

Amiga fast filesystem, including international mode.

CBM_DOS 

Commodore 1541 DOS on a D64 sector image.

APPLE_DOS33 

Apple II DOS 3.3 in DOS-ordered sector image form.

APPLE_PRODOS 

Apple ProDOS in block-ordered image form.

Constructor & Destructor Documentation

◆ Adafruit_FloppyImage()

Adafruit_FloppyImage::Adafruit_FloppyImage ( Read  reader,
void *  context,
uint32_t  imageBytes 
)

Bind a reader without reading or modifying its image.

Parameters
readerCallback for exact byte reads.
contextOpaque callback context, owned by the caller.
imageBytesTotal accessible image bytes.

Member Function Documentation

◆ identify()

bool Adafruit_FloppyImage::identify ( )

Identify a supported filesystem from validated on-disk structures.

Returns
True when a supported filesystem and root directory are found.

◆ listRoot()

bool Adafruit_FloppyImage::listRoot ( Visit  visitor,
void *  context 
)

Enumerate the root directory with bounded traversal and read checks.

Parameters
visitorCalled once per live entry; false requests an early stop.
contextOpaque visitor context.
Returns
True on completion/visitor stop, false for invalid data or I/O.

◆ format()

Adafruit_FloppyImage::Format Adafruit_FloppyImage::format ( ) const

Return the last successfully identified format.

Returns
Format, or UNKNOWN before identification/after failure.

◆ formatName()

const char * Adafruit_FloppyImage::formatName ( ) const

Return a human-readable filesystem name without guessing the host OS.

Returns
Static name string.

◆ volumeName()

const char * Adafruit_FloppyImage::volumeName ( ) const

Return the volume label, or an empty string when none is present.

Returns
Object-owned NUL-terminated label.

◆ error()

const char * Adafruit_FloppyImage::error ( ) const

Explain the last failed operation.

Returns
Static error string, empty after a successful operation.

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