API
 
Loading...
Searching...
No Matches
MagAOX::file::stdFileName< verboseT > Class Template Reference

Organize and analyze the name of a standard file name. More...

#include <stdFileName.hpp>

Collaboration diagram for MagAOX::file::stdFileName< verboseT >:
Collaboration graph

Public Member Functions

 stdFileName ()
 Default c'tor.
 
 stdFileName (const std::string &fullName)
 Construct from a full name.
 
stdFileNameoperator= (const std::string &fullname)
 Assignment operator from string.
 
mx::error_t fullName (const std::string &fullName)
 Sets the full name.
 
const std::string & fullName (mx::error_t *errc=nullptr) const
 Get the current value of m_fullName.
 
const std::string & baseName (mx::error_t *errc=nullptr) const
 Get the current value of m_baseName.
 
const std::string & extension (mx::error_t *errc=nullptr) const
 Get the current value of.
 
const std::string & appName (mx::error_t *errc=nullptr) const
 Get the current value of m_appName.
 
const stdSubDir< verboseT > & subDir (mx::error_t *errc=nullptr) const
 Get the current value of m_subDir.
 
int year (mx::error_t *errc=nullptr) const
 Get the year.
 
unsigned month (mx::error_t *errc=nullptr) const
 Get the month.
 
unsigned day (mx::error_t *errc=nullptr) const
 Get the day.
 
int hour (mx::error_t *errc=nullptr) const
 Get the current value of m_hour.
 
int minute (mx::error_t *errc=nullptr) const
 Get the current value of m_minute.
 
int second (mx::error_t *errc=nullptr) const
 Get the current value of m_second.
 
int nsec (mx::error_t *errc=nullptr) const
 Get the current value of m_nsec.
 
flatlogs::timespecX timestamp (mx::error_t *errc=nullptr) const
 Get the current value of m_valid.
 
bool valid () const
 Get the current value of.
 
void invalidate ()
 Set all stored values to invalid values.
 

Protected Attributes

std::string m_fullName
 The full name of the file, including path.
 
std::string m_baseName
 The base name of the file, not including path.
 
std::string m_extension
 The extension of the file.
 
std::string m_appName
 The name of the application which wrote the file.
 
stdSubDir< verboseT > m_subDir
 The subdirectory of the file.
 
int m_hour { 0 }
 The hour of the timestamp.
 
int m_minute { 0 }
 The minute of the timestamp.
 
int m_second { 0 }
 The second of the timestamp.
 
int m_nsec { 0 }
 The nanosecond of the timestamp.
 
flatlogs::timespecX m_timestamp { 0, 0 }
 The timestamp.
 
bool m_valid { false }
 Whether or not the filename parsed correctly and the components are valid.
 

Detailed Description

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
class MagAOX::file::stdFileName< verboseT >

Organize and analyze the name of a standard file name.

Definition at line 35 of file stdFileName.hpp.

Constructor & Destructor Documentation

◆ stdFileName() [1/2]

template<class verboseT >
MagAOX::file::stdFileName< verboseT >::stdFileName ( )

Default c'tor.

Definition at line 203 of file stdFileName.hpp.

◆ stdFileName() [2/2]

template<class verboseT >
MagAOX::file::stdFileName< verboseT >::stdFileName ( const std::string &  fullName)
explicit

Construct from a full name.

This calls fullName(const std::string &), which parses the input and populates all fields.

On success, sets m_valid=true

Exceptions
nestedMagAOX::xwcException on an exception from fullName.
Parameters
[in]fullNameThe new full name of the file (including the path)

Definition at line 209 of file stdFileName.hpp.

Member Function Documentation

◆ appName()

template<class verboseT >
const std::string & MagAOX::file::stdFileName< verboseT >::appName ( mx::error_t *  errc = nullptr) const

Get the current value of m_appName.

Returns
the current value of m_appName
Parameters
[in]errc[optional] error code

Definition at line 454 of file stdFileName.hpp.

Referenced by MagAOX::logger::logMap< verboseT >::addFileListToFileMap(), libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ baseName()

template<class verboseT >
const std::string & MagAOX::file::stdFileName< verboseT >::baseName ( mx::error_t *  errc = nullptr) const

Get the current value of m_baseName.

Returns
the current value of m_baseName
Parameters
[in]errc[optional] error code

Definition at line 416 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ day()

template<class verboseT >
unsigned int MagAOX::file::stdFileName< verboseT >::day ( mx::error_t *  errc = nullptr) const

Get the day.

Returns
day from m_subDir
Parameters
[in]errc[optional] error code

Definition at line 532 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ extension()

template<class verboseT >
const std::string & MagAOX::file::stdFileName< verboseT >::extension ( mx::error_t *  errc = nullptr) const

Get the current value of.

Returns
the current value of
Parameters
[in]errc[optional] error code

Definition at line 435 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ fullName() [1/2]

template<class verboseT >
mx::error_t MagAOX::file::stdFileName< verboseT >::fullName ( const std::string &  fullName)

Sets the full name.

Setting the full name is the only way to set any of the values. This parses the input and populates all fields.

Exceptions
nestedMagAOX::xwcException on a bad_alloc exception.
Parameters
[in]fullNameThe new full name of the file (including the path)

Definition at line 246 of file stdFileName.hpp.

References MagAOX::file::parseFilePath().

Referenced by MagAOX::logger::logMap< verboseT >::loadAppToFileMap(), MagAOX::logger::logInMemory::loadFile(), libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ fullName() [2/2]

template<class verboseT >
const std::string & MagAOX::file::stdFileName< verboseT >::fullName ( mx::error_t *  errc = nullptr) const

Get the current value of m_fullName.

Returns
the current value of m_fullName
Parameters
[in]errc[optional] error code

Definition at line 397 of file stdFileName.hpp.

