summaryrefslogtreecommitdiff
path: root/project2/xslRowsCache.h
blob: 55b86748d8b5eb4582aa17cb53c3ddaed343d7ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef XSLROWSCACHE_H
#define XSLROWSCACHE_H

#include <libxml/tree.h>
#include <boost/shared_ptr.hpp>
#include <map>
#include <set>
#include "../libmisc/curlsup.h"
#include <glibmm/ustring.h>

class XslRowsCache {
	protected:
		typedef std::set<Glib::ustring> Queued;
		typedef std::map<const Glib::ustring, boost::shared_ptr<xmlDoc> > Documents;

		static Queued queued;
		static Documents documents;

		void queue(const Glib::ustring & url, const char * encoding) const;
		
		virtual CurlHandle::Ptr newCurl() const = 0;
		virtual bool asHtml() const = 0;
		virtual bool withWarnings() const = 0;

	protected:
		xmlDocPtr getDocument(const Glib::ustring & url, const char * encoding) const;

	private:
		static size_t handleDataHelper(const char * ptr, size_t size, size_t nmemb, void *stream);
		static CurlBulkFetcher cbf;

		friend class XslCachePopulator;
};

#endif