File FileDescriptor.h

Copyright

This code is licensed under the 3-clause BSD license.

Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.

See LICENSE.txt for details.

namespace Scine

This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.

This header contains alias definitions defining which classes to use for the different degrees of derivatives.

namespace Utils
namespace UniversalSettings
class FileDescriptor : public Scine::Utils::UniversalSettings::SettingDescriptor
#include <FileDescriptor.h>

SettingDescriptor for a file path.

Public Types

enum FileType

Describes what kind of file the path references.

Values:

Any

Any kind of file.

Executable

An executable file (permissions set to user-executable)

Public Functions

FileDescriptor(std::string propertyDescription)

Constructor.

Parameters
  • propertyDescription: A string describing what the file path is for

std::unique_ptr<SettingDescriptor> clone() const

Create a heap-allocated base pointer copy of this instance.

Return

A heap-allocated copy of this instance

GenericValue getDefaultGenericValue() const

Creates a type-erased representation of the setting’s default value.

Return

A type-erased representation of the setting’s default value

bool validValue(const GenericValue &v) const

Checks if a particular type-erased representation of a setting is a valid value for this kind of setting.

Return

Whether the type-erased representation is a valid value for this kind of setting

Parameters
  • v: A type-erased setting representation

const std::string &getDefaultValue() const

Get the default file path.

void setDefaultValue(std::string def)

Set the default file path.

bool fileMustAlreadyExist() const

Get whether the referenced file must already exist.

void setFileMustAlreadyExist(bool b)

Set whether the referenced file must already exist.

FileDescriptor::FileType getFileType() const

Get the kind of file referenced.

void setFileType(FileType type)

Set what kind of file is referenced.

const std::vector<std::string> &getNameFilters() const

Get Qt5 name filter-compatible strings

Note

Name filters are used for the GUI only and should be compatible with the Qt syntax (see http://doc.qt.io/qt-5/qfiledialog.html#details).

void addNameFilter(std::string nameFilter)

Add a Qt5 name filter-compatible string

Note

Name filters are used for the GUI only and should be compatible with the Qt syntax (see http://doc.qt.io/qt-5/qfiledialog.html#details).

Private Members

std::string defaultValue_ = {}
std::vector<std::string> nameFilters_ = {}
bool existingFile_ = true
FileType type_ = FileType::Any