contents   index   previous   next



seGetStringEx

 

syntax:

   sebool

seGetBoolEx(secontext se,

            seobject object,

            semember member,

            int fl);

 

   senumber

seGetNumberEx(secontext se,

              seobject object,

              semember member,

              int fl);

 

   void *

seGetPointerEx(secontext se,

               seobject object,

               semember member,

               int fl);

 

   seobject

seGetObjectEx(secontext se,

              seobject object,

              semember member,

              int fl);

 

   seconstcharptr

seGetStringEx(secontext se,

              seobject object,

              semember member,

              sememcount *len,

              int fl);

where:

se the context to get the variable from

 

object the object half of an Object,Member pair

 

member the member half of an Object,Member pair

 

fl flags determining how the variable is retrieved

 

len the length of the returned data for seGetStringEx in characters

 

return:

The C value for the variable.

 

description:

These routines are a core element of the ScriptEase API. Given an Object,Member pair, these routines extract the current value as the given type, converting if necessary, and return the result. Note that the underlying variable does not change type, its value is retrieved and converted without changing the source variable. A valid return will always result from these functions. If an internal error occurs, like an illegal conversion, that error will be set up as the result of your function (see seThrow), but a valid result is still returned. The intent is that you can write a simple wrapper with no error checking that uses these routines. See the section SE_RETURN EXPLAINED in "Working with Variables" for a discussion of the implications of this behavior. The value returned if an error occurs will always be a stock value. For numbers, it is SE_NAN (or 0 for non-floating point numbers). For strings, an empty string, UNISTR(“”), is returned. For objects, SE_NOWHERE is returned. Finally, for booleans FALSE is returned.

 

The flags parameter can be any of the following |'d togethor:

 

SE_DEFAULT

 

SE_GF_NOPROTOTYPE - ignore the object's prototype when looking for the property

 

SE_GF_NOCALLBACKS - ignore the object's dynamic methods when looking for the property. It directly accesses the object's internal structure. It is intended for writing faster dynamic routines.

 

SE_GF_DIRECT - This is a bitwise OR of SE_GF_NOPROTOTYPE and SE_GF_NOCALLBACKS to ignore the object's prototype and dynamic methods when looking for the property. See the sections on DYNAMIC OBJECTS for more information on using this flag

 

SE_GF_CALL_HINT - if the member is retrieved via a dynamic get callback (on DYNAMIC OBJECTS for more information about get callbacks), then this flag will set the call_hint value to TRUE for that callback.

 

SE_GF_UNDEF_OBJ_OK - if seGetObject() is called and the property cannot be converted to an object because it is SE_TYPE_UNDEFINED or SE_TYPE_NULL, then normally an exception will be generated because these types cannot be converted to an object. With this flag set the property will stay as it is and no exception will be generated (although your returned object will be SE_NOWHERE).

 

SE_GF_COMPOUND_CREATE - This flag applies only to the SE_COMPOUND_MEM and SE_COMPOUND_UNIMEM types, or to calls to seVarParse(). This flag means that the variable is created so it always exists after the call even if it did not before the call. Any piece of the variable is likewise created, so if you refer to foo.goo and there is no variable foo, then foo is created and made an object and is given the member goo which will initially be of type SE_TYPE_UNDEFINED; but if you refer to foo.goo.zoo and there is no variable foo then foo and foo.goo are created and made objects.

 

In addition, you can specify the flags by using different named functions that have the flags as part of their name. In this case, you do not specify the flags, they are implicit. Taking seGetNumberEx as an example:

 

seGetNumber(...) = seGetNumberEx(...,SE_DEFAULT)

 

seGetDirectNumber(...) = seGetNumberEx(...,SE_GF_DIRECT)

 

The return from seGetStringEx and seGetObjectEx both follow the usual ScriptEase lifetime rules described in the Lifetimes chapter.

 

see:

None

 


seFreeObject