edbee - Qt Editor Library
dynamicvariables.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <QMultiMap>
9 #include <QSet>
10 #include <QString>
11 #include <QVariant>
12 
13 namespace edbee {
14 
15 class TextScopeList;
16 class TextScopeSelector;
17 
20 {
21 public:
22  virtual ~DynamicVariable();
23  virtual QVariant value() const = 0;
24 };
25 
26 
27 //--------------------------------
28 
29 
32 {
33 public:
34  BasicDynamicVariable( const QVariant& value );
35  virtual QVariant value() const;
36 
37 private:
38  QVariant value_;
39 };
40 
41 
42 //--------------------------------
43 
44 
47 {
48 public:
49  ScopedDynamicVariable( const QVariant& value, TextScopeSelector* selector = 0 );
50  virtual ~ScopedDynamicVariable();
51 
52  virtual double score(TextScopeList* scopes ) const;
53  TextScopeSelector* selector() const;
54 
55 private:
56  TextScopeSelector* selector_;
57 };
58 
59 
60 //--------------------------------
61 
62 
66 {
67 public:
69  virtual ~DynamicVariables();
70 
71  void setAndGiveScopedSelector(const QString& name, const QVariant& value, const QString& selector);
72  void set( const QString& name, const QVariant& value );
73 
74  int size() const;
75  int valueCount( const QString& name ) const;
76 
77  DynamicVariable* find( const QString& name, TextScopeList* scopelist );
78  QVariant value( const QString& name, TextScopeList* scopeList=0 );
79 
80 private:
81  QSet<QString> variableNames_;
82  QMap<QString, BasicDynamicVariable*> variableMap_;
83  QMultiMap<QString, ScopedDynamicVariable *> scopedVariableMap_;
84 };
85 
86 
87 } // edbee
This class is used for remembering/managing dynamic variables This are a kind of environment variable...
Definition: dynamicvariables.h:65
A class that specifies a dynamic variabele with a scope selector.
Definition: dynamicvariables.h:46
Our first version of scope-selector only support a list of scopes Thus the Descendant (space) selecto...
Definition: textdocumentscopes.h:113
A list of text-scopes. on a certian location, usually more then one scope is available on a given loc...
Definition: textdocumentscopes.h:61
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
A static dynamic variable :P.
Definition: dynamicvariables.h:31
virtual QVariant value() const =0
virtual ~DynamicVariable()
empty virtual destructor
Definition: dynamicvariables.cpp:19
The abstract base class for a dynamic variable.
Definition: dynamicvariables.h:19