FileLoaderImpl Class Reference

Back to the index.

Public Member Functions | Protected Member Functions | List of all members
FileLoaderImpl Class Referenceabstract

A file loader. More...

#include <FileLoaderImpl.h>

Inheritance diagram for FileLoaderImpl:
ReferenceCountable FileLoader_aout FileLoader_bout FileLoader_ELF FileLoader_raw

Public Member Functions

 FileLoaderImpl (const string &filename)
 Constructs a file loader. More...
 
virtual ~FileLoaderImpl ()
 
virtual string DetectFileType (unsigned char *buf, size_t buflen, float &matchness) const =0
 Attempt to detect file type. More...
 
virtual bool LoadIntoComponent (refcount_ptr< Component > component, ostream &messages) const =0
 Loads the file into a Component. More...
 
- Public Member Functions inherited from ReferenceCountable
 ReferenceCountable ()
 Default constructor, which initializes the reference count to zero. More...
 
 ~ReferenceCountable ()
 

Protected Member Functions

const string & Filename () const
 

Detailed Description

A file loader.

Definition at line 40 of file FileLoaderImpl.h.

Constructor & Destructor Documentation

◆ FileLoaderImpl()

FileLoaderImpl::FileLoaderImpl ( const string &  filename)
inline

Constructs a file loader.

Parameters
filenameThe filename to load.

Definition at line 49 of file FileLoaderImpl.h.

◆ ~FileLoaderImpl()

virtual FileLoaderImpl::~FileLoaderImpl ( )
inlinevirtual

Definition at line 54 of file FileLoaderImpl.h.

References DetectFileType(), and LoadIntoComponent().

Member Function Documentation

◆ DetectFileType()

virtual string FileLoaderImpl::DetectFileType ( unsigned char *  buf,
size_t  buflen,
float &  matchness 
) const
pure virtual

Attempt to detect file type.

Parameters
bufA buffer containing the header of the file.
buflenThe length of the buffer.
matchnessSet to a value between 0.0 and 1.0, indicating the match certainty.
Returns
A file type description, if there was a match; otherwise an empty string.

Implemented in FileLoader_aout, FileLoader_bout, FileLoader_ELF, and FileLoader_raw.

Referenced by ~FileLoaderImpl().

◆ Filename()

const string& FileLoaderImpl::Filename ( ) const
inlineprotected

◆ LoadIntoComponent()

virtual bool FileLoaderImpl::LoadIntoComponent ( refcount_ptr< Component component,
ostream &  messages 
) const
pure virtual

Loads the file into a Component.

Parameters
componentThe AddressDataBus component to load the file into. (This is usually a CPUComponent.)
messagesAn output stream where debug messages can be put.
Returns
True if loading succeeded, false otherwise.

Implemented in FileLoader_aout, FileLoader_bout, FileLoader_ELF, and FileLoader_raw.

Referenced by FileLoader::Load(), and ~FileLoaderImpl().


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

Generated on Fri Dec 7 2018 19:52:23 for GXemul by doxygen 1.8.13