1 #include "filepathobject.h"
3 FilePathObject::FilePathObject()
7 FilePathObject::FilePathObject(int id, QString name, QString filename, int filetype)
8 : EmuFrontFileObject(id, name, filename, filetype), platform(0), mediaType(0)
11 FilePathObject::FilePathObject(int id, QString name, QString filename,
12 int filetype, Platform *plf, MediaType *med)
13 : EmuFrontFileObject(id, name, filename, filetype), platform(plf), mediaType(med)
16 FilePathObject::~FilePathObject()
18 if (platform) delete platform;
19 if (mediaType) delete mediaType;
22 FilePathObject::FilePathObject(const FilePathObject &fpobj)
23 : EmuFrontFileObject(fpobj.id, fpobj.name, fpobj.filename, fpobj.filetype)
25 // Note: no need to deep copy members of type QString
26 // QString uses Implicit Data Sharing (http://doc.trolltech.com/4.0/shclass.html)
27 Platform *p = fpobj.platform;
28 platform = new Platform(p->getId(), p->getName(), p->getFilename());
29 MediaType *mt = fpobj.mediaType;
30 mediaType = new MediaType(mt->getId(), mt->getName(), mt->getFilename());
33 FilePathObject& FilePathObject::operator =(const FilePathObject &fpobj)
35 if (this == &fpobj) return *this;
38 filename = fpobj.filename;
39 filetype = fpobj.filetype;
40 if (platform) delete platform;
41 Platform *p = fpobj.platform;
42 platform = new Platform(p->getId(), p->getName(), p->getFilename());
43 if (mediaType) delete mediaType;
44 MediaType *mt = fpobj.mediaType;
45 mediaType = new MediaType(mt->getId(), mt->getName(), mt->getFilename());