edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dynamicvariables.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QMultiMap>
9#include <QSet>
10#include <QString>
11#include <QVariant>
12
13namespace edbee {
14
15class TextScopeList;
17
20public:
21 virtual ~DynamicVariable();
22 virtual QVariant value() const = 0;
23};
24
25
26//--------------------------------
27
28
31{
32public:
33 BasicDynamicVariable( const QVariant& value );
34 virtual QVariant value() const;
35
36private:
37 QVariant value_;
38};
39
40
41//--------------------------------
42
43
46{
47public:
49 virtual ~ScopedDynamicVariable();
50
51 virtual double score(TextScopeList* scopes ) const;
53
54private:
55 TextScopeSelector* selector_;
56};
57
58
59//--------------------------------
60
61
65public:
67 virtual ~DynamicVariables();
68
69 void setAndGiveScopedSelector(const QString& name, const QVariant& value, const QString& selector);
70 void set( const QString& name, const QVariant& value );
71
72 int size() const;
73 int valueCount( const QString& name ) const;
74
75 DynamicVariable* find( const QString& name, TextScopeList* scopelist );
76 QVariant value( const QString& name, TextScopeList* scopeList=0 );
77
78private:
79 QSet<QString> variableNames_;
80 QMap<QString, BasicDynamicVariable*> variableMap_;
81 QMultiMap<QString, ScopedDynamicVariable *> scopedVariableMap_;
82};
83
84
85} // edbee
BasicDynamicVariable(const QVariant &value)
Constructs a basic dynamic (read static :P ) variable.
Definition dynamicvariables.cpp:26
virtual QVariant value() const
returns value of the variable
Definition dynamicvariables.cpp:33
The abstract base class for a dynamic variable.
Definition dynamicvariables.h:19
virtual QVariant value() const =0
int size() const
Returns the number of variables available.
Definition dynamicvariables.cpp:113
void setAndGiveScopedSelector(const QString &name, const QVariant &value, const QString &selector)
defines a dynamic variable and gives to the dynamic variables environment
Definition dynamicvariables.cpp:93
QVariant value(const QString &name, TextScopeList *scopeList=0)
Returns the value at the given position.
Definition dynamicvariables.cpp:156
DynamicVariables()
default constructor
Definition dynamicvariables.cpp:76
DynamicVariable * find(const QString &name, TextScopeList *scopelist)
Finds the variable for the given condition.
Definition dynamicvariables.cpp:131
int valueCount(const QString &name) const
returns the number of variable-rules/entries available with the given name
Definition dynamicvariables.cpp:122
void set(const QString &name, const QVariant &value)
Sets the given static variable to the given value.
Definition dynamicvariables.cpp:103
TextScopeSelector * selector() const
returns the active selector
Definition dynamicvariables.cpp:67
ScopedDynamicVariable(const QVariant &value, TextScopeSelector *selector=0)
constructs a dynamic variable
Definition dynamicvariables.cpp:45
virtual double score(TextScopeList *scopes) const
returns the score for the location
Definition dynamicvariables.cpp:60
A list of text-scopes. on a certian location, usually more then one scope is available on a given loc...
Definition textdocumentscopes.h:61
Our first version of scope-selector only support a list of scopes Thus the Descendant (space) selecto...
Definition textdocumentscopes.h:112
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20