stuff changed for compliance

master
john stone 9 years ago
parent 8d91ec55b8
commit 043569d0cb

@ -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;
};

@ -14,61 +14,64 @@ class Sicobject
{
public:
Sicobject() = delete;
Sicobject() = delete;
Sicobject(const Routerin * master) :
_routerin(master),
_isvalid(false)
{
};
Sicobject(const Routerin * master) :
m_routerin(master),
m_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(const Routerin *master,
unsigned int idnum,
std::string fname,
size_t objsize,
time_t upl_date) :
m_size(objsize),
m_idnum(idnum),
m_routerin(master),
m_isvalid(true),
m_upl_date(upl_date),
m_fname(fname)
{ }
~Sicobject();
~Sicobject();
std::string get_loadurl(){
std::string retval = "files/"; //TODO add master.get_baseurl()
//TODO: add idnum
return retval;
}
std::string get_loadurl()
{
std::string retval = "files/"; //TODO add master.get_baseurl()
//TODO: add idnum
return retval;
}
std::string get_fname()
{
return _fname;
}
std::string get_fname()
{
return m_fname;
}
size_t get_size() { return _size;}
size_t get_size() { return m_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();
std::string bytesize_string()
{
std::ostringstream strm( std::ios_base::ate);
int i = 0;
size_t size = m_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;
size_t m_size;
unsigned int m_idnum;
const Routerin * m_routerin;
bool m_isvalid;
time_t m_upl_date;
std::string m_fname;
};

@ -6,60 +6,60 @@
#include <cstdlib>
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 Sicccobject&);
~Sicccobject() {}
Sicccobject& operator = (const Sicccobject&);
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; }
private:
std::string filename;
std::string filetype;
std::string path;
size_t size;
std::chrono::time_point<std::chrono::system_clock> upload_date;
private:
std::string filename;
std::string filetype;
std::string path;
size_t size;
std::chrono::time_point<std::chrono::system_clock> upload_date;
};
std::ostream& operator << (std::ostream&, const Sicccobject&);

Loading…
Cancel
Save