Namespace sh::search::criteria

namespace sh::search::criteria

Implementations of search criteria.

Subclasses of sh::search::SearchCriterion.

class AbstractActionDrivenSearchCriterion : public sh::search::SearchCriterion
#include <abstractactiondrivensearchcriterion.h>

Abstract search criterion filtering by something which is configured in a wizard-like way by an action execution.

This provides an easy yet powerful programming interface, e.g. for usage in scripting.

Subclassed by sh::scripting::api::ApiSearchCriterion

Public Functions

AbstractActionDrivenSearchCriterion(std::shared_ptr<sh::search::SearchCriterionFactory> factory)
bool match(sh::filesystem::Operation *op, std::shared_ptr<const sh::filesystem::Eurl> eurl)

Checks if a given file (by eurl) matches this criterion. .

bool match2(sh::filesystem::Operation *op, std::shared_ptr<const sh::filesystem::Eurl> eurl) = 0
QString valuedescription()

Returns a human readable text describing the current criterion shortly and precisely. .

QString serialize()

Serializes this criterion to a string. See also SearchCriterion::deserialize.

std::shared_ptr<sh::search::SearchCriterionFactory> factory()

Returns the factory this criterion has created (provides some more metadata).

Public Members

QStringList searchspec

Public Static Functions

void _createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, sh::ui::SearchPanelConfiguration *panelcfg)
void _editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
std::shared_ptr<sh::search::SearchCriterion> deserialize(QString s)

Deserializes this criterion from a string. See also SearchCriterion::serialize.

Friends

friend class ActionAbstractActionDrivenSearchCriterionConfigure
class AbstractStringSearchCriterion : public sh::search::SearchCriterion
#include <abstractstringsearchcriterion.h>

Abstract search criterion filtering by some string value (providing different modes like exact, fuzzy, regexp, …).

Subclassed by sh::search::criteria::FileContentSearchCriterion, sh::search::criteria::FilenameSearchCriterion

Public Types

enum Mode

Values:

enumerator Simple
enumerator Exact
enumerator RegExp
enumerator Fuzzy

Public Functions

AbstractStringSearchCriterion(std::shared_ptr<sh::search::SearchCriterionFactory> factory)
bool match(sh::filesystem::Operation *op, std::shared_ptr<const sh::filesystem::Eurl> eurl)

Checks if a given file (by eurl) matches this criterion. .

QString valuedescription()

Returns a human readable text describing the current criterion shortly and precisely. .

QString serialize()

Serializes this criterion to a string. See also SearchCriterion::deserialize.

std::shared_ptr<sh::search::SearchCriterionFactory> factory()

Returns the factory this criterion has created (provides some more metadata).

Public Members

QString string
Mode mode = Mode::Simple

Public Static Functions

void _createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, ui::SearchPanelConfiguration *panelcfg)
void _editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
int levenshteinSubstringDistance(QString needle, QString haystack)
double relativeLevenshteinPartsSubstringDistance(QString needle, QString haystack)
std::shared_ptr<sh::search::SearchCriterion> deserialize(QString s)

Deserializes this criterion from a string. See also SearchCriterion::serialize.

Public Static Attributes

const QStringList ModeCodes
class ActionAbstractActionDrivenSearchCriterionConfigure : public sh::actions::ActionActionItem
#include <abstractactiondrivensearchcriterion.h>

Public Functions

ActionAbstractActionDrivenSearchCriterionConfigure(std::shared_ptr<AbstractActionDrivenSearchCriterion> cfg, QMutex *mutex)
void action(sh::actions::ActionExecutionInfo *info)

The action implementation, i.e. what the actions should actually do.

void execute()

Executes this action.

void execute(sh::actions::ActionExecutionInfo *info)

Executes this action.

QKeySequence shortcuthint()

Returns the keyboard shortcut for triggering this action.

bool shortcuthintTriggersOnCurrentDirectory()

Checks if using the keyboard shortcut shall trigger the action on the current directory (or on the entry selection).

void setShortcuthint(QKeySequence shortcut, bool triggersOnCurrentDirectory = false)

Sets the keyboard shortcut for triggering this action.

QString text()

Returns the displayed text for this action.

QString icon()

Returns the icon for this action.

bool enabled()

Checks if this action is enabled.

bool isChecked()

Checks if this action is checked (has a cross in the ui).

bool isCheckable()

Checks if this action is checkable (can have a cross in the ui).

int defaultActionPrecedence() const

Returns the precedence for becoming the default action of a parent submenu.

This e.g. leads to a bold label.

The action with the highest value becomes the default. Only values >0 will be considered. See ActionDefaultPrecedenceValues for reference values.

void setText(QString text)

Sets the displayed text.

void setIcon(QString icon)

Sets the icon.

void setEnabled(bool enabled)

Sets if the item is enabled.

void setChecked(bool checked)

Sets if the item is checked (has a cross in the ui).

void setVisible(bool visible)

Sets the visibility of this item.

bool visible()

Checks the visibility of this item (non-recursively).

std::weak_ptr<AbstractActionItem> parentAction()

Returns the parent action, if it is added to a container.

void _setParentAction(std::shared_ptr<AbstractActionItem> parent)

Sets the parent action. .

void initializeAsync(std::function<void()> oninitialized = 0)

Asynchonously initializes the action.

void initializeSync()

Synchonously initializes the action.

bool isInitialized()

Checks if this action is initialized.

bool isInitializing()

Checks if this action is initializing.

Signals

void changed()

Emits when some data changed.

Private Members

