![]() |
SampleLib.cpp File ReferenceDetailed DescriptionThe sample shows how to implement an external object and to extend the JavaScript DOM, showing in particular how to use the object-oriented interface.The sample demonstrates the two mechansisms for extending the JavaScript DOM, the direct interface and the indirect (object-oriented) interface.
Direct Interface: For information on how to call the individual methods from JavaScript, see the comments for each methods or see the loadSampleLib.jsx script file that accompanies this sample.
Indirect Interface: If you are working with an installed (Release) build of Adobe Bridge CS3, then we recommend you choose the Release configuration of the shared library when testing the SampleLib. You can modify the shared library (Debug or Release) that is loaded in the loadSampleLib.jsx file itself. See the JavaScript Tools Guide for more information on the direct interface and indirect (object-oriented) interface. See SoSharedLibDefs.h for error codes and return types See SoCClient.h for the indirect (object-oriented) interface See Using the Sample Projects for information on how to build the library See Installing External Objects for information on how to install and use the library Definition in file SampleLib.cpp.
Go to the source code of this file.
Typedef Documentation
Definition at line 575 of file SampleLib.cpp.
Definition at line 574 of file SampleLib.cpp.
Function Documentation
Example of a function that returns a string. If memory has not been allocated correctly then returns an out of memory error.
Definition at line 517 of file SampleLib.cpp. References TaggedData_s::data, kESErrNoMemory, kESErrOK, kTypeString, TaggedData_s::string, TaggedData_s::type, and unused(). Referenced by objectGet().
Definition at line 246 of file SampleLib.cpp. References TaggedData_s::data, kESErrOK, kTypeScript, TaggedData_s::string, stringize(), and TaggedData_s::type.
Definition at line 841 of file SampleLib.cpp. References SoServerInterface_s::addClass, ghServer, kSoCClient_init, kSoCClient_term, and ME.
Free any string memory which has been returned as function result. JavaScipt calls this function to release the memory associated with the string. Used for the direct interface.
Definition at line 137 of file SampleLib.cpp.
Returns the version number of the library. ExtendScript publishes this number as the version property of the object created by new ExternalObject. Used by the direct interface. Definition at line 101 of file SampleLib.cpp. References libraryVersionNumber.
Initialize the library and return function signatures. These signatures have no effect on the arguments that can be passed to the functions. They are used by JavaScript to cast the arguments, and to populate the reflection interface. Definition at line 113 of file SampleLib.cpp. References signatures, and unused().
Allocate some memory. Used for the object interface.
Definition at line 151 of file SampleLib.cpp.
Terminate the library. Does any necessary clean up that is needed. Definition at line 126 of file SampleLib.cpp.
Calls a method of this object.
Definition at line 723 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::fltval, TaggedData_s::intval, kESErrBadArgumentList, kESErrOK, kESErrTypeMismatch, kTypeDouble, kTypeInteger, kTypeString, kTypeUndefined, SoCClientName_s::name_sig, TaggedData_s::string, TaggedData_s::type, and unused(). Calls when the object is released from memory.
Definition at line 812 of file SampleLib.cpp. References SoServerInterface_s::getClientData, kESErrOK, kTypeString, and SoServerInterface_s::setClientData.
Retrieves the value of a property of this object.
Definition at line 646 of file SampleLib.cpp. References built(), TaggedData_s::data, TaggedData_s::fltval, SoServerInterface_s::getClientData, TaggedData_s::intval, kESErrOK, kTypeDouble, kTypeInteger, kTypeString, SoCClientName_s::name_sig, TaggedData_s::string, and TaggedData_s::type.
Called whenever a ne object is constructed.
var myObj = new SampleObject(param1);
Definition at line 597 of file SampleLib.cpp. References myData_s::a, SoServerInterface_s::addMethods, SoServerInterface_s::addProperties, myData_s::b, kESErrOK, ME, myData_s::me, SoServerInterface_s::setClientData, SoServerInterface_s::taggedDataInit, and unused().
Sets a value of a property of this object.
Definition at line 693 of file SampleLib.cpp. References TaggedData_s::data, SoServerInterface_s::getClientData, kTypeString, SoCClientName_s::name_sig, and TaggedData_s::string.
Not used in this sample. To implement, change from NULL to objectToString in array of SoObjectInterface.
Definition at line 797 of file SampleLib.cpp. References TaggedData_s::data, SoServerInterface_s::getClientData, kESErrOK, kTypeString, TaggedData_s::string, and TaggedData_s::type.
Not used in this sample. To implement, change from NULL to objectToString in array of SoObjectInterface.
Definition at line 780 of file SampleLib.cpp. References TaggedData_s::data, SoServerInterface_s::getClientData, kESErrOK, kTypeString, TaggedData_s::string, and TaggedData_s::type.
Example of a function that takes an argument of any type. If the arguments are not correct then a bad argument error code is returned.
Definition at line 292 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::fltval, TaggedData_s::intval, kESErrBadArgumentList, kESErrNoMemory, kESErrOK, kESErrTypeMismatch, kTypeBool, kTypeDouble, kTypeInteger, kTypeString, kTypeUInteger, kTypeUndefined, TaggedData_s::string, and TaggedData_s::type.
Example of a function that takes a boolean argument. If the arguments are not correct then a bad argument error code is returned.
Definition at line 341 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::intval, kESErrBadArgumentList, kESErrOK, kESErrTypeMismatch, kTypeBool, kTypeUndefined, and TaggedData_s::type.
Example of a function that takes an 64 bit floating point argument. If the correct number of argument are not passed then a bad argument error code is returned. If the argument is not of the correct type then a data mismatch error is returned.
Definition at line 443 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::fltval, kESErrBadArgumentList, kESErrOK, kESErrTypeMismatch, kTypeDouble, kTypeUndefined, and TaggedData_s::type.
Example of a function that takes a signed integer argument. If the correct number of argument are not passed then a bad argument error code is returned. If the argument is not of the correct type then a data mismatch error is returned.
Definition at line 410 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::intval, kESErrBadArgumentList, kESErrOK, kESErrTypeMismatch, kTypeInteger, kTypeUndefined, and TaggedData_s::type.
Example of a function that takes a string argument. If the correct number of argument are not passed then a bad argument error code is returned. If the argument is not of the correct type then a data mismatch error is returned. If memory has not been allocated correctly then returns an out of memory error.
Definition at line 477 of file SampleLib.cpp. References TaggedData_s::data, kESErrBadArgumentList, kESErrNoMemory, kESErrOK, kESErrTypeMismatch, kTypeString, kTypeUndefined, TaggedData_s::string, and TaggedData_s::type.
Example of a function that takes an unsigned integer argument. If the correct number of argument are not passed then a bad argument error code is returned. If the argument is not of the correct type then a data mismatch error is returned.
Definition at line 377 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::intval, kESErrBadArgumentList, kESErrOK, kESErrTypeMismatch, kTypeUInteger, kTypeUndefined, and TaggedData_s::type.
Change the version number by setting the global "version".
myObj.setVersion(2);
Definition at line 168 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::intval, kESErrOK, and libraryVersionNumber.
Helper function to "Stringize" each argument. If the argument is not a string, convert it to a string. If it is a string, escape all quotes in the string with a backslash and quote the entire string.
Definition at line 187 of file SampleLib.cpp. References TaggedData_s::data, TaggedData_s::intval, kTypeBool, kTypeDouble, kTypeInteger, kTypeString, kTypeUInteger, kTypeUndefined, TaggedData_s::string, and TaggedData_s::type. Referenced by createArray().
Definition at line 92 of file SampleLib.cpp. Referenced by built(), ESInitialize(), objectCall(), and objectInitialize().
Variable Documentation
Array of function pointers to communiate use of the new class.
Definition at line 550 of file SampleLib.cpp.
Structure of function pointers which enable the client to call JavaScript.
Definition at line 555 of file SampleLib.cpp.
This is the version number, and can be modified by setVersion().
Definition at line 69 of file SampleLib.cpp. Referenced by ESGetVersion(), and setVersion().
Counter for instances created.
Definition at line 565 of file SampleLib.cpp. Referenced by ESClientInterface(), and objectInitialize(). Initial value: { objectInitialize , objectPut , objectGet , objectCall , NULL , NULL , objectFinalize } Provides the interface which is used by JavaScript to communicate the use of the object Definition at line 830 of file SampleLib.cpp.
Initial value: "setVersion_d," "createArray," "paramAny_a," "paramString_s," "paramBool_b," "paramUInt32_u," "paramInt32_d," "paramFloat64_f" "built" Note that this is a single comma-separated values string, concatenated by the compiler. Definition at line 77 of file SampleLib.cpp. Referenced by ESInitialize().
|
![]() |
|