Merge branch 'master' of git.c3d2.de:sic++

Conflicts:
	src/sicccobject.H
master
blastmaster 9 years ago
commit 2b4f7167a8

@ -13,12 +13,12 @@ class DynamicObjects
public:
std::string render_object_list();
std::string cleanpath(const char * const);
DynamicObjects(Routerin * merouterin) : _merouterin(merouterin){ };
DynamicObjects(Routerin * merouterin) : m_merouterin(merouterin){ };
~DynamicObjects() {};
private:
std::string _cleanpath (const char * const path);
std::map<unsigned int, Sicobject *> _themap;
const Routerin * _merouterin;
std::map<unsigned int, Sicobject *> m_themap;
const Routerin * m_merouterin;
};

@ -1,74 +0,0 @@
#pragma once
#include <string>
#include <ctime>
#include <sstream>
#include <iostream>
#include <cassert>
#include "Routerin.H"
class Routerin;
class Sicobject
{
public:
Sicobject() = delete;
Sicobject(const Routerin * master) :
_routerin(master),
_isvalid(false)
{
};
Sicobject(const Routerin *master, unsigned int idnum, std::string fname,size_t objsize,time_t upl_date) :
_size(objsize),
_idnum(idnum),
_routerin(master),
_isvalid(true),
_upl_date(upl_date),
_fname(fname)
{
}
~Sicobject();
std::string get_loadurl(){
std::string retval = "files/"; //TODO add master.get_baseurl()
//TODO: add idnum
return retval;
}
std::string get_fname()
{
return _fname;
}
size_t get_size() { return _size;}
std::string bytesize_string()
{
std::ostringstream strm( std::ios_base::ate);
int i = 0;
size_t size = _size;
const char* units[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
while (size > 1024) {
size /= 1024;
i++;
}
assert(i < 9);
strm << size << units[i];
return strm.str();
}
private:
size_t _size;
unsigned int _idnum;
const Routerin * _routerin;
bool _isvalid;
time_t _upl_date;
std::string _fname;
};

@ -9,54 +9,54 @@
#include <assert.h>
class Sicccobject {
public:
Sicccobject() {} // just for test cases
Sicccobject( const std::string& file,
const std::string& ftype,
const std::string& fpath,
const size_t sz)
: filename(file),
filetype(ftype),
path(fpath),
size(sz)
{
upload_date = std::chrono::system_clock::now();
}
public:
Sicccobject() {} // just for test cases
Sicccobject( const std::string& file,
const std::string& ftype,
const std::string& fpath,
const size_t sz)
: filename(file),
filetype(ftype),
path(fpath),
size(sz)
{
upload_date = std::chrono::system_clock::now();
}
Sicccobject( const char *const file,
const char *const ftype,
const char *const fpath,
const size_t sz)
: filename(file),
filetype(ftype),
path(fpath),
size(sz)
{
upload_date = std::chrono::system_clock::now();
}
Sicccobject( const char *const file,
const char *const ftype,
const char *const fpath,
const size_t sz)
: filename(file),
filetype(ftype),
path(fpath),
size(sz)
{
upload_date = std::chrono::system_clock::now();
}
Sicccobject(const std::string& file,
const std::string& ftype,
const std::string& fpath,
const size_t sz,
const std::chrono::time_point<std::chrono::system_clock>& date)
: filename(file),
filetype(ftype),
path(fpath),
size(sz),
upload_date(date) { }
Sicccobject(const std::string& file,
const std::string& ftype,
const std::string& fpath,
const size_t sz,
const std::chrono::time_point<std::chrono::system_clock>& date)
: filename(file),
filetype(ftype),
path(fpath),
size(sz),
upload_date(date) { }
Sicccobject(const json_t*);
Sicccobject(const Sicccobject&);
~Sicccobject() {}
Sicccobject& operator = (const Sicccobject&);
std::string get_filename() const { return filename; }
std::string get_filetype() const { return filetype; }
std::string get_path() const { return path; }
size_t get_size() const { return size; }
std::chrono::time_point<std::chrono::system_clock>
get_uploadtime() const { return upload_date; }
std::string get_filename() const { return filename; }
std::string get_filetype() const { return filetype; }
std::string get_path() const { return path; }
size_t get_size() const { return size; }
std::chrono::time_point<std::chrono::system_clock>
get_uploadtime() const { return upload_date; }
std::string get_pretty_sized() const
{

Loading…
Cancel
Save