openMSX
Public Member Functions | List of all members
openmsx::Filename Class Reference

This class represents a filename. More...

#include <Filename.hh>

Public Member Functions

 Filename ()
 Filename (const std::string &filename)
 Filename (const std::string &filename, const FileContext &context)
const std::string & getOriginal () const
const std::string & getResolved () const
void updateAfterLoadState ()
 After a loadstate we prefer to use the exact same file as before savestate.
bool empty () const
 Convenience method to test for empty filename.
void setResolved (const std::string &resolved)
 Change the resolved part of this filename E.g.
template<typename Archive >
void serialize (Archive &ar, unsigned version)

Detailed Description

This class represents a filename.

A filename is resolved in a certain context. It is possible to query both the resolved and unresolved filename.

Most file operations will want the resolved name, but for example for savestates we (also) want the unresolved name.

Definition at line 18 of file Filename.hh.

Constructor & Destructor Documentation

openmsx::Filename::Filename ( )

Definition at line 13 of file Filename.cc.

openmsx::Filename::Filename ( const std::string &  filename)
explicit

Definition at line 17 of file Filename.cc.

openmsx::Filename::Filename ( const std::string &  filename,
const FileContext context 
)

Definition at line 23 of file Filename.cc.

Member Function Documentation

bool openmsx::Filename::empty ( ) const

Convenience method to test for empty filename.

In any case getOriginal().empty() and getResolved().empty() return the same result. This method is a shortcut to either of these.

Definition at line 53 of file Filename.cc.

References getOriginal(), and getResolved().

Referenced by openmsx::DiskName::empty(), openmsx::SoundDevice::recordChannel(), openmsx::HD::serialize(), and updateAfterLoadState().

const string & openmsx::Filename::getOriginal ( ) const
const string & openmsx::Filename::getResolved ( ) const
template<typename Archive >
void openmsx::Filename::serialize ( Archive &  ar,
unsigned  version 
)

Definition at line 65 of file Filename.cc.

Referenced by openmsx::DiskChanger::serialize().

void openmsx::Filename::setResolved ( const std::string &  resolved)

Change the resolved part of this filename E.g.

on loadstate when we didn't find the original file, but another file with a matching checksum.

Definition at line 59 of file Filename.cc.

Referenced by openmsx::CassettePlayer::serialize().

void openmsx::Filename::updateAfterLoadState ( )

After a loadstate we prefer to use the exact same file as before savestate.

But if that file is not available (possibly because snapshot is loaded on a different host machine), we fallback to the original filename.

Definition at line 40 of file Filename.cc.

References empty(), openmsx::FileOperations::exists(), and openmsx::FileOperations::getAbsolutePath().

Referenced by openmsx::HD::serialize(), openmsx::CassettePlayer::serialize(), and openmsx::DiskName::updateAfterLoadState().


The documentation for this class was generated from the following files: