KiCad PCB EDA Suite
HTML_LINK_PARSER Class Reference

The engine to parse a html text and extract useful data Here, the useful data are url links. More...

#include <html_link_parser.h>

Inheritance diagram for HTML_LINK_PARSER:

Public Member Functions

 HTML_LINK_PARSER (const wxString &aSrc, wxArrayString &aUrls)
 
void ParseLinks (bool(*aFilter)(const wxString &aData))
 Parse the html text and store links in stringUrls Stored links can be filtered if aFilter is non NULL. More...
 
void AddText (const wxString &aText) override
 
void AddString (const wxString &aText)
 
wxObject * GetProduct () override
 

Private Attributes

const wxString & m_src
 
wxArrayString & stringUrls
 
bool(* m_filter )(const wxString &aData)
 

Detailed Description

The engine to parse a html text and extract useful data Here, the useful data are url links.

Definition at line 75 of file html_link_parser.h.

Constructor & Destructor Documentation

HTML_LINK_PARSER::HTML_LINK_PARSER ( const wxString &  aSrc,
wxArrayString &  aUrls 
)

Definition at line 51 of file html_link_parser.cpp.

References m_filter.

52  : m_src( aSrc ), stringUrls( aUrls )
53 {
54  m_filter = NULL;
55  AddTagHandler( new LINK_TAGHANDLER(this) );
56 }

Member Function Documentation

void HTML_LINK_PARSER::AddString ( const wxString &  aText)

Definition at line 59 of file html_link_parser.cpp.

References m_filter, and stringUrls.

Referenced by LINK_TAGHANDLER::HandleTag().

60 {
61  wxString text = aText;
62  text.Trim( true );
63  text.Trim( false );
64 
65  if( ! m_filter || m_filter( text ) )
66  {
67  stringUrls.Add( text );
68  }
69 }
void HTML_LINK_PARSER::AddText ( const wxString &  aText)
inlineoverride

Definition at line 98 of file html_link_parser.h.

98 {}
wxObject* HTML_LINK_PARSER::GetProduct ( )
inlineoverride

Definition at line 103 of file html_link_parser.h.

104  {
105  return NULL;
106  }
void HTML_LINK_PARSER::ParseLinks ( bool(*)(const wxString &aData)  aFilter)
inline

Parse the html text and store links in stringUrls Stored links can be filtered if aFilter is non NULL.

Parameters
aFiltera filtering function ( bool aFilter( const wxString& aData ) ) which return true if the text aData must be stored.

Definition at line 91 of file html_link_parser.h.

References m_filter.

Referenced by GITHUB_GETLIBLIST::Get3DshapesLibsList().

92  {
93  m_filter = aFilter;
94  Parse(m_src);
95  }

Member Data Documentation

bool(* HTML_LINK_PARSER::m_filter) (const wxString &aData)
private

Definition at line 79 of file html_link_parser.h.

Referenced by AddString(), HTML_LINK_PARSER(), and ParseLinks().

const wxString& HTML_LINK_PARSER::m_src
private

Definition at line 77 of file html_link_parser.h.

wxArrayString& HTML_LINK_PARSER::stringUrls
private

Definition at line 78 of file html_link_parser.h.

Referenced by AddString().


The documentation for this class was generated from the following files: