diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-21 02:04:15 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-21 02:04:15 +0200 |
commit | 07bde9f8575701bd0db60baf71aca2465361ff64 (patch) | |
tree | 4660c1311b9ea9a14b31fa61f67f878857d80ee9 /c/data.cpp | |
parent | b9573a485baf98e9fb749289b8b9c1f73f70d280 (diff) | |
download | EpisodeBrowser-07bde9f8575701bd0db60baf71aca2465361ff64.tar.gz |
Reimplement WaitFor.
Diffstat (limited to 'c/data.cpp')
-rw-r--r-- | c/data.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -1,3 +1,4 @@ +#include <algorithm> #include <windows.h> #include <wininet.h> #include <libxml/HTMLparser.h> @@ -93,12 +94,12 @@ bool WcharsFromXmlchars(wchar_t (&dst)[N], XmlCharPtr utf8) return MultiByteToWideChar(CP_UTF8, 0, src, cchNarrow, dst, cchWide); } -void FetchData(FileView<ElvDataA>& fvElv, FileView<DlvDataA>& fvDlv) +void FetchData(bool* bDone) { LIBXML_TEST_VERSION; - //InternetFile inf{L"https://www.detectiveconanworld.com/wiki/Anime"}; - InternetFile inf{L"file://C:/Users/John/Desktop/dcw.html"}; + InternetFile inf{L"https://www.detectiveconanworld.com/wiki/Anime"}; + //InternetFile inf{L"file://C:/Users/John/Desktop/dcw.html"}; char buf[1024]; HtmlParserCtxtPtr ctxt = htmlCreatePushParserCtxt(nullptr, nullptr, @@ -124,12 +125,15 @@ void FetchData(FileView<ElvDataA>& fvElv, FileView<DlvDataA>& fvDlv) printf("%d nodes\n", cNodes); for (int i = 0; i < cNodes; i++) { + extern FileView<ElvDataA> g_fvElv; + extern FileView<DlvDataA> g_fvDlv; + const xmlNodePtr node = nodes->nodeTab[i]; if (xmlChildElementCount(node) != 8) throw std::runtime_error("unexpected remote data format"); - ElvDataA& e = fvElv.At(i); - DlvDataA& d = fvDlv.At(i); + ElvDataA& e = g_fvElv.At(i); + DlvDataA& d = g_fvDlv.At(i); /* Get cells. */ const xmlNodePtr nodeEp = xmlFirstElementChild(node); @@ -151,4 +155,6 @@ void FetchData(FileView<ElvDataA>& fvElv, FileView<DlvDataA>& fvDlv) if (nodeLink) WcharsFromXmlchars(d.wiki, xmlGetProp(nodeLink, (const xmlChar*)"href")); } + + *bDone = true; } |