summaryrefslogtreecommitdiff
path: root/src/Format.h
blob: 532f952a4ae0e07723a63bcc0cd74f6a83020791 (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
#pragma once

#include <sstream>
#include <vector>

class VideoBuffer;

namespace format
{
	template <typename T> std::string NumberToString(T number)
	{
		std::stringstream ss;
		ss << number;
		return ss.str();
	}

	template <typename T> T StringToNumber(const std::string & text)
	{
		std::stringstream ss(text);
		T number;
		return (ss >> number)?number:0;
	}

	std::string UnixtimeToDate(time_t unixtime, std::string dateFomat = "%d %b %Y");
	std::string UnixtimeToDateMini(time_t unixtime);
	std::vector<char> VideoBufferToPNG(const VideoBuffer & vidBuf);
	unsigned long CalculateCRC(unsigned char * data, int length);
}