Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Attributes | List of all members
SysFileList Class Reference
Inheritance diagram for SysFileList:
AbcFileList

Public Types

using Timestamps = CoreArray< long >
 

Public Member Functions

 SysFileList ()
 Default constructor.
 
 SysFileList (const CoreBasicArray< CoreString > &split_files, const CoreBasicArray< CoreString > &extensions=CoreBasicArray< CoreString >(nullptr, 0))
 
 SysFileList (const CoreString &joined_files, const CoreBasicArray< CoreString > &extensions=CoreBasicArray< CoreString >(nullptr, 0))
 
 SysFileList (const SysFileList &other)
 Copy constructor.
 
 SysFileList (SysFileList &&other) noexcept
 Move constructor.
 
virtual ~SysFileList ()=default
 Destructor.
 
SysFileListoperator= (const SysFileList &other)
 Assignment operator.
 
SysFileListoperator= (SysFileList &&other) noexcept
 Move assignment operator.
 
bool operator== (const SysFileList &other) const
 
bool operator!= (const SysFileList &other) const
 
void set_files (const CoreBasicArray< CoreString > &split_files)
 
void set_files (const CoreString &joined_files)
 
const CoreVector< CoreString > & get_files () const
 
CoreString to_string () const
 
void set_extensions (const CoreBasicArray< CoreString > &extensions)
 
const CoreVector< CoreString > & get_extensions () const
 
unsigned int get_count () const
 
bool is_empty () const
 
const CoreStringget_first () const
 
void clear_files ()
 
void clear_extensions ()
 
virtual void clear ()
 
bool all_extensions_valid () const
 
bool all_files_exist () const
 
bool is_valid () const
 
Timestamps get_modification_times () const
 
bool modification_times_equal_to (const Timestamps &other_timestamps) const
 
CoreString get_errors (char separator= ';') const
 
virtual size_t get_memory_size () const
 

Static Public Attributes

static constexpr const char * list_separator = ";"
 Get the default character separator used to join strings list or split single strings to list.
 

Detailed Description

Utility class to manage a list of files and perform some checks on it.

Member Typedef Documentation

Type alias for a list of timestamp values (it facilitates using the same type everywhere). FIXME We currently use "long" to be compatible with OfAttr, but we should use "std::time_t" or "unsigned long long".

Constructor & Destructor Documentation

SysFileList::SysFileList ( const CoreBasicArray< CoreString > &  split_files,
const CoreBasicArray< CoreString > &  extensions = CoreBasicArray<CoreString>(nullptr, 0) 
)
inline

Constructor with an arrya of separate file paths. Values are trimmed, and removed if empty, but no other validations are done.

Parameters
split_fileslist of separate files
extensionslist of allowed extensions
SysFileList::SysFileList ( const CoreString joined_files,
const CoreBasicArray< CoreString > &  extensions = CoreBasicArray<CoreString>(nullptr, 0) 
)
inline

Constructor with a string of joined file paths, separated by ';'. Values are trimmed, and removed if empty, but no other validations are done.

Parameters
joined_filesstring of joined file paths
extensionslist of allowed extensions
See Also
get_separator

Member Function Documentation

bool SysFileList::all_extensions_valid ( ) const

Query if all files use a valid extension among the alloewd extensions (case-insensitive).

Returns
true if all file extensions are correct; false if the list is empty, or if 1 or more file(s) are invalid
See Also
get_extensions
bool SysFileList::all_files_exist ( ) const

Query if all files exist in the system.

Returns
true if all files exists; false if the list is empty, or if 1 or more file(s) don't exist
virtual void SysFileList::clear ( void  )
inlinevirtual

Remove all files and extensions.

Reimplemented in AbcFileList.

void SysFileList::clear_extensions ( )
inline

Remove all extensions.

void SysFileList::clear_files ( )
inline

Remove all files and makes the SysFileList empty.

unsigned int SysFileList::get_count ( ) const
inline

Get the number of files in this file list.

Returns
number of files
CoreString SysFileList::get_errors ( char  separator = ';') const

Get the SysFileList errors corresponding the current files. Useful for giving feedback to the user.

This method checks if the SysFileList is valid and returns the following errors:

  • if empty: empty file list
  • otherwise, for each invalid file:
    • invalid file extension
    • file not found
Parameters
separatorcharacter used to separate each error
Returns
an empty string if there are no errors; otherwise a single string containg multiple errors separated by the given separator
const CoreVector<CoreString>& SysFileList::get_extensions ( ) const
inline

Get the list of allowed extensions.

Returns
list of allowed extensions
const CoreVector<CoreString>& SysFileList::get_files ( ) const
inline

Get the file list as a list of separated values.

Returns
list of separated values
const CoreString& SysFileList::get_first ( ) const
inline

Get the first file. The file list must not be empty.

Returns
the first file
SysFileList::Timestamps SysFileList::get_modification_times ( ) const

Get the last file modification times of each file as a list of timestamps.

Returns
list of the last file modification times
bool SysFileList::is_empty ( void  ) const
inline

Query if the file list is empty.

Returns
true if the file list is empty; false otherwise
bool SysFileList::is_valid ( void  ) const
inline

Query if the SysFileList is valid: not empty, all file extensions are valid and all files exist.

Returns
true if valid; false otherwise
See Also
is_empty
all_extensions_valid
all_files_exist
bool SysFileList::modification_times_equal_to ( const Timestamps other_timestamps) const

Query if the given file modification timestamps are equal to the last file modification timestamps.

Parameters
other_timestampslist of file modifications timestamps to compare to
Returns
true if the number of timestamps is equal and all timestamps are equal and in the same order; false otherwise
bool SysFileList::operator!= ( const SysFileList other) const
inline

Return true of both SysFileLists are different (different number of values, or at least one different value).

Parameters
otherSysFileList to compare to
Returns
true if different; false otherwise
bool SysFileList::operator== ( const SysFileList other) const

Return true of both SysFileLists are equal (same number of values, same values and same order).

Parameters
otherSysFileList to compare to
Returns
true if equal; false otherwise
void SysFileList::set_extensions ( const CoreBasicArray< CoreString > &  extensions)
inline

Set the list of allowed extensions. All extensions are automatically stored in lower-case.

Parameters
extensionslist of extensions, can be empty
void SysFileList::set_files ( const CoreBasicArray< CoreString > &  split_files)

Set the files from a list of values. Values are trimmed, and removed if empty, but no other validations are done.

Parameters
split_fileslist of file paths.
void SysFileList::set_files ( const CoreString joined_files)

Set the files from a string of joined values. Values are trimmed, and removed if empty, but no other validations are done.

Parameters
joined_files
See Also
get_separator()
CoreString SysFileList::to_string ( void  ) const
inline

Get the file list as single string of joined values, separated by ';'.

Returns
single string of joined values