Added new data class Setup to contain the setup information (platform,
[emufront] / src / dataobjects / filepathobject.cpp
1 #include "filepathobject.h"
2 #include "setup.h"
3
4 FilePathObject::FilePathObject() : EmuFrontFileObject(), setup(0)
5 {
6 }
7
8 FilePathObject::FilePathObject(int id, QString name, QString filename, int filetype)
9     : EmuFrontFileObject(id, name, filename, filetype), setup(0) {}
10
11  FilePathObject::FilePathObject(int id, QString name, QString filename,
12      int filetype, Setup *setup)
13     : EmuFrontFileObject(id, name, filename, filetype), setup(setup) {}
14
15 FilePathObject::~FilePathObject()
16 {
17     if (setup) delete setup;
18 }
19
20 FilePathObject::FilePathObject(const FilePathObject &fpobj)
21     : EmuFrontFileObject(fpobj.id, fpobj.name, fpobj.filename, fpobj.filetype)
22 {
23     Setup *s = fpobj.setup;
24     setup = new Setup(*s);
25 }
26
27 FilePathObject& FilePathObject::operator =(const FilePathObject &fpobj)
28 {
29     if (this == &fpobj) return *this;
30     id = fpobj.id;
31     name = fpobj.name;
32     filename = fpobj.filename;
33     filetype = fpobj.filetype;
34     if (setup) delete setup;
35     Setup *sup = fpobj.setup;
36     setup = new Setup(*sup);
37     return (*this);
38 }
39
40 Setup* FilePathObject::getSetup() const
41 { return setup; }
42 void FilePathObject::setSetup(Setup *sup)
43 { setup = sup; }