summaryrefslogtreecommitdiff
path: root/qface/idl/profile.py
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen@ryannel.org>2018-03-07 18:33:15 +0100
committerJuergen Bocklage-Ryannel <juergen@ryannel.org>2018-03-07 18:33:15 +0100
commit183aeabc79e8d0791d9b6583923a3bd091663686 (patch)
tree7d86c9b5758650ae10bdb02111853be7df8e3b67 /qface/idl/profile.py
parente04a782de7161828b945b58aee12a22c0906a9f1 (diff)
parentc7b805476b038a0f60257b5ddfb8ebfc065bf62f (diff)
downloadqtivi-qface-183aeabc79e8d0791d9b6583923a3bd091663686.tar.gz
Merge branch 'feature/profile' into develop
# Conflicts: # qface/idl/profile.py
Diffstat (limited to 'qface/idl/profile.py')
-rw-r--r--qface/idl/profile.py54
1 files changed, 32 insertions, 22 deletions
diff --git a/qface/idl/profile.py b/qface/idl/profile.py
index 4b376c9..eeade91 100644
--- a/qface/idl/profile.py
+++ b/qface/idl/profile.py
@@ -1,36 +1,46 @@
# Copyright (c) Pelagicore AB 2016
+"""
+A profile is a set of features describing a qface language profile.
+The language profile tells the parser which language aspects are
+supported for the particular choosen profile.
+
+from profile import get_features, EProfile, EFeature
+
+features = get_features(EProfile.ADVANCED)
+
+if EFeature.CONST_OPERATION in features:
+ # parse this aspect of the language
+
+"""
from enum import Enum
class EFeature(Enum):
- CONST_PROPERTY = 'const_property'
+ CONST_OPERATION = 'const_operation'
EXTEND_INTERFACE = 'extend_interface'
+ IMPORT = 'import'
+ MAPS = 'maps'
class EProfile(Enum):
BASIC = 'basic'
ADVANCED = 'advanced'
- ALL = 'advanced'
-
-
-class Profile:
- def __init__(self, features=set()):
- self.features = features
-
- @staticmethod
- def get_profile(cls, name):
- if name is EProfile.BASIC:
- return Profile(features=[
- ])
- if name is EProfile.ADVANCED:
- return Profile(features=[
- EFeature.CONST_PROPERTY,
- EFeature.EXTEND_INTERFACE
- ])
- if name is EProfile.ALL:
- return Profile(features=[
- ])
- return []
+ FULL = 'full'
+
+
+_profiles = {
+ EProfile.BASIC: set(),
+ EProfile.ADVANCED: set([
+ EFeature.CONST_PROPERTY,
+ EFeature.EXTEND_INTERFACE,
+ EFeature.IMPORT,
+ EFeature.MAPS
+ ]),
+ EProfile.ALL: set(EFeature)
+}
+
+def get_features(name):
+ return _profiles.get(name, set())