std::shared_ptr<AbstractActionDrivenSearchCriterion> _cfg
QMutex *_mutex
class ExtendedAttributeSearchCriterion : public sh::search::SearchCriterion
#include <extendedattributesearchcriterion.h>

Search criterion filtering by extended attributes.

Public Types

enum Mode

Values:

enumerator None
enumerator Simple
enumerator RegExp
enumerator Fuzzy

Public Functions

ExtendedAttributeSearchCriterion(std::shared_ptr<sh::search::SearchCriterionFactory> factory)
bool match(sh::filesystem::Operation *op, std::shared_ptr<const sh::filesystem::Eurl> eurl)

Checks if a given file (by eurl) matches this criterion. .

QString valuedescription()

Returns a human readable text describing the current criterion shortly and precisely. .

QString serialize()

Serializes this criterion to a string. See also SearchCriterion::deserialize.

std::shared_ptr<sh::search::SearchCriterionFactory> factory()

Returns the factory this criterion has created (provides some more metadata).

Public Members

Mode keymode = Mode::None
Mode valuemode = Mode::Simple
QString key
QString value

Public Static Functions

void createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, sh::ui::SearchPanelConfiguration *panelcfg)
void editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
void doInitialize()
void doShutdown()
std::shared_ptr<sh::search::SearchCriterion> deserialize(QString s)

Deserializes this criterion from a string. See also SearchCriterion::serialize.

Public Static Attributes

const QStringList ModeCodes
class FileContentSearchCriterion : public sh::search::criteria::AbstractStringSearchCriterion
#include <filecontentsearchcriterion.h>

Search criterion filtering by file contents.

Public Types

enum Mode

Values:

enumerator Simple
enumerator Exact
enumerator RegExp
enumerator Fuzzy

Public Functions

FileContentSearchCriterion(std::shared_ptr<sh::search::SearchCriterionFactory> factory)
bool match(sh::filesystem::Operation *op, std::shared_ptr<const sh::filesystem::Eurl> eurl)

Checks if a given file (by eurl) matches this criterion. .

QString valuedescription()

Returns a human readable text describing the current criterion shortly and precisely. .

QString serialize()

Serializes this criterion to a string. See also SearchCriterion::deserialize.

std::shared_ptr<sh::search::SearchCriterionFactory> factory()

Returns the factory this criterion has created (provides some more metadata).

Public Members

QString string
Mode mode = Mode::Simple

Public Static Functions

void createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, sh::ui::SearchPanelConfiguration *panelcfg)
void editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
void doInitialize()
void doShutdown()
void _createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, ui::SearchPanelConfiguration *panelcfg)
void _editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
int levenshteinSubstringDistance(QString needle, QString haystack)
double relativeLevenshteinPartsSubstringDistance(QString needle, QString haystack)
std::shared_ptr<sh::search::SearchCriterion> deserialize(QString s)

Deserializes this criterion from a string. See also SearchCriterion::serialize.

Public Static Attributes

const QStringList ModeCodes
class FilenameSearchCriterion : public sh::search::criteria::AbstractStringSearchCriterion
#include <filenamesearchcriterion.h>

Search criterion filtering by file names.

Public Types

enum Mode

Values:

enumerator Simple
enumerator Exact
enumerator RegExp
enumerator Fuzzy

Public Functions

FilenameSearchCriterion(std::shared_ptr<sh::search::SearchCriterionFactory> factory)
bool match(sh::filesystem::Operation *op, std::shared_ptr<const sh::filesystem::Eurl> eurl)

Checks if a given file (by eurl) matches this criterion. .

QString valuedescription()

Returns a human readable text describing the current criterion shortly and precisely. .

QString serialize()

Serializes this criterion to a string. See also SearchCriterion::deserialize.

std::shared_ptr<sh::search::SearchCriterionFactory> factory()

Returns the factory this criterion has created (provides some more metadata).

Public Members

QString string
Mode mode = Mode::Simple

Public Static Functions

void createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, sh::ui::SearchPanelConfiguration *panelcfg)
void editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
void doInitialize()
void doShutdown()
void _createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, ui::SearchPanelConfiguration *panelcfg)
void _editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
int levenshteinSubstringDistance(QString needle, QString haystack)
double relativeLevenshteinPartsSubstringDistance(QString needle, QString haystack)
std::shared_ptr<sh::search::SearchCriterion> deserialize(QString s)

Deserializes this criterion from a string. See also SearchCriterion::serialize.

Public Static Attributes

const QStringList ModeCodes
class MtimeSearchCriterion : public sh::search::SearchCriterion
#include <mtimesearchcriterion.h>

Search criterion filtering by file modification times.

Public Functions

MtimeSearchCriterion(std::shared_ptr<sh::search::SearchCriterionFactory> factory)
bool match(sh::filesystem::Operation *op, std::shared_ptr<const sh::filesystem::Eurl> eurl)

Checks if a given file (by eurl) matches this criterion. .

QString valuedescription()

Returns a human readable text describing the current criterion shortly and precisely. .

QString serialize()

Serializes this criterion to a string. See also SearchCriterion::deserialize.

std::shared_ptr<sh::search::SearchCriterionFactory> factory()

Returns the factory this criterion has created (provides some more metadata).

Public Members

QDateTime from
QDateTime to

Public Static Functions

void createEditor(std::shared_ptr<sh::search::SearchCriterion> cfg, sh::ui::SearchPanelConfiguration *panelcfg)
void editorUpdateConfiguration(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)
void doInitialize()
void doShutdown()
std::shared_ptr<sh::search::SearchCriterion> deserialize(QString s)

Deserializes this criterion from a string. See also SearchCriterion::serialize.