Class AbstractNativeFileParser
Abstract base class that provides boilerplate implementation for native file parsers.
Deriving your file parser from this class will save you some
implementation work. Provides a default implementation of the
Parse
Implements
Inherited Members
Namespace: Sdl.FileTypeSupport.Framework.NativeApi
Assembly: Sdl.FileTypeSupport.Framework.Core.dll
Syntax
public abstract class AbstractNativeFileParser : AbstractNativeFileTypeComponent, INativeContentStreamMessageReporter, IBasicMessageReporter, INativeFileParser, INativeFileTypeComponent, IParser, IDisposable
Constructors
AbstractNativeFileParser()
Protected constructor that should only be called by derived classes
Declaration
protected AbstractNativeFileParser()
Properties
CurrentStage
The stage of processing that the parser has reached
Declaration
protected AbstractNativeFileParser.Stage CurrentStage { get; set; }
Property Value
Type | Description |
---|---|
Abstract |
Output
Default implementation of the Output property
Declaration
public virtual INativeExtractionContentHandler Output { get; set; }
Property Value
Type | Description |
---|---|
INative |
Methods
AfterParsing()
The implementation of Parse
Override this method to do clean-up work such as closing the file etc. once parsing is complete.
The default implementation does nothing.
Declaration
protected virtual void AfterParsing()
BeforeParsing()
The implementation of Parse
Override this method to perform setup work for the parsing such as initializing the state, opening the file to be parsed, etc.
The default implementation of this method does nothing.
Declaration
protected virtual void BeforeParsing()
Dispose()
Implements IDisposable. Just calls Dispose saying that this is an explicit disposal and tells the GC not to call the Finalizer.
Declaration
public void Dispose()
Dispose(Boolean)
Last change for the Parser to dispose manage and unmanged objects. It can be overriden by subclases.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | indicates if the dispose is explicit or implicit (from GC) |
DuringParsing()
The implementation of Parse
Before
Override this method to perform the parsing in suitably small chunks.
Returns true
as long as there is more content to be parsed.
Once this function returns false
, the After
During parsing the implementation may call On
The default implementation returns false.
Declaration
protected virtual bool DuringParsing()
Returns
Type | Description |
---|---|
Boolean | True if there is more content to be parsed, false when parsing has been completed |
Finalize()
The distructor just calls Dispose with false parameter specifying this is a cakl from GC.
Declaration
protected void Finalize()
OnProgress(Byte)
Helper method to set up the Progress event
Declaration
public void OnProgress(byte percent)
Parameters
Type | Name | Description |
---|---|---|
Byte | percent |
OnProgress(Object, ProgressEventArgs)
Helper method to fire the Progress event
Declaration
public virtual void OnProgress(object sender, ProgressEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Object | sender | the event source |
Progress |
args | progress value between 0 and 100 |
OutputText(String)
Helper method to output plain text
Declaration
public void OutputText(string text)
Parameters
Type | Name | Description |
---|---|---|
String | text |
ParseNext()
Default implementation that takes care of dividing the parsing into
three stages, before parsing, during parsing, and after parsing, by calling
the methods Before
Derived classes do not need to override this method unless they need to add additional functionality outside of the three parsing implementation methods.
Declaration
public virtual bool ParseNext()
Returns
Type | Description |
---|---|
Boolean |
Events
Progress
Progress reporting events, typically attached to when a progress reporter is used
Declaration
public event EventHandler<ProgressEventArgs> Progress
Event Type
Type | Description |
---|---|
Event |