|
From: <ki...@us...> - 2003-06-16 20:39:34
|
Update of /cvsroot/pymerase/pymerase/pymerase/util
In directory sc8-pr-cvs1:/tmp/cvs-serv24942
Modified Files:
PymeraseType.py
Log Message:
added getCppTypeStr() --> good start, but needs refinement
Index: PymeraseType.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/util/PymeraseType.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PymeraseType.py 30 May 2003 00:55:39 -0000 1.15
--- PymeraseType.py 16 Jun 2003 20:39:31 -0000 1.16
***************
*** 160,163 ****
--- 160,194 ----
else:
return "None"
+
+ def getCppTypeStr(self):
+ if re.match("serial", self.type_string):
+ return "unsigned long"
+ elif re.match(".*char.*", self.type_string):
+ return "string"
+ elif re.match("text", self.type_string):
+ return "string"
+ elif re.match("name", self.type_string):
+ return "string"
+ # FIXME: Should this be a long or int?
+ elif re.match("int.*", self.type_string):
+ return "int"
+ elif re.match("float", self.type_string):
+ return "float"
+ elif re.match("double.*", self.type_string):
+ return "double"
+ elif re.match("bool", self.type_string):
+ return "bool"
+ elif re.match("datetime", self.type_string):
+ #FIXME: Should be a date time object in C++, string for now.
+ return "string"
+ elif re.match("[Ss]tring", self.type_string):
+ return "string"
+ elif re.match("Date", self.type_string) or re.match("Time", self.type_string):
+ #FIXME: Should be a date time object in C++, string for now.
+ return "string"
+ elif re.match("char", self.type_string):
+ return "char"
+ else:
+ raise NotImplementedError("Type %s is unknown" % self.type_string)
def isNativeType(self, language="python"):
|