File: poddlthread.h

package info (click to toggle)
newsbeuter 2.9-8
  • links: PTS
  • area: main
  • in suites: buster
  • size: 4,716 kB
  • sloc: cpp: 18,663; ruby: 1,797; xml: 350; sh: 200; makefile: 171; perl: 101
file content (38 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (2)
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
36
37
38
#ifndef PODBEUTER_PODDLTHREAD__H
#define PODBEUTER_PODDLTHREAD__H

#include <thread>
#include <download.h>
#include <fstream>

#include <sys/time.h>
#include <time.h>
#include <memory>

#include <configcontainer.h>

namespace podbeuter {

class poddlthread {
	public:
		poddlthread(download * dl_, newsbeuter::configcontainer *);
		virtual ~poddlthread();
		size_t write_data(void * buffer, size_t size, size_t nmemb);
		int progress(double dlnow, double dltotal);
		void operator()();
	protected:
		double compute_kbps();
	private:
		void mkdir_p(const char * file);
		download * dl;
		std::shared_ptr<std::ofstream> f;
		timeval tv1;
		timeval tv2;
		size_t bytecount;
		newsbeuter::configcontainer * cfg;
};

}


#endif