Interface IParser
Interface implemented by parsers. Abstracting this functionality into a separate interface allows you to drive parsing for native and bilingual content in the same way.
Inherited Members
Namespace: Sdl.FileTypeSupport.Framework.NativeApi
Assembly: Sdl.FileTypeSupport.Framework.Core.dll
Syntax
public interface IParser : IDisposable
Methods
ParseNext()
This method is called repeatedly by the framework to process the next chunk of input.
The implementation should parse a suitable (preferably not too large) chunk of the input, and return a boolean value that indicates whether there is more work to be done before this file is completely parsed.
Declaration
bool ParseNext()
Returns
Type | Description |
---|---|
System.Boolean |
|
Events
Progress
The parser fires this event at regular intervals in order to report the progress so that interested parties can ascertain whether the parsing process is indeed in progress and has not hung. That way users get an idea about how fast the parsing job is progressing.
Framework consumers should typically not connect directly to
this event, but rather connect to the corresponding event on the
IFileConverter
instance.
Declaration
event EventHandler<ProgressEventArgs> Progress
Event Type
Type | Description |
---|---|
System.EventHandler<ProgressEventArgs> |
Remarks
Progress is reported in integer percentage values. It is not an error when a parser reports the same percentage number in subsequent events. This just indicates to the listeners that the progress is slow but the component is still working on it.
It is unusual (but not unthinkable) that a percentage value can decrease. This could happen if the parser gets a better estimate of the job size (e.g. when it needs to parse dependency files, too).
It is customary for a parser to fire this event with a percentage value of 0 when parsing is about to begin and with a percentage value of 100 when parsing is finished.