Difference between revisions of "API Expand.VarName"

From Flowcode Help
Jump to navigationJump to search
(XML import API auto-gen)
(XML import)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<sidebar>API contents</sidebar>
+
<sidebar>API Contents</sidebar>
 
Expands a string to the name of a global variable used in the generated code
 
Expands a string to the name of a global variable used in the generated code
  
 +
<div style="width:25%; float:right" class="toc">
 +
====Class hierarchy====
 +
[[API Expand|Expand]]
 +
:[[API Expand|VarName]]
 +
</div>
 +
__TOC__
  
===Parameters===
+
==Parameters==
''[[Variable types|STRING]] Source''
+
[[Variable Types|STRING]] ''Source''
 
:The variable name to expand
 
:The variable name to expand
  
''[[Variable types|HANDLE]] Owner''
+
[[Variable Types|HANDLE]] ''Owner''
 
:A component that owns the variable
 
:A component that owns the variable
 
:''The default value for this parameter is: '''''this'''
 
:''The default value for this parameter is: '''''this'''
  
''[[Variable types|BOOL]] SizeName''
+
[[Variable Types|BOOL]] ''SizeName''
 
:Set true to return the expanded size define
 
:Set true to return the expanded size define
  
===Return value===
+
[[Variable Types|BOOL]] ''FullLine''
[[Variable types|STRING]]
+
:Set true to expand to a full declaration, else just the name
  
No additional information
 
  
===Detailed description===
+
==Return value==
''No additional information''
+
[[Variable Types|STRING]]
  
===Examples===
+
The global variable name as it would exist in the generated code
====Calling in a calculation====
+
 
 +
 
 +
==Detailed description==
 +
This expands a global variable to the name it would be given in the generated code. The size define (the size of the final dimension of the array) may be returned instead if required.
 +
 
 +
 
 +
Note this does not return the full expression unless ''FullLine'' is true. In this case, ''Source'' ''must'' be a valid variable name for the ''Owner'' component, as the system needs this in order to expand the variable type, array sizes and initialisers.
 +
 
 +
 
 +
This is an example of what may be shown with differing ''SizeName'' and ''FullLine'' values. The sample variable is '''TestVar''', a byte array of 16 elements.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! SizeName
 +
! FullLine
 +
! Result
 +
|-
 +
| false
 +
| false
 +
| <tt>FCV_TESTVAR</tt>
 +
|-
 +
| true
 +
| false
 +
| <tt>FCVsz_TESTVAR</tt>
 +
|-
 +
| false
 +
| true
 +
| <tt>MX_UINT8 FCV_TESTVAR[FCVsz_TESTVAR]</tt>
 +
|-
 +
| true
 +
| true
 +
| <tt>#define FCVsz_TESTVAR 16</tt>
 +
|}
 +
 
 +
 
 +
==Examples==
 +
===Calling in a calculation===
 
* Declare a variable 'result' of type STRING
 
* Declare a variable 'result' of type STRING
* Add to a calculation icon: result = ::Expand.VarName("source", owner, false)
+
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Expand.VarName("source", owner, false, true)</pre>
 +
 
 +
''<span style="color:red;">No additional examples</span>''

Latest revision as of 15:57, 16 January 2014

<sidebar>API Contents</sidebar> Expands a string to the name of a global variable used in the generated code

Class hierarchy

Expand

VarName

Parameters

STRING Source

The variable name to expand

HANDLE Owner

A component that owns the variable
The default value for this parameter is: this

BOOL SizeName

Set true to return the expanded size define

BOOL FullLine

Set true to expand to a full declaration, else just the name


Return value

STRING

The global variable name as it would exist in the generated code


Detailed description

This expands a global variable to the name it would be given in the generated code. The size define (the size of the final dimension of the array) may be returned instead if required.


Note this does not return the full expression unless FullLine is true. In this case, Source must be a valid variable name for the Owner component, as the system needs this in order to expand the variable type, array sizes and initialisers.


This is an example of what may be shown with differing SizeName and FullLine values. The sample variable is TestVar, a byte array of 16 elements.

SizeName FullLine Result
false false FCV_TESTVAR
true false FCVsz_TESTVAR
false true MX_UINT8 FCV_TESTVAR[FCVsz_TESTVAR]
true true #define FCVsz_TESTVAR 16


Examples

Calling in a calculation

  • Declare a variable 'result' of type STRING
  • Add to a calculation icon:
    result = ::Expand.VarName("source", owner, false, true)

No additional examples