Package ghidra.program.model.sourcemap

# Class DummySourceFileManager

java.lang.Object
ghidra.program.model.sourcemap.DummySourceFileManager

All Implemented Interfaces:
  `SourceFileManager`

public class DummySourceFileManager extends Object implements SourceFileManager
A "dummy" implementation of `SourceFileManager`.

- ## Field Summary

  ### Fields inherited from interface ghidra.program.model.sourcemap.SourceFileManager

  `DUMMY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DummySourceFileManager()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `addSourceFile(SourceFile sourceFile)`
  Adds a `SourceFile` to this manager.
  `SourceMapEntry`
  `addSourceMapEntry(SourceFile sourceFile, int lineNumber, Address baseAddr, long length)`
  Creates a `SourceMapEntry` with `SourceFile` `sourceFile`, line number `lineNumber`, and non-negative length `length` and adds it to the program database.
  `boolean`
  `containsSourceFile(SourceFile sourceFile)`
  Returns true precisely when this manager contains `sourceFile`.
  `List<SourceFile>`
  `getAllSourceFiles()`
  Returns a `List` containing all `SourceFile`s of the program.
  `List<SourceFile>`
  `getMappedSourceFiles()`
  Returns a `List` containing `SourceFile`s which are mapped to at least one address in the program
  `List<SourceMapEntry>`
  `getSourceMapEntries(SourceFile sourceFile, int minLine, int maxLine)`
  Returns the sorted list of `SourceMapEntry`s for `sourceFile` with line number between `minLine` and `maxLine`, inclusive.
  `List<SourceMapEntry>`
  `getSourceMapEntries(Address addr)`
  Returns a sorted list of `SourceMapEntry`s associated with an address `addr`.
  `SourceMapEntryIterator`
  `getSourceMapEntryIterator(Address address, boolean forward)`
  Returns a `SourceMapEntryIterator` starting at `address`.
  `boolean`
  `intersectsSourceMapEntry(AddressSetView addrs)`
  Returns `true` precisely when at least one `Address` in `addrs` has source map information.
  `boolean`
  `removeSourceFile(SourceFile sourceFile)`
  Removes a `SourceFile` from this manager.
  `boolean`
  `removeSourceMapEntry(SourceMapEntry entry)`
  Removes a `SourceMapEntry` from this manager.
  `void`
  `transferSourceMapEntries(SourceFile source, SourceFile target)`
  Changes the source map so that any `SourceMapEntry` associated with `source` is associated with `target` instead.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.program.model.sourcemap.SourceFileManager

  `addSourceMapEntry, getSourceMapEntries, getSourceMapEntries`

- ## Constructor Details

  - ### DummySourceFileManager

    public DummySourceFileManager()

- ## Method Details

  - ### getSourceMapEntries

    public List<SourceMapEntry> getSourceMapEntries(Address addr)
    Description copied from interface: `SourceFileManager`
    Returns a sorted list of `SourceMapEntry`s associated with an address `addr`.
    Specified by:
      `getSourceMapEntries` in interface `SourceFileManager`
    Parameters:
      `addr` - address
    Returns:
      line number

  - ### addSourceMapEntry

    public SourceMapEntry addSourceMapEntry(SourceFile sourceFile, int lineNumber, Address baseAddr, long length) throws LockException
    Description copied from interface: `SourceFileManager`
    Creates a `SourceMapEntry` with `SourceFile` `sourceFile`, line number `lineNumber`, and non-negative length `length` and adds it to the program database.

    Entries with non-zero lengths must either cover the same address range or be disjoint.

    Specified by:
      `addSourceMapEntry` in interface `SourceFileManager`
    Parameters:
      `sourceFile` - source file
      `lineNumber` - line number
      `baseAddr` - minimum address of range
      `length` - number of addresses in range
    Returns:
      created SourceMapEntry
    Throws:
      `LockException` - if invoked without exclusive access

  - ### intersectsSourceMapEntry

    public boolean intersectsSourceMapEntry(AddressSetView addrs)
    Description copied from interface: `SourceFileManager`
    Returns `true` precisely when at least one `Address` in `addrs` has source map information.
    Specified by:
      `intersectsSourceMapEntry` in interface `SourceFileManager`
    Parameters:
      `addrs` - addresses to check
    Returns:
      true when at least one address has source map info

  - ### getAllSourceFiles

    public List<SourceFile> getAllSourceFiles()
    Description copied from interface: `SourceFileManager`
    Returns a `List` containing all `SourceFile`s of the program.
    Specified by:
      `getAllSourceFiles` in interface `SourceFileManager`
    Returns:
      source file list

  - ### getMappedSourceFiles

    public List<SourceFile> getMappedSourceFiles()
    Description copied from interface: `SourceFileManager`
    Returns a `List` containing `SourceFile`s which are mapped to at least one address in the program
    Specified by:
      `getMappedSourceFiles` in interface `SourceFileManager`
    Returns:
      mapped source file list

  - ### transferSourceMapEntries

    public void transferSourceMapEntries(SourceFile source, SourceFile target)
    Description copied from interface: `SourceFileManager`
    Changes the source map so that any `SourceMapEntry` associated with `source` is associated with `target` instead. Any entries associated with `target` before invocation will still be associated with `target` after invocation. `source` will not be associated with any entries after invocation (unless `source` and `target` are the same). Line number information is not changed.
    Specified by:
      `transferSourceMapEntries` in interface `SourceFileManager`
    Parameters:
      `source` - source file to get info from
      `target` - source file to move info to

  - ### getSourceMapEntryIterator

    public SourceMapEntryIterator getSourceMapEntryIterator(Address address, boolean forward)
    Description copied from interface: `SourceFileManager`
    Returns a `SourceMapEntryIterator` starting at `address`.
    Specified by:
      `getSourceMapEntryIterator` in interface `SourceFileManager`
    Parameters:
      `address` - starting address
      `forward` - direction of iterator (true = forward)
    Returns:
      iterator

  - ### getSourceMapEntries

    public List<SourceMapEntry> getSourceMapEntries(SourceFile sourceFile, int minLine, int maxLine)
    Description copied from interface: `SourceFileManager`
    Returns the sorted list of `SourceMapEntry`s for `sourceFile` with line number between `minLine` and `maxLine`, inclusive.
    Specified by:
      `getSourceMapEntries` in interface `SourceFileManager`
    Parameters:
      `sourceFile` - source file
      `minLine` - minimum line number
      `maxLine` - maximum line number
    Returns:
      source map entries

  - ### addSourceFile

    public boolean addSourceFile(SourceFile sourceFile) throws LockException
    Description copied from interface: `SourceFileManager`
    Adds a `SourceFile` to this manager. A SourceFile must be added before it can be associated with any source map information.
    Specified by:
      `addSourceFile` in interface `SourceFileManager`
    Parameters:
      `sourceFile` - source file to add (can't be null)
    Returns:
      true if this manager did not already contain sourceFile
    Throws:
      `LockException` - if invoked without exclusive access

  - ### removeSourceFile

    public boolean removeSourceFile(SourceFile sourceFile) throws LockException
    Description copied from interface: `SourceFileManager`
    Removes a `SourceFile` from this manager. Any associated `SourceMapEntry`s will also be removed.
    Specified by:
      `removeSourceFile` in interface `SourceFileManager`
    Parameters:
      `sourceFile` - source file to remove
    Returns:
      true if sourceFile was in the manager
    Throws:
      `LockException` - if invoked without exclusive access

  - ### containsSourceFile

    public boolean containsSourceFile(SourceFile sourceFile)
    Description copied from interface: `SourceFileManager`
    Returns true precisely when this manager contains `sourceFile`.
    Specified by:
      `containsSourceFile` in interface `SourceFileManager`
    Parameters:
      `sourceFile` - source file
    Returns:
      true if source file already added

  - ### removeSourceMapEntry

    public boolean removeSourceMapEntry(SourceMapEntry entry) throws LockException
    Description copied from interface: `SourceFileManager`
    Removes a `SourceMapEntry` from this manager.
    Specified by:
      `removeSourceMapEntry` in interface `SourceFileManager`
    Parameters:
      `entry` - entry to remove
    Returns:
      true if entry was in the manager
    Throws:
      `LockException` - if invoked without exclusive access