◆ hour()

template<class verboseT >
int MagAOX::file::stdFileName< verboseT >::hour ( mx::error_t *  errc = nullptr) const

Get the current value of m_hour.

Returns
the current value of m_hour
Parameters
[in]errc[optional] error code

Definition at line 552 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ invalidate()

template<class verboseT >
void MagAOX::file::stdFileName< verboseT >::invalidate ( )

Set all stored values to invalid values.

Definition at line 658 of file stdFileName.hpp.

References MagAOX::file::stdFileName< verboseT >::invalidate().

Referenced by MagAOX::file::stdFileName< verboseT >::invalidate().

◆ minute()

template<class verboseT >
int MagAOX::file::stdFileName< verboseT >::minute ( mx::error_t *  errc = nullptr) const

Get the current value of m_minute.

Returns
the current value of m_minute
Parameters
[in]errc[optional] error code

Definition at line 572 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ month()

template<class verboseT >
unsigned int MagAOX::file::stdFileName< verboseT >::month ( mx::error_t *  errc = nullptr) const

Get the month.

Returns
month from m_subDir
Parameters
[in]errc[optional] error code

Definition at line 512 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ nsec()

template<class verboseT >
int MagAOX::file::stdFileName< verboseT >::nsec ( mx::error_t *  errc = nullptr) const

Get the current value of m_nsec.

Returns
the current value of m_nsec
Parameters
[in]errc[optional] error code

Definition at line 612 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ operator=()

template<class verboseT >
stdFileName< verboseT > & MagAOX::file::stdFileName< verboseT >::operator= ( const std::string &  fullname)

Assignment operator from string.

Sets the full name, which is the only way to set any of the values. This parses the input and populates all fields.

On success, sets m_valid=true

On error, sets m_valid=false

Returns
a reference the this
Exceptions
nestedMagAOX::xwcException on an exception from fullName.
Parameters
[in]fullnameThe new full name of the file (including the path)

Definition at line 226 of file stdFileName.hpp.

◆ second()

template<class verboseT >
int MagAOX::file::stdFileName< verboseT >::second ( mx::error_t *  errc = nullptr) const

Get the current value of m_second.

Returns
the current value of m_second
Parameters
[in]errc[optional] error code

Definition at line 592 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ subDir()

template<class verboseT >
const stdSubDir< verboseT > & MagAOX::file::stdFileName< verboseT >::subDir ( mx::error_t *  errc = nullptr) const

Get the current value of m_subDir.

Returns
the current value of m_subDir
Parameters
[in]errc[optional] error code

Definition at line 473 of file stdFileName.hpp.

Referenced by MagAOX::logger::logMap< verboseT >::loadAppToFileMap(), libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ timestamp()

template<class verboseT >
flatlogs::timespecX MagAOX::file::stdFileName< verboseT >::timestamp ( mx::error_t *  errc = nullptr) const

Get the current value of m_valid.

Returns
the current value of m_valid
Parameters
[in]errc[optional] error code

Definition at line 632 of file stdFileName.hpp.

Referenced by MagAOX::logger::logMap< verboseT >::loadAppToFileMap(), libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

◆ valid()

◆ year()

template<class verboseT >
int MagAOX::file::stdFileName< verboseT >::year ( mx::error_t *  errc = nullptr) const

Get the year.

Returns
year() from m_subDir
Parameters
[in]errc[optional] error code

Definition at line 492 of file stdFileName.hpp.

Referenced by libXWCTest::fileTest::stdFileNameTest::TEST_CASE(), and libXWCTest::fileTest::stdFileNameTest::TEST_CASE().

Member Data Documentation

◆ m_appName

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
std::string MagAOX::file::stdFileName< verboseT >::m_appName
protected

The name of the application which wrote the file.

Definition at line 44 of file stdFileName.hpp.

◆ m_baseName

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
std::string MagAOX::file::stdFileName< verboseT >::m_baseName
protected

The base name of the file, not including path.

Definition at line 40 of file stdFileName.hpp.

◆ m_extension

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
std::string MagAOX::file::stdFileName< verboseT >::m_extension
protected

The extension of the file.

Definition at line 42 of file stdFileName.hpp.

◆ m_fullName

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
std::string MagAOX::file::stdFileName< verboseT >::m_fullName
protected

The full name of the file, including path.

Definition at line 39 of file stdFileName.hpp.

◆ m_hour

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
int MagAOX::file::stdFileName< verboseT >::m_hour { 0 }
protected

The hour of the timestamp.

Definition at line 48 of file stdFileName.hpp.

◆ m_minute

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
int MagAOX::file::stdFileName< verboseT >::m_minute { 0 }
protected

The minute of the timestamp.

Definition at line 49 of file stdFileName.hpp.

◆ m_nsec

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
int MagAOX::file::stdFileName< verboseT >::m_nsec { 0 }
protected

The nanosecond of the timestamp.

Definition at line 51 of file stdFileName.hpp.

◆ m_second

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
int MagAOX::file::stdFileName< verboseT >::m_second { 0 }
protected

The second of the timestamp.

Definition at line 50 of file stdFileName.hpp.

◆ m_subDir

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
stdSubDir<verboseT> MagAOX::file::stdFileName< verboseT >::m_subDir
protected

The subdirectory of the file.

Definition at line 46 of file stdFileName.hpp.

◆ m_timestamp

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
flatlogs::timespecX MagAOX::file::stdFileName< verboseT >::m_timestamp { 0, 0 }
protected

The timestamp.

Definition at line 53 of file stdFileName.hpp.

◆ m_valid

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
bool MagAOX::file::stdFileName< verboseT >::m_valid { false }
protected

Whether or not the filename parsed correctly and the components are valid.

Definition at line 55 of file stdFileName.hpp.


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