Book a Demo

Author Topic: Detect if parameter is a primitive Type  (Read 3524 times)

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Detect if parameter is a primitive Type
« on: October 07, 2005, 01:57:02 am »
Hi all,

did anybody know if there is a possibity to detect, if a parameter is a primitive datatype defined in the Data Types Dialog?
bye
Andreas

thomaskilian

  • Guest
Re: Detect if parameter is a primitive Type
« Reply #1 on: October 07, 2005, 03:38:54 am »
Detect from where?

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Detect if parameter is a primitive Type
« Reply #2 on: October 07, 2005, 08:19:35 am »
Oh Sorry.  ::)

I need this information inside the code templates.
bye
Andreas

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Detect if parameter is a primitive Type
« Reply #3 on: October 10, 2005, 01:41:49 am »
Since there is no answer till now, I think there is no easy way to detect inside the code templates if a type is a primitive one.

So I decided to solve it with EXEC_ADD_IN and a little VB-AddIn.

with the following code
Code: [Select]
Function IsPrimitiveType(Repository As EA.Repository, Args As Variant) As String
Dim Result As String
Dim Arg As String
Dim MyType As Datatype

Result = "false"

Arg = Args(LBound(Args))
 
For Each MyType In Repository.Datatypes
 If MyType.Type = "Code" And MyType.Product = "C++"  Then
  If MyType.Name = Arg Or MyType.GenericType = Arg Then
   Result = "true"
  End If
 End If
Next
IsPrimitiveType = Result
End Function

It works fine, but it's a little bit slow. I hope there is an easier solution in  the future.
bye
Andreas

thomaskilian

  • Guest
Re: Detect if parameter is a primitive Type
« Reply #4 on: October 10, 2005, 02:28:58 am »
You could post a support request directly to Sparx (using their web link).

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Detect if parameter is a primitive Type
« Reply #5 on: October 10, 2005, 02:30:03 am »
good idea!  :D
bye
Andreas