openMSX
DiskName.cc
Go to the documentation of this file.
1 #include "DiskName.hh"
2 #include "serialize.hh"
3 
4 using std::string;
5 
6 namespace openmsx {
7 
9  : name(std::move(name_))
10 {
11 }
12 
13 DiskName::DiskName(Filename name_, string extra_)
14  : name(std::move(name_))
15  , extra(std::move(extra_))
16 {
17 }
18 
19 string DiskName::getOriginal() const
20 {
21  return name.getOriginal() + extra;
22 }
23 
24 string DiskName::getResolved() const
25 {
26  return name.getResolved() + extra;
27 }
28 
30 {
31  name.updateAfterLoadState();
32 }
33 
34 bool DiskName::empty() const
35 {
36  return name.empty() && extra.empty();
37 }
38 
39 template<typename Archive>
40 void DiskName::serialize(Archive& ar, unsigned /*version*/)
41 {
42  ar.serialize("filename", name,
43  "extra", extra);
44 }
46 
47 } // namespace openmsx
bool empty() const
Definition: DiskName.cc:34
STL namespace.
const std::string & getOriginal() const
Definition: Filename.hh:26
void updateAfterLoadState()
After a loadstate we prefer to use the exact same file as before savestate.
Definition: Filename.cc:25
DiskName(Filename name)
Definition: DiskName.cc:8
This class represents a filename.
Definition: Filename.hh:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void serialize(Archive &ar, unsigned version)
Definition: DiskName.cc:40
std::string getResolved() const
Definition: DiskName.cc:24
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
const std::string & getResolved() const
Definition: Filename.hh:27
void updateAfterLoadState()
Definition: DiskName.cc:29
bool empty() const
Convenience method to test for empty filename.
Definition: Filename.cc:38
std::string getOriginal() const
Definition: DiskName.cc:19