7 #if !defined(_SourceFile_h_) 13 #include "smart_ptr.h" 14 #include "DataSource.h" 15 #include "DataTarget.h" 16 #include "StringMatcher.h" 17 #include "OptionContext.h" 72 virtual bool supportsNamedSections()
const = 0;
73 virtual bool supportsNamedSymbols()
const = 0;
102 virtual DataTarget *createDataTargetForSection(
const std::string §ion) {
return NULL; }
103 virtual DataTarget *createDataTargetForSymbol(
const std::string &symbol) {
return NULL; }
104 virtual DataTarget *createDataTargetForEntryPoint();
109 virtual bool hasSymbol(
const std::string &name) {
return false; }
140 virtual bool supportsNamedSections()
const {
return false; }
141 virtual bool supportsNamedSymbols()
const {
return false; }
152 #endif // _SourceFile_h_ virtual void close()
Closes the file.
Definition: apps/elftosb/common/SourceFile.cpp:100
Abstract base class for data sources.
Definition: apps/elftosb/common/DataSource.h:33
ptr_type get()
Return the current pointer value.
Definition: apps/elftosb/common/smart_ptr.h:43
virtual DataSource * createDataSource(StringMatcher &matcher)
Creates a data source out of one or more sections of the file.
Definition: apps/elftosb/common/SourceFile.h:86
const OptionContext * getOptions() const
Return the option context.
Definition: apps/elftosb/common/SourceFile.h:52
Simple, standard smart pointer class.
Definition: apps/elftosb/common/smart_ptr.h:18
virtual unsigned getSymbolSize(const std::string &name)
Returns the size of a symbol.
Definition: apps/elftosb/common/SourceFile.h:114
Definition: BootImage.h:13
Abstract base class for a source file containing executable code.
Definition: apps/elftosb/common/SourceFile.h:33
Abstract base class for the target address or range of data.
Definition: apps/elftosb/common/DataTarget.h:34
virtual DataSource * createDataSource()=0
Creates a data source from the entire file.
virtual ~SourceFile()
Destructor.
Definition: apps/elftosb/common/SourceFile.cpp:81
virtual bool isOpen() const
Returns whether the file is already open.
Definition: apps/elftosb/common/SourceFile.h:67
virtual bool hasEntryPoint()=0
Returns true if an entry point was set in the file.
const std::string & getPath() const
Returns the path to the file.
Definition: apps/elftosb/common/SourceFile.h:54
Pure abstract interface class to a table of options.
Definition: apps/elftosb/common/OptionContext.h:18
virtual bool hasSymbol(const std::string &name)
Returns whether a symbol exists in the source file.
Definition: apps/elftosb/common/SourceFile.h:110
std::string m_path
Path to the file.
Definition: apps/elftosb/common/SourceFile.h:118
virtual uint32_t getSymbolValue(const std::string &name)
Returns the value of a symbol.
Definition: apps/elftosb/common/SourceFile.h:112
virtual void open()
Opens the file.
Definition: apps/elftosb/common/SourceFile.cpp:90
virtual uint32_t getEntryPointAddress()
Returns the entry point address.
Definition: apps/elftosb/common/SourceFile.h:97
void setOptions(OptionContext *context)
Set the option context.
Definition: apps/elftosb/common/SourceFile.h:50
virtual bool hasEntryPoint()
Returns true if an entry point was set in the file.
Definition: apps/elftosb/common/SourceFile.h:147
Binary data file.
Definition: apps/elftosb/common/SourceFile.h:129
smart_ptr< OptionContext > m_options
Table of option values.
Definition: apps/elftosb/common/SourceFile.h:120
static SourceFile * openFile(const std::string &path)
Definition: apps/elftosb/common/SourceFile.cpp:32
Abstract interface class used to select strings by name.
Definition: apps/elftosb/common/StringMatcher.h:17
smart_ptr< std::ifstream > m_stream
File stream, or NULL if file is closed.
Definition: apps/elftosb/common/SourceFile.h:119
std::ifstream * getStream()
Internal access to the input stream object.
Definition: apps/elftosb/common/SourceFile.h:123
unsigned getSize()
Get the size in bytes of the file.
Definition: apps/elftosb/common/SourceFile.cpp:108
SourceFile(const std::string &path)
Default constructor.
Definition: apps/elftosb/common/SourceFile.cpp:73
BinarySourceFile(const std::string &path)
Default constructor.
Definition: apps/elftosb/common/SourceFile.h:133