cpgf library documentation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
document:script-binding-using-gscriptvalue.html [2013/07/26 09:25]
qi
document:script-binding-using-gscriptvalue.html [2017/04/02 08:17] (current)
qi
Line 25: Line 25:
  
 <code cpp> <code cpp>
-static GScriptValue ​fromFundamental(const GVariant & fundamental);+static GScriptValue ​fromPrimary(const GVariant & primary);
 </​code>​ </​code>​
-Construct a GScriptValue with fundamental ​value such like an int, doubleetc. For example, "​GScriptValue::​fromFundamental(5)" will construct a GScriptValue with value 5+Construct a GScriptValue with primary ​value. A primary value is booleaninteger, float point, string, or wide string. For example, "​GScriptValue::​fromPrimary(5)" will construct a GScriptValue with value 5.
- +
-<code cpp> +
-static GScriptValue fromString(const char * s); +
-</​code>​ +
-Construct a GScriptValue with string. \\ +
-Note: s must not be freed. +
- +
-<code cpp> +
-static GScriptValue fromAndCopyString(const char * s); +
-</​code>​ +
-Construct a GScriptValue with string. The function duplicates the string, thus s can be freed.+
  
 <code cpp> <code cpp>
Line 120: Line 109:
 </​code>​ </​code>​
 Construct a GScriptValue with a script function. \\ Construct a GScriptValue with a script function. \\
 +Note: a GScriptValue with script function value can't be set to the script engine.
 +
 +<code cpp>
 +static GScriptValue fromScriptArray(IScriptArray * scriptArray);​
 +</​code>​
 +Construct a GScriptValue with a script array. \\
 Note: a GScriptValue with script function value can't be set to the script engine. Note: a GScriptValue with script function value can't be set to the script engine.
  
Line 134: Line 129:
  
 <code cpp> <code cpp>
-GVariant ​toFundamental() const;+GVariant ​toPrimary() const;
 </​code>​ </​code>​
-Get the fundamental ​value. \\+Get the primary ​value. \\
 If the value is not a fundamental,​ return GVariant(). If the value is not a fundamental,​ return GVariant().
- 
-<code cpp> 
-std::string toString() const; 
-</​code>​ 
-Get the string value. \\ 
-If the value is not a string, return std::​string(). 
  
 <code cpp> <code cpp>
Line 216: Line 205:
 Get the script function. \\ Get the script function. \\
 If the value is not script function, return NULL. \\ If the value is not script function, return NULL. \\
 +The caller must call releaseReference on the returned value.
 +
 +<code cpp>
 +IScriptArray * toScriptArray() const;
 +</​code>​
 +Get the script array. \\
 +If the value is not script arrayreturn NULL. \\
 The caller must call releaseReference on the returned value. The caller must call releaseReference on the returned value.
  
Line 223: Line 219:
 bool isNull() const; bool isNull() const;
 bool isFundamental() const; bool isFundamental() const;
-bool isString() const; 
 bool isClass() const; bool isClass() const;
 bool isObject() const; bool isObject() const;
Line 233: Line 228:
 bool isScriptObject() const; bool isScriptObject() const;
 bool isScriptFunction() const; bool isScriptFunction() const;
 +bool isScriptArray() const;
 </​code>​ </​code>​
  
Line 248: Line 244:
     enum Type {     enum Type {
         typeNull = 0,         typeNull = 0,
-        typeFundamental = 1, typeString = 2+        typeFundamental = 1, 
-        typeClass = 3, typeObject = 4+        typeClass = 2, typeObject = 3
-        typeMethod = 5, typeOverloadedMethods = 6+        typeMethod = 4, typeOverloadedMethods = 5
-        typeEnum = 7+        typeEnum = 6
-        typeRaw = 8+        typeRaw = 7
-        typeAccessible = 9,+        typeAccessible = 8,
  
-        typeScriptObject = 10, typeScriptFunction = 11,+        typeScriptObject = 9, 
 +        ​typeScriptFunction = 10, 
 +        typeScriptArray = 11
     };     };
 } }
 </​code>​ </​code>​