stuff changed for compliance
This commit is contained in:
parent
8d91ec55b8
commit
043569d0cb
|
@ -13,12 +13,12 @@ class DynamicObjects
|
||||||
public:
|
public:
|
||||||
std::string render_object_list();
|
std::string render_object_list();
|
||||||
std::string cleanpath(const char * const);
|
std::string cleanpath(const char * const);
|
||||||
DynamicObjects(Routerin * merouterin) : _merouterin(merouterin){ };
|
DynamicObjects(Routerin * merouterin) : m_merouterin(merouterin){ };
|
||||||
~DynamicObjects() {};
|
~DynamicObjects() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _cleanpath (const char * const path);
|
std::string _cleanpath (const char * const path);
|
||||||
std::map<unsigned int, Sicobject *> _themap;
|
std::map<unsigned int, Sicobject *> m_themap;
|
||||||
const Routerin * _merouterin;
|
const Routerin * m_merouterin;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,61 +14,64 @@ class Sicobject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Sicobject() = delete;
|
Sicobject() = delete;
|
||||||
|
|
||||||
Sicobject(const Routerin * master) :
|
Sicobject(const Routerin * master) :
|
||||||
_routerin(master),
|
m_routerin(master),
|
||||||
_isvalid(false)
|
m_isvalid(false)
|
||||||
{
|
{ }
|
||||||
};
|
|
||||||
|
|
||||||
Sicobject(const Routerin *master, unsigned int idnum, std::string fname,size_t objsize,time_t upl_date) :
|
Sicobject(const Routerin *master,
|
||||||
_size(objsize),
|
unsigned int idnum,
|
||||||
_idnum(idnum),
|
std::string fname,
|
||||||
_routerin(master),
|
size_t objsize,
|
||||||
_isvalid(true),
|
time_t upl_date) :
|
||||||
_upl_date(upl_date),
|
m_size(objsize),
|
||||||
_fname(fname)
|
m_idnum(idnum),
|
||||||
|
m_routerin(master),
|
||||||
|
m_isvalid(true),
|
||||||
|
m_upl_date(upl_date),
|
||||||
|
m_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 m_fname;
|
||||||
|
}
|
||||||
|
|
||||||
~Sicobject();
|
size_t get_size() { return m_size;}
|
||||||
std::string get_loadurl(){
|
|
||||||
std::string retval = "files/"; //TODO add master.get_baseurl()
|
std::string bytesize_string()
|
||||||
//TODO: add idnum
|
{
|
||||||
return retval;
|
std::ostringstream strm( std::ios_base::ate);
|
||||||
}
|
int i = 0;
|
||||||
|
size_t size = m_size;
|
||||||
std::string get_fname()
|
const char* units[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
|
||||||
{
|
while (size > 1024) {
|
||||||
return _fname;
|
size /= 1024;
|
||||||
}
|
i++;
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
assert(i < 9);
|
||||||
|
strm << size << units[i];
|
||||||
|
return strm.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t _size;
|
size_t m_size;
|
||||||
unsigned int _idnum;
|
unsigned int m_idnum;
|
||||||
const Routerin * _routerin;
|
const Routerin * m_routerin;
|
||||||
bool _isvalid;
|
bool m_isvalid;
|
||||||
time_t _upl_date;
|
time_t m_upl_date;
|
||||||
std::string _fname;
|
std::string m_fname;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,60 +6,60 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
class Sicccobject {
|
class Sicccobject {
|
||||||
public:
|
public:
|
||||||
Sicccobject() {} // just for test cases
|
Sicccobject() {} // just for test cases
|
||||||
Sicccobject( const std::string& file,
|
Sicccobject( const std::string& file,
|
||||||
const std::string& ftype,
|
const std::string& ftype,
|
||||||
const std::string& fpath,
|
const std::string& fpath,
|
||||||
const size_t sz)
|
const size_t sz)
|
||||||
: filename(file),
|
: filename(file),
|
||||||
filetype(ftype),
|
filetype(ftype),
|
||||||
path(fpath),
|
path(fpath),
|
||||||
size(sz)
|
size(sz)
|
||||||
{
|
{
|
||||||
upload_date = std::chrono::system_clock::now();
|
upload_date = std::chrono::system_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
Sicccobject( const char *const file,
|
Sicccobject( const char *const file,
|
||||||
const char *const ftype,
|
const char *const ftype,
|
||||||
const char *const fpath,
|
const char *const fpath,
|
||||||
const size_t sz)
|
const size_t sz)
|
||||||
: filename(file),
|
: filename(file),
|
||||||
filetype(ftype),
|
filetype(ftype),
|
||||||
path(fpath),
|
path(fpath),
|
||||||
size(sz)
|
size(sz)
|
||||||
{
|
{
|
||||||
upload_date = std::chrono::system_clock::now();
|
upload_date = std::chrono::system_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
Sicccobject(const std::string& file,
|
Sicccobject(const std::string& file,
|
||||||
const std::string& ftype,
|
const std::string& ftype,
|
||||||
const std::string& fpath,
|
const std::string& fpath,
|
||||||
const size_t sz,
|
const size_t sz,
|
||||||
const std::chrono::time_point<std::chrono::system_clock>& date)
|
const std::chrono::time_point<std::chrono::system_clock>& date)
|
||||||
: filename(file),
|
: filename(file),
|
||||||
filetype(ftype),
|
filetype(ftype),
|
||||||
path(fpath),
|
path(fpath),
|
||||||
size(sz),
|
size(sz),
|
||||||
upload_date(date) { }
|
upload_date(date) { }
|
||||||
|
|
||||||
Sicccobject(const Sicccobject&);
|
Sicccobject(const Sicccobject&);
|
||||||
~Sicccobject() {}
|
~Sicccobject() {}
|
||||||
Sicccobject& operator = (const Sicccobject&);
|
Sicccobject& operator = (const Sicccobject&);
|
||||||
|
|
||||||
std::string get_filename() const { return filename; }
|
std::string get_filename() const { return filename; }
|
||||||
std::string get_filetype() const { return filetype; }
|
std::string get_filetype() const { return filetype; }
|
||||||
std::string get_path() const { return path; }
|
std::string get_path() const { return path; }
|
||||||
size_t get_size() const { return size; }
|
size_t get_size() const { return size; }
|
||||||
std::chrono::time_point<std::chrono::system_clock>
|
std::chrono::time_point<std::chrono::system_clock>
|
||||||
get_uploadtime() const { return upload_date; }
|
get_uploadtime() const { return upload_date; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::string filetype;
|
std::string filetype;
|
||||||
std::string path;
|
std::string path;
|
||||||
size_t size;
|
size_t size;
|
||||||
std::chrono::time_point<std::chrono::system_clock> upload_date;
|
std::chrono::time_point<std::chrono::system_clock> upload_date;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator << (std::ostream&, const Sicccobject&);
|
std::ostream& operator << (std::ostream&, const Sicccobject&);
|
||||||
|
|
Loading…
Reference in New Issue