} // RemoveParserListener public void Parse(IRtfSource rtfTextSource) { if (rtfTextSource == null) { throw new ArgumentNullException(nameof(rtfTextSource)); } DoParse(rtfTextSource); } // Parse
// ---------------------------------------------------------------------- public void Parse( IRtfSource rtfTextSource ) { if ( rtfTextSource == null ) { throw new ArgumentNullException( "rtfTextSource" ); } DoParse( rtfTextSource ); }
// ---------------------------------------------------------------------- public static IRtfGroup Parse( IRtfSource rtfTextSource, params IRtfParserListener[] listeners ) { RtfParserListenerStructureBuilder structureBuilder = new RtfParserListenerStructureBuilder(); RtfParser parser = new RtfParser( structureBuilder ); if ( listeners != null ) { foreach ( IRtfParserListener listener in listeners ) { if ( listener != null ) { parser.AddParserListener( listener ); } } } parser.Parse( rtfTextSource ); return structureBuilder.StructureRoot; }
} // RtfParser // ---------------------------------------------------------------------- protected override void DoParse(IRtfSource rtfTextSource) { NotifyParseBegin(); try { ParseRtf(rtfTextSource.Reader); NotifyParseSuccess(); } catch (RtfException e) { NotifyParseFail(e); throw; } finally { NotifyParseEnd(); } } // DoParse
} // Parse public static IRtfGroup Parse(IRtfSource rtfTextSource, params IRtfParserListener[] listeners) { var structureBuilder = new RtfParserListenerStructureBuilder(); var parser = new RtfParser(structureBuilder); if (listeners != null) { foreach (var listener in listeners) { if (listener != null) { parser.AddParserListener(listener); } } } parser.Parse(rtfTextSource); return(structureBuilder.StructureRoot); } // Parse
// ---------------------------------------------------------------------- protected override void DoParse( IRtfSource rtfTextSource ) { NotifyParseBegin(); try { ParseRtf( rtfTextSource.Reader ); NotifyParseSuccess(); } catch ( RtfException e ) { NotifyParseFail( e ); throw; } finally { NotifyParseEnd(); } }
} // Parse protected abstract void DoParse(IRtfSource rtfTextSource);
} // Interpret // ---------------------------------------------------------------------- public static void Interpret(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners) { Interpret(RtfParserTool.Parse(rtfTextSource), listeners); } // Interpret
} // BuildDoc // ---------------------------------------------------------------------- public static IRtfDocument BuildDoc(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners) { return(BuildDoc(RtfParserTool.Parse(rtfTextSource), listeners)); } // BuildDoc
} // BuildDoc // ---------------------------------------------------------------------- public static IRtfDocument BuildDoc(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners) { return(BuildDoc(rtfTextSource, new RtfInterpreterSettings(), listeners)); } // BuildDoc
} // Interpret // ---------------------------------------------------------------------- public static void Interpret(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners) { Interpret(rtfTextSource, new RtfInterpreterSettings(), listeners); } // Interpret
// ---------------------------------------------------------------------- protected abstract void DoParse( IRtfSource rtfTextSource );
// ---------------------------------------------------------------------- public static void Interpret( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners ) { Interpret( RtfParserTool.Parse( rtfTextSource ), listeners ); }
// ---------------------------------------------------------------------- public static IRtfDocument BuildDoc( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners ) { return BuildDoc( RtfParserTool.Parse( rtfTextSource ), listeners ); }
// ---------------------------------------------------------------------- public static IRtfDocument BuildDoc( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners ) { return BuildDoc( rtfTextSource, new RtfInterpreterSettings(), listeners ); }
// ---------------------------------------------------------------------- public static void Interpret( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners ) { Interpret( rtfTextSource, new RtfInterpreterSettings(), listeners ); }