KiCad PCB EDA Suite
Loading...
Searching...
No Matches
LOCKFILE Class Reference

#include <lockfile.h>

Public Member Functions

 LOCKFILE (const wxString &filename, bool aRemoveOnRelease=true)
 
 ~LOCKFILE ()
 
void UnlockFile ()
 Unlocks and removes the file from the filesystem as long as we still own it.
 
bool OverrideLock (bool aRemoveOnRelease=true)
 Forces the lock, overwriting the data that existed already.
 
bool IsLockedByMe ()
 
wxString GetUsername ()
 
wxString GetHostname ()
 
wxString GetErrorMsg ()
 
bool Locked () const
 
bool Valid () const
 
 operator bool () const
 

Private Member Functions

bool checkUserAndHost ()
 

Private Attributes

wxString m_originalFile
 
wxString m_lockFilename
 
wxString m_username
 
wxString m_hostname
 
bool m_fileCreated
 
bool m_status
 
bool m_removeOnRelease
 
wxString m_errorMsg
 

Detailed Description

Definition at line 42 of file lockfile.h.

Constructor & Destructor Documentation

◆ LOCKFILE()

LOCKFILE::LOCKFILE ( const wxString &  filename,
bool  aRemoveOnRelease = true 
)
inline

◆ ~LOCKFILE()

LOCKFILE::~LOCKFILE ( )
inline

Definition at line 130 of file lockfile.h.

References UnlockFile().

Member Function Documentation

◆ checkUserAndHost()

bool LOCKFILE::checkUserAndHost ( )
inlineprivate

Definition at line 256 of file lockfile.h.

References LCK, m_hostname, m_lockFilename, and m_username.

Referenced by UnlockFile().

◆ GetErrorMsg()

wxString LOCKFILE::GetErrorMsg ( )
inline
Returns
Last error message generated

Definition at line 229 of file lockfile.h.

References m_errorMsg.

◆ GetHostname()

wxString LOCKFILE::GetHostname ( )
inline
Returns
Current hostname. If we own the lock this is our computer. Otherwise, this is the computer that does

Definition at line 224 of file lockfile.h.

References m_hostname.

◆ GetUsername()

wxString LOCKFILE::GetUsername ( )
inline
Returns
Current username. If we own the lock, this is us. Otherwise, this is the user that does own it

Definition at line 219 of file lockfile.h.

References m_username.

◆ IsLockedByMe()

bool LOCKFILE::IsLockedByMe ( )
inline

Definition at line 211 of file lockfile.h.

References m_hostname, and m_username.

◆ Locked()

bool LOCKFILE::Locked ( ) const
inline

Definition at line 231 of file lockfile.h.

References m_fileCreated.

◆ operator bool()

LOCKFILE::operator bool ( ) const
inlineexplicit

Definition at line 241 of file lockfile.h.

References m_status.

◆ OverrideLock()

bool LOCKFILE::OverrideLock ( bool  aRemoveOnRelease = true)
inline

Forces the lock, overwriting the data that existed already.

Returns
True if we successfully overrode the lock

Definition at line 158 of file lockfile.h.

References LCK, m_errorMsg, m_fileCreated, m_hostname, m_lockFilename, m_removeOnRelease, m_status, and m_username.

◆ UnlockFile()

void LOCKFILE::UnlockFile ( )
inline

Unlocks and removes the file from the filesystem as long as we still own it.

Definition at line 138 of file lockfile.h.

References checkUserAndHost(), LCK, m_errorMsg, m_fileCreated, m_lockFilename, m_removeOnRelease, and m_status.

Referenced by ~LOCKFILE().

◆ Valid()

bool LOCKFILE::Valid ( ) const
inline

Definition at line 236 of file lockfile.h.

References m_status.

Referenced by SETTINGS_MANAGER::LoadProject().

Member Data Documentation

◆ m_errorMsg

wxString LOCKFILE::m_errorMsg
private

Definition at line 254 of file lockfile.h.

Referenced by GetErrorMsg(), LOCKFILE(), OverrideLock(), and UnlockFile().

◆ m_fileCreated

bool LOCKFILE::m_fileCreated
private

Definition at line 251 of file lockfile.h.

Referenced by Locked(), LOCKFILE(), OverrideLock(), and UnlockFile().

◆ m_hostname

wxString LOCKFILE::m_hostname
private

Definition at line 250 of file lockfile.h.

Referenced by checkUserAndHost(), GetHostname(), IsLockedByMe(), LOCKFILE(), and OverrideLock().

◆ m_lockFilename

wxString LOCKFILE::m_lockFilename
private

Definition at line 248 of file lockfile.h.

Referenced by checkUserAndHost(), LOCKFILE(), OverrideLock(), and UnlockFile().

◆ m_originalFile

wxString LOCKFILE::m_originalFile
private

Definition at line 247 of file lockfile.h.

◆ m_removeOnRelease

bool LOCKFILE::m_removeOnRelease
private

Definition at line 253 of file lockfile.h.

Referenced by LOCKFILE(), OverrideLock(), and UnlockFile().

◆ m_status

bool LOCKFILE::m_status
private

Definition at line 252 of file lockfile.h.

Referenced by LOCKFILE(), operator bool(), OverrideLock(), UnlockFile(), and Valid().

◆ m_username

wxString LOCKFILE::m_username
private

Definition at line 249 of file lockfile.h.

Referenced by checkUserAndHost(), GetUsername(), IsLockedByMe(), LOCKFILE(), and OverrideLock().


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