summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcli.py2
-rwxr-xr-xcpp.py2
-rwxr-xr-xcsv.py2
-rw-r--r--examples/entertainment.tuner.Tuner.qface (renamed from examples/tuner.qif)12
-rw-r--r--examples/test.qface10
-rw-r--r--examples/vehicle.climate.ClimateControl.qface (renamed from examples/climate.qif)102
-rw-r--r--qface/__init__.py (renamed from qif/__init__.py)0
-rw-r--r--qface/generator.py (renamed from qif/generator.py)7
-rw-r--r--qface/idl/__init__.py (renamed from qif/idl/__init__.py)0
-rw-r--r--qface/idl/domain.py (renamed from qif/idl/domain.py)8
-rw-r--r--qface/idl/listener.py (renamed from qif/idl/listener.py)11
-rw-r--r--qface/idl/parser/T.tokens (renamed from qif/idl/parser/T.tokens)2
-rw-r--r--qface/idl/parser/TLexer.py161
-rw-r--r--qface/idl/parser/TLexer.tokens (renamed from qif/idl/parser/TLexer.tokens)2
-rw-r--r--qface/idl/parser/TListener.py (renamed from qif/idl/parser/TListener.py)8
-rw-r--r--qface/idl/parser/TParser.py (renamed from qif/idl/parser/TParser.py)38
-rw-r--r--qface/idl/parser/TVisitor.py (renamed from qif/idl/parser/TVisitor.py)4
-rw-r--r--qface/idl/parser/__init__.py (renamed from qif/idl/parser/__init__.py)0
-rw-r--r--qif/idl/parser/TLexer.py162
-rw-r--r--templates/service.tpl.cpp8
-rw-r--r--templates/service.tpl.h14
-rw-r--r--templates/services.pro11
-rw-r--r--tests/test_climate.py6
-rw-r--r--tests/test_generator.py6
-rw-r--r--tests/test_parser.py38
25 files changed, 322 insertions, 294 deletions
diff --git a/cli.py b/cli.py
index 0ca3d4a..978505e 100755
--- a/cli.py
+++ b/cli.py
@@ -19,7 +19,7 @@ def cli():
@cli.command()
def antlr():
- sh('antlr4 -Dlanguage=Python3 -Werror -package qif.idl.parser -o qif/idl/parser -listener -visitor T.g4')
+ sh('antlr4 -Dlanguage=Python3 -Werror -package qface.idl.parser -o qface/idl/parser -listener -visitor T.g4')
@cli.command()
diff --git a/cpp.py b/cpp.py
index 6281d36..69632a9 100755
--- a/cpp.py
+++ b/cpp.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-from qif.generator import FileSystem, Generator
+from qface.generator import FileSystem, Generator
system = FileSystem.parse_dir('./examples')
diff --git a/csv.py b/csv.py
index c0d450b..a04251d 100755
--- a/csv.py
+++ b/csv.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-from qif.generator import FileSystem, Generator
+from qface.generator import FileSystem, Generator
system = FileSystem.parse_dir('./examples')
diff --git a/examples/tuner.qif b/examples/entertainment.tuner.Tuner.qface
index 888a420..8a41c33 100644
--- a/examples/tuner.qif
+++ b/examples/entertainment.tuner.Tuner.qface
@@ -9,7 +9,7 @@ service Tuner {
/*! operation previousStation */
void previousStation();
/*! operation updateCurrentStation */
- void updateCurrentStation(int stationId);
+ void updateCurrentStation(int stationId);
}
/*! enum State */
@@ -32,10 +32,18 @@ enum Waveband {
AM=1
}
+flag Features {
+ Mono = 0x1,
+ Stereo = 0x2,
+}
+
/*! struct Station */
struct Station {
/*! member stationId */
int stationId;
/*! member name */
string name;
-}
+}
+
+
+
diff --git a/examples/test.qface b/examples/test.qface
new file mode 100644
index 0000000..fc31d2e
--- /dev/null
+++ b/examples/test.qface
@@ -0,0 +1,10 @@
+package com.pelagicore.test;
+
+service TestService {
+ int intValue;
+ readonly string stringValue;
+ bool boolValue;
+ real realValue;
+
+ void call();
+}
diff --git a/examples/climate.qif b/examples/vehicle.climate.ClimateControl.qface
index b393081..d3b6091 100644
--- a/examples/climate.qif
+++ b/examples/vehicle.climate.ClimateControl.qface
@@ -14,50 +14,25 @@ service ClimateControl {
*/
AirflowDirections airflowDirections;
/*!
- * value holds the intensity level of the fan when the climateMode
- * is set to AutoClimate, where the level can be between
- * minimumValue(least intensity) to maximumValue(most intensity).
- */
- int automaticClimateFanIntensityLevel;
- /*!
- * value holds the climate mode
- */
- ClimateMode climateMode;
- /*!
- * value is true if defrost is enabled. Usually that means that the fans
- * are on the highest level to remove ice from the windshield.
+ * value is true if the heater is enabled.
*/
- bool defrost;
+ bool heater;
/*!
* value holds the fan speed level, where the level can be between
* minimumValue(off) to maximumValue (strongest).
*/
int fanSpeedLevel;
/*!
- * value is true if the heater is enabled.
+ * value holds the steering wheel heater level, where the level can
+ * be between minimumValue(off) to maximumValue (warmest).
*/
- bool heater;
+ int steeringWheelHeater;
/*!
- * value holds the outside temperature of the zone expressed in
- * centigrades, where the temperature can be between
+ * value holds the target temperature of the zone expressed
+ * in centigrades, where the temperature can be between
* minimumValue(coolest) to maximumValue (warmest).
*/
- int outsideTemperature;
- /*!
- * value is true if the recirculation is currently running.
- */
- bool recirculation;
- /*!
- * value holds the recirculation mode
- */
- RecirculationMode recirculationMode;
- /*!
- * value holds the sensitivity level of the recirculation
- * system when the recirculationMode is set to AutoRecirculation,
- * where the level can be between minimumValue(least sensitive)
- * to maximumValue(most sensitive).
- */
- int recirculationSensitivityLevel;
+ int targetTemperature;
/*!
* value holds the seat cooler level, where the level can be
* between minimumValue(off) to maximumValue (coolest).
@@ -69,16 +44,11 @@ service ClimateControl {
*/
int seatHeater;
/*!
- * value holds the steering wheel heater level, where the level can
- * be between minimumValue(off) to maximumValue (warmest).
- */
- int steeringWheelHeater;
- /*!
- * value holds the target temperature of the zone expressed
- * in centigrades, where the temperature can be between
+ * value holds the outside temperature of the zone expressed in
+ * centigrades, where the temperature can be between
* minimumValue(coolest) to maximumValue (warmest).
*/
- int targetTemperature;
+ int outsideTemperature;
/*!
* value is true if the zone synchronization is enabled.
*
@@ -86,12 +56,48 @@ service ClimateControl {
* by the backend implementing it.
*/
bool zoneSynchronization;
+ /*!
+ * value is true if defrost is enabled. Usually that means that the fans
+ * are on the highest level to remove ice from the windshield.
+ */
+ bool defrost;
+ /*!
+ * value holds the recirculation mode
+ */
+ RecirculationMode recirculationMode;
+ /*!
+ * value is true if the recirculation is currently running.
+ */
+ bool recirculation;
+ /*!
+ * value holds the sensitivity level of the recirculation
+ * system when the recirculationMode is set to AutoRecirculation,
+ * where the level can be between minimumValue(least sensitive)
+ * to maximumValue(most sensitive).
+ */
+ int recirculationSensitivityLevel;
+ /*!
+ * value holds the climate mode
+ */
+ ClimateMode climateMode;
+ /*!
+ * value holds the intensity level of the fan when the climateMode
+ * is set to AutoClimate, where the level can be between
+ * minimumValue(least intensity) to maximumValue(most intensity).
+ */
+ int automaticClimateFanIntensityLevel;
}
-flags AirflowDirections {
- Windshield = 0x1,
- Dashboard = 0x2,
- Floor = 0x4
+flag AirflowDirection {
+ Windshield = 1,
+ Dashboard = 2,
+ Floor = 4
+}
+
+enum RecirculationMode {
+ RecirculationOff = 0x0,
+ RecirculationOn = 0x1,
+ AutoRecirculation = 0x2
}
enum ClimateMode {
@@ -100,8 +106,6 @@ enum ClimateMode {
AutoClimate = 0x2
}
-enum RecirculationMode {
- RecirculationOff = 0x0,
- RecirculationOn = 0x1,
- AutoRecirculation = 0x2
+service Extra {
+
}
diff --git a/qif/__init__.py b/qface/__init__.py
index e69de29..e69de29 100644
--- a/qif/__init__.py
+++ b/qface/__init__.py
diff --git a/qif/generator.py b/qface/generator.py
index 19b01c6..6a33986 100644
--- a/qif/generator.py
+++ b/qface/generator.py
@@ -58,7 +58,6 @@ class Generator(object):
self.env.filters[name] = callback
-
class FileSystem(object):
@staticmethod
def parse_document(path: str, system: System = None):
@@ -86,7 +85,7 @@ class FileSystem(object):
if not identifier:
identifier = 'system'
system = System()
- cache = shelve.open('qif.cache')
+ cache = shelve.open('qface.cache')
if identifier in cache and clear_cache:
del cache[identifier]
if identifier in cache:
@@ -94,7 +93,7 @@ class FileSystem(object):
system = cache[identifier]
else:
# if domain model not cached generate it
- documents = path.rglob('*.qif')
+ documents = path.rglob('*.qface')
for document in documents:
listener = DomainListener(system)
FileSystem._parse_document(document, listener)
@@ -102,7 +101,7 @@ class FileSystem(object):
return system
@staticmethod
- def find_files(path, glob='*.qif'):
+ def find_files(path, glob='*.qface'):
path = Path(path)
logging.debug('find_files path={0} glob={1}'.format(path, glob))
return path.rglob(glob)
diff --git a/qif/idl/__init__.py b/qface/idl/__init__.py
index e69de29..e69de29 100644
--- a/qif/idl/__init__.py
+++ b/qface/idl/__init__.py
diff --git a/qif/idl/domain.py b/qface/idl/domain.py
index f101599..019b466 100644
--- a/qif/idl/domain.py
+++ b/qface/idl/domain.py
@@ -107,7 +107,7 @@ class Symbol(object):
def __init__(self, name: str, package: Package):
self.name = name
self.package = package
- self.comment = None
+ self.comment = ''
@property
def system(self):
@@ -246,12 +246,14 @@ class Enum(Symbol):
def __init__(self, name: str, package: Package):
super().__init__(name, package)
log.debug('Enum()')
+ self.is_enum = True
+ self.is_flag = False
self.package.enumMap[name] = self
self.memberMap = OrderedDict() # type: Dict[EnumMember]
@property
def members(self):
- return self.memberMap
+ return self.memberMap.values()
class EnumMember(Symbol):
@@ -260,7 +262,7 @@ class EnumMember(Symbol):
log.debug('EnumMember()')
self.enum = enum
self.enum.memberMap[name] = self
- self.value = None
+ self.value = 0
class Parameter(TypedSymbol):
diff --git a/qif/idl/listener.py b/qface/idl/listener.py
index b9849d4..6b48030 100644
--- a/qif/idl/listener.py
+++ b/qface/idl/listener.py
@@ -76,12 +76,22 @@ class DomainListener(TListener):
def enterEnumSymbol(self, ctx: TParser.EnumSymbolContext):
assert self.package
name = ctx.name.text
+ # import ipdb; ipdb.set_trace()
self.enum = Enum(name, self.package)
self.parse_comment(ctx, self.enum)
def exitEnumSymbol(self, ctx: TParser.EnumSymbolContext):
self.enum = None
+ def enterEnumTypeSymbol(self, ctx: TParser.EnumTypeSymbolContext):
+ assert self.enum
+ if ctx.isFlag:
+ self.enum.is_enum = False
+ self.enum.is_flag = True
+
+ def exitEnumTypeSymbol(self, ctx: TParser.EnumTypeSymbolContext):
+ pass
+
def enterOperationSymbol(self, ctx: TParser.OperationSymbolContext):
assert self.service
name = ctx.name.text
@@ -125,6 +135,7 @@ class DomainListener(TListener):
name = ctx.name.text
self.member = EnumMember(name, self.enum)
self.member.value = int(ctx.intSymbol().value.text, 0)
+ # import ipdb; ipdb.set_trace()
def exitEnumMemberSymbol(self, ctx: TParser.EnumMemberSymbolContext):
self.member = None
diff --git a/qif/idl/parser/T.tokens b/qface/idl/parser/T.tokens
index c9d702b..e050718 100644
--- a/qif/idl/parser/T.tokens
+++ b/qface/idl/parser/T.tokens
@@ -43,5 +43,5 @@ MULTICOMM=27
'string'=16
'struct'=17
'enum'=18
-'flags'=19
+'flag'=19
'='=20
diff --git a/qface/idl/parser/TLexer.py b/qface/idl/parser/TLexer.py
new file mode 100644
index 0000000..bdf9f2d
--- /dev/null
+++ b/qface/idl/parser/TLexer.py
@@ -0,0 +1,161 @@
+# Generated from T.g4 by ANTLR 4.5.2
+from antlr4 import *
+from io import StringIO
+
+
+def serializedATN():
+ with StringIO() as buf:
+ buf.write("\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\35")
+ buf.write("\u00dc\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7")
+ buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r")
+ buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23")
+ buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30")
+ buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\3\2\3\2\3\2\3")
+ buf.write("\2\3\2\3\2\3\2\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4")
+ buf.write("\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3")
+ buf.write("\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\13\3")
+ buf.write("\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\16\3")
+ buf.write("\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20\3\20")
+ buf.write("\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22")
+ buf.write("\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\24")
+ buf.write("\3\24\3\24\3\24\3\24\3\25\3\25\3\26\5\26\u009a\n\26\3")
+ buf.write("\26\6\26\u009d\n\26\r\26\16\26\u009e\3\27\3\27\3\27\3")
+ buf.write("\27\6\27\u00a5\n\27\r\27\16\27\u00a6\3\30\3\30\7\30\u00ab")
+ buf.write("\n\30\f\30\16\30\u00ae\13\30\3\31\3\31\3\31\3\31\3\31")
+ buf.write("\7\31\u00b5\n\31\f\31\16\31\u00b8\13\31\3\31\3\31\3\31")
+ buf.write("\3\32\6\32\u00be\n\32\r\32\16\32\u00bf\3\32\3\32\3\33")
+ buf.write("\3\33\3\33\3\33\7\33\u00c8\n\33\f\33\16\33\u00cb\13\33")
+ buf.write("\3\33\3\33\3\34\3\34\3\34\3\34\7\34\u00d3\n\34\f\34\16")
+ buf.write("\34\u00d6\13\34\3\34\3\34\3\34\3\34\3\34\4\u00b6\u00d4")
+ buf.write("\2\35\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27")
+ buf.write("\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30")
+ buf.write("/\31\61\32\63\33\65\34\67\35\3\2\b\4\2--//\5\2\62;CHc")
+ buf.write("h\6\2\62;C\\aac|\b\2\60\60\62;C\\^^aac|\5\2\13\f\17\17")
+ buf.write("\"\"\4\2\f\f\17\17\u00e3\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3")
+ buf.write("\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2")
+ buf.write("\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2")
+ buf.write("\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2")
+ buf.write("!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2")
+ buf.write("\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3")
+ buf.write("\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\39\3\2\2\2\5@\3\2\2\2")
+ buf.write("\7B\3\2\2\2\tJ\3\2\2\2\13R\3\2\2\2\rT\3\2\2\2\17V\3\2")
+ buf.write("\2\2\21\\\3\2\2\2\23a\3\2\2\2\25c\3\2\2\2\27e\3\2\2\2")
+ buf.write("\31n\3\2\2\2\33p\3\2\2\2\35u\3\2\2\2\37y\3\2\2\2!~\3\2")
+ buf.write("\2\2#\u0085\3\2\2\2%\u008c\3\2\2\2\'\u0091\3\2\2\2)\u0096")
+ buf.write("\3\2\2\2+\u0099\3\2\2\2-\u00a0\3\2\2\2/\u00a8\3\2\2\2")
+ buf.write("\61\u00af\3\2\2\2\63\u00bd\3\2\2\2\65\u00c3\3\2\2\2\67")
+ buf.write("\u00ce\3\2\2\29:\7k\2\2:;\7o\2\2;<\7r\2\2<=\7q\2\2=>\7")
+ buf.write("t\2\2>?\7v\2\2?\4\3\2\2\2@A\7=\2\2A\6\3\2\2\2BC\7r\2\2")
+ buf.write("CD\7c\2\2DE\7e\2\2EF\7m\2\2FG\7c\2\2GH\7i\2\2HI\7g\2\2")
+ buf.write("I\b\3\2\2\2JK\7u\2\2KL\7g\2\2LM\7t\2\2MN\7x\2\2NO\7k\2")
+ buf.write("\2OP\7e\2\2PQ\7g\2\2Q\n\3\2\2\2RS\7}\2\2S\f\3\2\2\2TU")
+ buf.write("\7\177\2\2U\16\3\2\2\2VW\7g\2\2WX\7x\2\2XY\7g\2\2YZ\7")
+ buf.write("p\2\2Z[\7v\2\2[\20\3\2\2\2\\]\7x\2\2]^\7q\2\2^_\7k\2\2")
+ buf.write("_`\7f\2\2`\22\3\2\2\2ab\7*\2\2b\24\3\2\2\2cd\7+\2\2d\26")
+ buf.write("\3\2\2\2ef\7t\2\2fg\7g\2\2gh\7c\2\2hi\7f\2\2ij\7q\2\2")
+ buf.write("jk\7p\2\2kl\7n\2\2lm\7{\2\2m\30\3\2\2\2no\7.\2\2o\32\3")
+ buf.write("\2\2\2pq\7d\2\2qr\7q\2\2rs\7q\2\2st\7n\2\2t\34\3\2\2\2")
+ buf.write("uv\7k\2\2vw\7p\2\2wx\7v\2\2x\36\3\2\2\2yz\7t\2\2z{\7g")
+ buf.write("\2\2{|\7c\2\2|}\7n\2\2} \3\2\2\2~\177\7u\2\2\177\u0080")
+ buf.write("\7v\2\2\u0080\u0081\7t\2\2\u0081\u0082\7k\2\2\u0082\u0083")
+ buf.write("\7p\2\2\u0083\u0084\7i\2\2\u0084\"\3\2\2\2\u0085\u0086")
+ buf.write("\7u\2\2\u0086\u0087\7v\2\2\u0087\u0088\7t\2\2\u0088\u0089")
+ buf.write("\7w\2\2\u0089\u008a\7e\2\2\u008a\u008b\7v\2\2\u008b$\3")
+ buf.write("\2\2\2\u008c\u008d\7g\2\2\u008d\u008e\7p\2\2\u008e\u008f")
+ buf.write("\7w\2\2\u008f\u0090\7o\2\2\u0090&\3\2\2\2\u0091\u0092")
+ buf.write("\7h\2\2\u0092\u0093\7n\2\2\u0093\u0094\7c\2\2\u0094\u0095")
+ buf.write("\7i\2\2\u0095(\3\2\2\2\u0096\u0097\7?\2\2\u0097*\3\2\2")
+ buf.write("\2\u0098\u009a\t\2\2\2\u0099\u0098\3\2\2\2\u0099\u009a")
+ buf.write("\3\2\2\2\u009a\u009c\3\2\2\2\u009b\u009d\4\62;\2\u009c")
+ buf.write("\u009b\3\2\2\2\u009d\u009e\3\2\2\2\u009e\u009c\3\2\2\2")
+ buf.write("\u009e\u009f\3\2\2\2\u009f,\3\2\2\2\u00a0\u00a1\7\62\2")
+ buf.write("\2\u00a1\u00a2\7z\2\2\u00a2\u00a4\3\2\2\2\u00a3\u00a5")
+ buf.write("\t\3\2\2\u00a4\u00a3\3\2\2\2\u00a5\u00a6\3\2\2\2\u00a6")
+ buf.write("\u00a4\3\2\2\2\u00a6\u00a7\3\2\2\2\u00a7.\3\2\2\2\u00a8")
+ buf.write("\u00ac\t\4\2\2\u00a9\u00ab\t\5\2\2\u00aa\u00a9\3\2\2\2")
+ buf.write("\u00ab\u00ae\3\2\2\2\u00ac\u00aa\3\2\2\2\u00ac\u00ad\3")
+ buf.write("\2\2\2\u00ad\60\3\2\2\2\u00ae\u00ac\3\2\2\2\u00af\u00b0")
+ buf.write("\7\61\2\2\u00b0\u00b1\7,\2\2\u00b1\u00b2\7#\2\2\u00b2")
+ buf.write("\u00b6\3\2\2\2\u00b3\u00b5\13\2\2\2\u00b4\u00b3\3\2\2")
+ buf.write("\2\u00b5\u00b8\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b6\u00b4")
+ buf.write("\3\2\2\2\u00b7\u00b9\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b9")
+ buf.write("\u00ba\7,\2\2\u00ba\u00bb\7\61\2\2\u00bb\62\3\2\2\2\u00bc")
+ buf.write("\u00be\t\6\2\2\u00bd\u00bc\3\2\2\2\u00be\u00bf\3\2\2\2")
+ buf.write("\u00bf\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\u00c1\3")
+ buf.write("\2\2\2\u00c1\u00c2\b\32\2\2\u00c2\64\3\2\2\2\u00c3\u00c4")
+ buf.write("\7\61\2\2\u00c4\u00c5\7\61\2\2\u00c5\u00c9\3\2\2\2\u00c6")
+ buf.write("\u00c8\n\7\2\2\u00c7\u00c6\3\2\2\2\u00c8\u00cb\3\2\2\2")
+ buf.write("\u00c9\u00c7\3\2\2\2\u00c9\u00ca\3\2\2\2\u00ca\u00cc\3")
+ buf.write("\2\2\2\u00cb\u00c9\3\2\2\2\u00cc\u00cd\b\33\2\2\u00cd")
+ buf.write("\66\3\2\2\2\u00ce\u00cf\7\61\2\2\u00cf\u00d0\7,\2\2\u00d0")
+ buf.write("\u00d4\3\2\2\2\u00d1\u00d3\13\2\2\2\u00d2\u00d1\3\2\2")
+ buf.write("\2\u00d3\u00d6\3\2\2\2\u00d4\u00d5\3\2\2\2\u00d4\u00d2")
+ buf.write("\3\2\2\2\u00d5\u00d7\3\2\2\2\u00d6\u00d4\3\2\2\2\u00d7")
+ buf.write("\u00d8\7,\2\2\u00d8\u00d9\7\61\2\2\u00d9\u00da\3\2\2\2")
+ buf.write("\u00da\u00db\b\34\2\2\u00db8\3\2\2\2\13\2\u0099\u009e")
+ buf.write("\u00a6\u00ac\u00b6\u00bf\u00c9\u00d4\3\b\2\2")
+ return buf.getvalue()
+
+
+class TLexer(Lexer):
+
+ atn = ATNDeserializer().deserialize(serializedATN())
+
+ decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
+
+
+ T__0 = 1
+ T__1 = 2
+ T__2 = 3
+ T__3 = 4
+ T__4 = 5
+ T__5 = 6
+ T__6 = 7
+ T__7 = 8
+ T__8 = 9
+ T__9 = 10
+ T__10 = 11
+ T__11 = 12
+ T__12 = 13
+ T__13 = 14
+ T__14 = 15
+ T__15 = 16
+ T__16 = 17
+ T__17 = 18
+ T__18 = 19
+ T__19 = 20
+ INTCONSTANT = 21
+ HEXCONSTANT = 22
+ IDENTIFIER = 23
+ DOCCOMMENT = 24
+ WHITESPACE = 25
+ COMMENT = 26
+ MULTICOMM = 27
+
+ modeNames = [ "DEFAULT_MODE" ]
+
+ literalNames = [ "<INVALID>",
+ "'import'", "';'", "'package'", "'service'", "'{'", "'}'", "'event'",
+ "'void'", "'('", "')'", "'readonly'", "','", "'bool'", "'int'",
+ "'real'", "'string'", "'struct'", "'enum'", "'flag'", "'='" ]
+
+ symbolicNames = [ "<INVALID>",
+ "INTCONSTANT", "HEXCONSTANT", "IDENTIFIER", "DOCCOMMENT", "WHITESPACE",
+ "COMMENT", "MULTICOMM" ]
+
+ ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
+ "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
+ "T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
+ "INTCONSTANT", "HEXCONSTANT", "IDENTIFIER", "DOCCOMMENT",
+ "WHITESPACE", "COMMENT", "MULTICOMM" ]
+
+ grammarFileName = "T.g4"
+
+ def __init__(self, input=None):
+ super().__init__(input)
+ self.checkVersion("4.5.2")
+ self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
+ self._actions = None
+ self._predicates = None
+
+
diff --git a/qif/idl/parser/TLexer.tokens b/qface/idl/parser/TLexer.tokens
index c9d702b..e050718 100644
--- a/qif/idl/parser/TLexer.tokens
+++ b/qface/idl/parser/TLexer.tokens
@@ -43,5 +43,5 @@ MULTICOMM=27
'string'=16
'struct'=17
'enum'=18
-'flags'=19
+'flag'=19
'='=20
diff --git a/qif/idl/parser/TListener.py b/qface/idl/parser/TListener.py
index dd70d73..2da8b71 100644
--- a/qif/idl/parser/TListener.py
+++ b/qface/idl/parser/TListener.py
@@ -152,12 +152,12 @@ class TListener(ParseTreeListener):
pass
- # Enter a parse tree produced by TParser#enumType.
- def enterEnumType(self, ctx:TParser.EnumTypeContext):
+ # Enter a parse tree produced by TParser#enumTypeSymbol.
+ def enterEnumTypeSymbol(self, ctx:TParser.EnumTypeSymbolContext):
pass
- # Exit a parse tree produced by TParser#enumType.
- def exitEnumType(self, ctx:TParser.EnumTypeContext):
+ # Exit a parse tree produced by TParser#enumTypeSymbol.
+ def exitEnumTypeSymbol(self, ctx:TParser.EnumTypeSymbolContext):
pass
diff --git a/qif/idl/parser/TParser.py b/qface/idl/parser/TParser.py
index 6477fe4..68f3d27 100644
--- a/qif/idl/parser/TParser.py
+++ b/qface/idl/parser/TParser.py
@@ -96,7 +96,7 @@ class TParser ( Parser ):
literalNames = [ "<INVALID>", "'import'", "';'", "'package'", "'service'",
"'{'", "'}'", "'event'", "'void'", "'('", "')'", "'readonly'",
"','", "'bool'", "'int'", "'real'", "'string'", "'struct'",
- "'enum'", "'flags'", "'='" ]
+ "'enum'", "'flag'", "'='" ]
symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
"<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
@@ -122,7 +122,7 @@ class TParser ( Parser ):
RULE_structSymbol = 13
RULE_structMemberSymbol = 14
RULE_enumSymbol = 15
- RULE_enumType = 16
+ RULE_enumTypeSymbol = 16
RULE_enumMemberSymbol = 17
RULE_intSymbol = 18
@@ -130,7 +130,7 @@ class TParser ( Parser ):
"definitionSymbol", "serviceSymbol", "memberSymbol",
"operationSymbol", "attributeSymbol", "parameterSymbol",
"typeSymbol", "complexTypeSymbol", "primitiveTypeSymbol",
- "structSymbol", "structMemberSymbol", "enumSymbol", "enumType",
+ "structSymbol", "structMemberSymbol", "enumSymbol", "enumTypeSymbol",
"enumMemberSymbol", "intSymbol" ]
EOF = Token.EOF
@@ -1201,8 +1201,8 @@ class TParser ( Parser ):
self.comment = None # Token
self.name = None # Token
- def enumType(self):
- return self.getTypedRuleContext(TParser.EnumTypeContext,0)
+ def enumTypeSymbol(self):
+ return self.getTypedRuleContext(TParser.EnumTypeSymbolContext,0)
def IDENTIFIER(self):
@@ -1253,7 +1253,7 @@ class TParser ( Parser ):
self.state = 159
- self.enumType()
+ self.enumTypeSymbol()
self.state = 160
localctx.name = self.match(TParser.IDENTIFIER)
self.state = 161
@@ -1278,39 +1278,39 @@ class TParser ( Parser ):
self.exitRule()
return localctx
- class EnumTypeContext(ParserRuleContext):
+ class EnumTypeSymbolContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self.isEnum = None # Token
- self.isFlags = None # Token
+ self.isFlag = None # Token
def getRuleIndex(self):
- return TParser.RULE_enumType
+ return TParser.RULE_enumTypeSymbol
def enterRule(self, listener:ParseTreeListener):
- if hasattr( listener, "enterEnumType" ):
- listener.enterEnumType(self)
+ if hasattr( listener, "enterEnumTypeSymbol" ):
+ listener.enterEnumTypeSymbol(self)
def exitRule(self, listener:ParseTreeListener):
- if hasattr( listener, "exitEnumType" ):
- listener.exitEnumType(self)
+ if hasattr( listener, "exitEnumTypeSymbol" ):
+ listener.exitEnumTypeSymbol(self)
def accept(self, visitor:ParseTreeVisitor):
- if hasattr( visitor, "visitEnumType" ):
- return visitor.visitEnumType(self)
+ if hasattr( visitor, "visitEnumTypeSymbol" ):
+ return visitor.visitEnumTypeSymbol(self)
else:
return visitor.visitChildren(self)
- def enumType(self):
+ def enumTypeSymbol(self):
- localctx = TParser.EnumTypeContext(self, self._ctx, self.state)
- self.enterRule(localctx, 32, self.RULE_enumType)
+ localctx = TParser.EnumTypeSymbolContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 32, self.RULE_enumTypeSymbol)
try:
self.state = 172
token = self._input.LA(1)
@@ -1322,7 +1322,7 @@ class TParser ( Parser ):
elif token in [TParser.T__18]:
self.enterOuterAlt(localctx, 2)
self.state = 171
- localctx.isFlags = self.match(TParser.T__18)
+ localctx.isFlag = self.match(TParser.T__18)
else:
raise NoViableAltException(self)
diff --git a/qif/idl/parser/TVisitor.py b/qface/idl/parser/TVisitor.py
index 6ec784e..56ad882 100644
--- a/qif/idl/parser/TVisitor.py
+++ b/qface/idl/parser/TVisitor.py
@@ -89,8 +89,8 @@ class TVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
- # Visit a parse tree produced by TParser#enumType.
- def visitEnumType(self, ctx:TParser.EnumTypeContext):
+ # Visit a parse tree produced by TParser#enumTypeSymbol.
+ def visitEnumTypeSymbol(self, ctx:TParser.EnumTypeSymbolContext):
return self.visitChildren(ctx)
diff --git a/qif/idl/parser/__init__.py b/qface/idl/parser/__init__.py
index e69de29..e69de29 100644
--- a/qif/idl/parser/__init__.py
+++ b/qface/idl/parser/__init__.py
diff --git a/qif/idl/parser/TLexer.py b/qif/idl/parser/TLexer.py
deleted file mode 100644
index 8176d50..0000000
--- a/qif/idl/parser/TLexer.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# Generated from T.g4 by ANTLR 4.5.2
-from antlr4 import *
-from io import StringIO
-
-
-def serializedATN():
- with StringIO() as buf:
- buf.write("\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\35")
- buf.write("\u00dd\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7")
- buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r")
- buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23")
- buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30")
- buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\3\2\3\2\3\2\3")
- buf.write("\2\3\2\3\2\3\2\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4")
- buf.write("\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3")
- buf.write("\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\13\3")
- buf.write("\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\16\3")
- buf.write("\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20\3\20")
- buf.write("\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22")
- buf.write("\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\24")
- buf.write("\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\26\5\26\u009b\n")
- buf.write("\26\3\26\6\26\u009e\n\26\r\26\16\26\u009f\3\27\3\27\3")
- buf.write("\27\3\27\6\27\u00a6\n\27\r\27\16\27\u00a7\3\30\3\30\7")
- buf.write("\30\u00ac\n\30\f\30\16\30\u00af\13\30\3\31\3\31\3\31\3")
- buf.write("\31\3\31\7\31\u00b6\n\31\f\31\16\31\u00b9\13\31\3\31\3")
- buf.write("\31\3\31\3\32\6\32\u00bf\n\32\r\32\16\32\u00c0\3\32\3")
- buf.write("\32\3\33\3\33\3\33\3\33\7\33\u00c9\n\33\f\33\16\33\u00cc")
- buf.write("\13\33\3\33\3\33\3\34\3\34\3\34\3\34\7\34\u00d4\n\34\f")
- buf.write("\34\16\34\u00d7\13\34\3\34\3\34\3\34\3\34\3\34\4\u00b7")
- buf.write("\u00d5\2\35\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25")
- buf.write("\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+")
- buf.write("\27-\30/\31\61\32\63\33\65\34\67\35\3\2\b\4\2--//\5\2")
- buf.write("\62;CHch\6\2\62;C\\aac|\b\2\60\60\62;C\\^^aac|\5\2\13")
- buf.write("\f\17\17\"\"\4\2\f\f\17\17\u00e4\2\3\3\2\2\2\2\5\3\2\2")
- buf.write("\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2")
- buf.write("\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27")
- buf.write("\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3")
- buf.write("\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2")
- buf.write(")\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2")
- buf.write("\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\39\3\2\2\2\5")
- buf.write("@\3\2\2\2\7B\3\2\2\2\tJ\3\2\2\2\13R\3\2\2\2\rT\3\2\2\2")
- buf.write("\17V\3\2\2\2\21\\\3\2\2\2\23a\3\2\2\2\25c\3\2\2\2\27e")
- buf.write("\3\2\2\2\31n\3\2\2\2\33p\3\2\2\2\35u\3\2\2\2\37y\3\2\2")
- buf.write("\2!~\3\2\2\2#\u0085\3\2\2\2%\u008c\3\2\2\2\'\u0091\3\2")
- buf.write("\2\2)\u0097\3\2\2\2+\u009a\3\2\2\2-\u00a1\3\2\2\2/\u00a9")
- buf.write("\3\2\2\2\61\u00b0\3\2\2\2\63\u00be\3\2\2\2\65\u00c4\3")
- buf.write("\2\2\2\67\u00cf\3\2\2\29:\7k\2\2:;\7o\2\2;<\7r\2\2<=\7")
- buf.write("q\2\2=>\7t\2\2>?\7v\2\2?\4\3\2\2\2@A\7=\2\2A\6\3\2\2\2")
- buf.write("BC\7r\2\2CD\7c\2\2DE\7e\2\2EF\7m\2\2FG\7c\2\2GH\7i\2\2")
- buf.write("HI\7g\2\2I\b\3\2\2\2JK\7u\2\2KL\7g\2\2LM\7t\2\2MN\7x\2")
- buf.write("\2NO\7k\2\2OP\7e\2\2PQ\7g\2\2Q\n\3\2\2\2RS\7}\2\2S\f\3")
- buf.write("\2\2\2TU\7\177\2\2U\16\3\2\2\2VW\7g\2\2WX\7x\2\2XY\7g")
- buf.write("\2\2YZ\7p\2\2Z[\7v\2\2[\20\3\2\2\2\\]\7x\2\2]^\7q\2\2")
- buf.write("^_\7k\2\2_`\7f\2\2`\22\3\2\2\2ab\7*\2\2b\24\3\2\2\2cd")
- buf.write("\7+\2\2d\26\3\2\2\2ef\7t\2\2fg\7g\2\2gh\7c\2\2hi\7f\2")
- buf.write("\2ij\7q\2\2jk\7p\2\2kl\7n\2\2lm\7{\2\2m\30\3\2\2\2no\7")
- buf.write(".\2\2o\32\3\2\2\2pq\7d\2\2qr\7q\2\2rs\7q\2\2st\7n\2\2")
- buf.write("t\34\3\2\2\2uv\7k\2\2vw\7p\2\2wx\7v\2\2x\36\3\2\2\2yz")
- buf.write("\7t\2\2z{\7g\2\2{|\7c\2\2|}\7n\2\2} \3\2\2\2~\177\7u\2")
- buf.write("\2\177\u0080\7v\2\2\u0080\u0081\7t\2\2\u0081\u0082\7k")
- buf.write("\2\2\u0082\u0083\7p\2\2\u0083\u0084\7i\2\2\u0084\"\3\2")
- buf.write("\2\2\u0085\u0086\7u\2\2\u0086\u0087\7v\2\2\u0087\u0088")
- buf.write("\7t\2\2\u0088\u0089\7w\2\2\u0089\u008a\7e\2\2\u008a\u008b")
- buf.write("\7v\2\2\u008b$\3\2\2\2\u008c\u008d\7g\2\2\u008d\u008e")
- buf.write("\7p\2\2\u008e\u008f\7w\2\2\u008f\u0090\7o\2\2\u0090&\3")
- buf.write("\2\2\2\u0091\u0092\7h\2\2\u0092\u0093\7n\2\2\u0093\u0094")
- buf.write("\7c\2\2\u0094\u0095\7i\2\2\u0095\u0096\7u\2\2\u0096(\3")
- buf.write("\2\2\2\u0097\u0098\7?\2\2\u0098*\3\2\2\2\u0099\u009b\t")
- buf.write("\2\2\2\u009a\u0099\3\2\2\2\u009a\u009b\3\2\2\2\u009b\u009d")
- buf.write("\3\2\2\2\u009c\u009e\4\62;\2\u009d\u009c\3\2\2\2\u009e")
- buf.write("\u009f\3\2\2\2\u009f\u009d\3\2\2\2\u009f\u00a0\3\2\2\2")
- buf.write("\u00a0,\3\2\2\2\u00a1\u00a2\7\62\2\2\u00a2\u00a3\7z\2")
- buf.write("\2\u00a3\u00a5\3\2\2\2\u00a4\u00a6\t\3\2\2\u00a5\u00a4")
- buf.write("\3\2\2\2\u00a6\u00a7\3\2\2\2\u00a7\u00a5\3\2\2\2\u00a7")
- buf.write("\u00a8\3\2\2\2\u00a8.\3\2\2\2\u00a9\u00ad\t\4\2\2\u00aa")
- buf.write("\u00ac\t\5\2\2\u00ab\u00aa\3\2\2\2\u00ac\u00af\3\2\2\2")
- buf.write("\u00ad\u00ab\3\2\2\2\u00ad\u00ae\3\2\2\2\u00ae\60\3\2")
- buf.write("\2\2\u00af\u00ad\3\2\2\2\u00b0\u00b1\7\61\2\2\u00b1\u00b2")
- buf.write("\7,\2\2\u00b2\u00b3\7#\2\2\u00b3\u00b7\3\2\2\2\u00b4\u00b6")
- buf.write("\13\2\2\2\u00b5\u00b4\3\2\2\2\u00b6\u00b9\3\2\2\2\u00b7")
- buf.write("\u00b8\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b8\u00ba\3\2\2\2")
- buf.write("\u00b9\u00b7\3\2\2\2\u00ba\u00bb\7,\2\2\u00bb\u00bc\7")
- buf.write("\61\2\2\u00bc\62\3\2\2\2\u00bd\u00bf\t\6\2\2\u00be\u00bd")
- buf.write("\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\u00be\3\2\2\2\u00c0")
- buf.write("\u00c1\3\2\2\2\u00c1\u00c2\3\2\2\2\u00c2\u00c3\b\32\2")
- buf.write("\2\u00c3\64\3\2\2\2\u00c4\u00c5\7\61\2\2\u00c5\u00c6\7")
- buf.write("\61\2\2\u00c6\u00ca\3\2\2\2\u00c7\u00c9\n\7\2\2\u00c8")
- buf.write("\u00c7\3\2\2\2\u00c9\u00cc\3\2\2\2\u00ca\u00c8\3\2\2\2")
- buf.write("\u00ca\u00cb\3\2\2\2\u00cb\u00cd\3\2\2\2\u00cc\u00ca\3")
- buf.write("\2\2\2\u00cd\u00ce\b\33\2\2\u00ce\66\3\2\2\2\u00cf\u00d0")
- buf.write("\7\61\2\2\u00d0\u00d1\7,\2\2\u00d1\u00d5\3\2\2\2\u00d2")
- buf.write("\u00d4\13\2\2\2\u00d3\u00d2\3\2\2\2\u00d4\u00d7\3\2\2")
- buf.write("\2\u00d5\u00d6\3\2\2\2\u00d5\u00d3\3\2\2\2\u00d6\u00d8")
- buf.write("\3\2\2\2\u00d7\u00d5\3\2\2\2\u00d8\u00d9\7,\2\2\u00d9")
- buf.write("\u00da\7\61\2\2\u00da\u00db\3\2\2\2\u00db\u00dc\b\34\2")
- buf.write("\2\u00dc8\3\2\2\2\13\2\u009a\u009f\u00a7\u00ad\u00b7\u00c0")
- buf.write("\u00ca\u00d5\3\b\2\2")
- return buf.getvalue()
-
-
-class TLexer(Lexer):
-
- atn = ATNDeserializer().deserialize(serializedATN())
-
- decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
-
-
- T__0 = 1
- T__1 = 2
- T__2 = 3
- T__3 = 4
- T__4 = 5
- T__5 = 6
- T__6 = 7
- T__7 = 8
- T__8 = 9
- T__9 = 10
- T__10 = 11
- T__11 = 12
- T__12 = 13
- T__13 = 14
- T__14 = 15
- T__15 = 16
- T__16 = 17
- T__17 = 18
- T__18 = 19
- T__19 = 20
- INTCONSTANT = 21
- HEXCONSTANT = 22
- IDENTIFIER = 23
- DOCCOMMENT = 24
- WHITESPACE = 25
- COMMENT = 26
- MULTICOMM = 27
-
- modeNames = [ "DEFAULT_MODE" ]
-
- literalNames = [ "<INVALID>",
- "'import'", "';'", "'package'", "'service'", "'{'", "'}'", "'event'",
- "'void'", "'('", "')'", "'readonly'", "','", "'bool'", "'int'",
- "'real'", "'string'", "'struct'", "'enum'", "'flags'", "'='" ]
-
- symbolicNames = [ "<INVALID>",
- "INTCONSTANT", "HEXCONSTANT", "IDENTIFIER", "DOCCOMMENT", "WHITESPACE",
- "COMMENT", "MULTICOMM" ]
-
- ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
- "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
- "T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
- "INTCONSTANT", "HEXCONSTANT", "IDENTIFIER", "DOCCOMMENT",
- "WHITESPACE", "COMMENT", "MULTICOMM" ]
-
- grammarFileName = "T.g4"
-
- def __init__(self, input=None):
- super().__init__(input)
- self.checkVersion("4.5.2")
- self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
- self._actions = None
- self._predicates = None
-
-
diff --git a/templates/service.tpl.cpp b/templates/service.tpl.cpp
index 0f3e788..526d565 100644
--- a/templates/service.tpl.cpp
+++ b/templates/service.tpl.cpp
@@ -6,8 +6,6 @@
{%- endif -%}
{%- endmacro -%}
-# pragma once
-
#include <{{service|lower}}.h>
{{service.comment}}
@@ -21,7 +19,7 @@ void {{service}}::set{{attribute|upperfirst}}({{ attribute|parameterType }})
{
if(m_{{attribute}} == {{attribute}}) {
return;
- }
+ }
m_{{attribute}} = {{attribute}};
emit {{attribute}}Changed({{attribute}});
}
@@ -35,10 +33,8 @@ void {{service}}::set{{attribute|upperfirst}}({{ attribute|parameterType }})
{% for operation in service.operations %}
{{operation.comment}}
-virtual {{operation.type}} {{service}}::{{operation}}()
+{{operation.type}} {{service}}::{{operation}}()
{
}
{% endfor %}
-
-
diff --git a/templates/service.tpl.h b/templates/service.tpl.h
index 3867c3d..f1e4859 100644
--- a/templates/service.tpl.h
+++ b/templates/service.tpl.h
@@ -6,13 +6,18 @@ class {{service}} : public QObject
{
Q_OBJECT
{% for attribute in service.attributes %}
- Q_PROPERTY({{attribute}} READ {{attribute}} NOTIFY {{attribute}}Changed)
+ Q_PROPERTY({{attribute|returnType}} {{attribute}} READ {{attribute}} {%if not attribute.is_readonly%}WRITE set{{attribute|upperfirst}} {%endif%}NOTIFY {{attribute}}Changed)
{% endfor %}
+
public:
{{service}}(QObject *parent=0);
+
+public Q_SLOTS:
{% for operation in service.operations %}
- Q_INVOKABLE {{operation|returnType}} {{operation}}();
+ {{operation|returnType}} {{operation}}();
{% endfor %}
+
+public:
{% for attribute in service.attributes %}
void set{{attribute|upperfirst}}({{ attribute|parameterType }});
{{attribute|returnType}} {{attribute}}() const;
@@ -20,10 +25,11 @@ public:
{% endfor %}
Q_SIGNALS:
{% for attribute in service.attributes %}
- void {{attribute}}Changed({{attribute|parameterType}})
+ void {{attribute}}Changed({{attribute|parameterType}});
{% endfor %}
+
private:
{% for attribute in service.attributes %}
- m_{{attribute}};
+ {{attribute|returnType}} m_{{attribute}};
{% endfor %}
};
diff --git a/templates/services.pro b/templates/services.pro
deleted file mode 100644
index 2f71035..0000000
--- a/templates/services.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-
-SOURCES += \
-{% for service in package.services %}
- {{service|lower}}.cpp
-{% endfor %}
-
-HEADERS += \
-{% for service in package.services %}
- {{service|lower}}.h
-{% endfor %}
diff --git a/tests/test_climate.py b/tests/test_climate.py
index 5e628e4..54769e7 100644
--- a/tests/test_climate.py
+++ b/tests/test_climate.py
@@ -1,5 +1,5 @@
-from qif.idl.domain import System
-from qif.generator import FileSystem, Generator
+from qface.idl.domain import System
+from qface.generator import FileSystem, Generator
import logging
import logging.config
from pathlib import Path
@@ -14,7 +14,7 @@ log.debug('examples folder: {0}'.format(examples.absolute()))
def load_system():
- path = examples / 'climate.qif'
+ path = examples / 'vehicle.climate.ClimateControl.qface'
return FileSystem.parse_document(path)
diff --git a/tests/test_generator.py b/tests/test_generator.py
index 1f86ff2..2302eca 100644
--- a/tests/test_generator.py
+++ b/tests/test_generator.py
@@ -1,5 +1,5 @@
-from qif.idl.domain import System
-from qif.generator import FileSystem, Generator
+from qface.idl.domain import System
+from qface.generator import FileSystem, Generator
import logging
import logging.config
from pathlib import Path
@@ -14,7 +14,7 @@ log.debug('examples folder: {0}'.format(examples.absolute()))
def loadSystem():
- path = examples / 'tuner.qif'
+ path = examples / 'entertainment.tuner.Tuner.qface'
return FileSystem.parse_document(path)
diff --git a/tests/test_parser.py b/tests/test_parser.py
index b6796ee..c9610bb 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -1,5 +1,5 @@
-from qif.idl.domain import System
-from qif.generator import FileSystem
+from qface.idl.domain import System
+from qface.generator import FileSystem
import logging
import logging.config
from pathlib import Path
@@ -13,9 +13,14 @@ examples = Path('./examples')
log.debug('examples folder: {0}'.format(examples.absolute()))
+def loadTuner():
+ path = examples / 'entertainment.tuner.Tuner.qface'
+ return FileSystem.parse_document(path)
+
+
def test_parse():
log.debug('test parse')
- names = FileSystem.find_files(examples, '*.qif')
+ names = FileSystem.find_files(examples, '*.qface')
# import pdb; pdb.set_trace()
system = System()
for name in names:
@@ -24,28 +29,25 @@ def test_parse():
def test_package():
- path = examples / 'tuner.qif'
- system = FileSystem.parse_document(path)
+ system = loadTuner()
assert len(system.packages) == 1
package = system.lookup_package('entertainment.tuner')
- assert package in system.packages.values()
+ assert package in system.packages
def test_service():
- path = examples / 'tuner.qif'
- system = FileSystem.parse_document(path)
+ system = loadTuner()
package = system.lookup_package('entertainment.tuner')
service = system.lookup_service('entertainment.tuner.Tuner')
- assert service in package.services.values()
+ assert service in package.services
assert service.comment == '/*! Service Tuner */'
def test_attribute():
- path = examples / 'tuner.qif'
- system = FileSystem.parse_document(path)
+ system = loadTuner()
service = system.lookup_service('entertainment.tuner.Tuner')
package = system.lookup_package('entertainment.tuner')
- attr = service.attributes['currentStation']
+ attr = service.attributeMap['currentStation']
assert attr.type.name == 'Station'
assert attr.package == package
assert attr.type.qualifiedName == 'entertainment.tuner.Station'
@@ -53,10 +55,8 @@ def test_attribute():
assert attr.comment == '/*! attribute currentStation */'
-
def test_struct():
- path = examples / 'tuner.qif'
- system = FileSystem.parse_document(path)
+ system = loadTuner()
package = system.lookup_package('entertainment.tuner')
symbol = system.lookup_struct('entertainment.tuner.Station')
assert symbol.name == 'Station'
@@ -66,8 +66,7 @@ def test_struct():
def test_enum():
- path = examples / 'tuner.qif'
- system = FileSystem.parse_document(path)
+ system = loadTuner()
definition = system.lookup_definition('entertainment.tuner.Waveband')
package = system.lookup_package('entertainment.tuner')
symbol = system.lookup_enum('entertainment.tuner.Waveband')
@@ -76,6 +75,11 @@ def test_enum():
assert symbol.package == package
assert symbol.qualifiedName == 'entertainment.tuner.Waveband'
assert symbol.comment == '/*! enum Waveband */'
+ assert symbol.is_enum
+def test_flag():
+ system = loadTuner()
+ symbol = system.lookup_enum('entertainment.tuner.Features')
+ assert symbol.is_flag