VirtualBox

Changeset 6851 in vbox for trunk/include/VBox/com


Ignore:
Timestamp:
Feb 7, 2008 4:02:11 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27977
Message:

Ported r27277:27975 (array support) from branches/dmik/s2.

Location:
trunk/include/VBox/com
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/defs.h

    r6076 r6851  
    7070
    7171/**
     72 * Declares an input safearray parameter in the COM method implementation. Also
     73 * used to declare the COM attribute setter parameter. Corresponds to either of
     74 * the following XIDL definitions:
     75 * <pre>
     76 *  <param name="arg" ... dir="in" safearray="yes"/>
     77 *  ...
     78 *  <attribute name="arg" ... safearray="yes"/>
     79 * </pre>
     80 *
     81 * The method implementation should use the com::SafeArray helper class to work
     82 * with parameters declared using this define.
     83 * 
     84 * @param aType Array element type.
     85 * @param aArg  Parameter/attribute name.
     86 */
     87#define ComSafeArrayIn(aType, aArg)     SAFEARRAY **aArg
     88
     89/**
     90 * Expands to @true if the given input safearray parameter is a "null pointer"
     91 * which makes it impossible to use it for reading safearray data.
     92 */
     93#define ComSafeArrayInIsNull(aArg)      (aArg == NULL)
     94
     95/**
     96 * Wraps the given parameter name to generate an expression that is suitable for
     97 * passing the parameter to functions that take input safearray parameters
     98 * declared using the ComSafeArrayIn marco.
     99 * 
     100 * @param aArg  Parameter name to wrap. The given parameter must be declared
     101 *              within the calling function using the ComSafeArrayIn macro.
     102 */
     103#define ComSafeArrayInArg(aArg)         aArg
     104
     105/**
     106 * Declares an output safearray parameter in the COM method implementation. Also
     107 * used to declare the COM attribute getter parameter. Corresponds to either of
     108 * the following XIDL definitions:
     109 * <pre>
     110 *  <param name="arg" ... dir="out" safearray="yes"/>
     111 *  <param name="arg" ... dir="return" safearray="yes"/>
     112 *  ...
     113 *  <attribute name="arg" ... safearray="yes"/>
     114 * </pre>
     115 * 
     116 * The method implementation should use the com::SafeArray helper class to work
     117 * with parameters declared using this define.
     118 * 
     119 * @param aType Array element type.
     120 * @param aArg  Parameter/attribute name.
     121 */
     122#define ComSafeArrayOut(aType, aArg)    SAFEARRAY **aArg
     123
     124/**
     125 * Expands to @true if the given output safearray parameter is a "null pointer"
     126 * which makes it impossible to use it for returning a safearray.
     127 */
     128#define ComSafeArrayOutIsNull(aArg)     (aArg == NULL)
     129
     130/**
     131 * Wraps the given parameter name to generate an expression that is suitable for
     132 * passing the parameter to functions that take output safearray parameters
     133 * declared using the ComSafeArrayOut marco.
     134 * 
     135 * @param aArg  Parameter name to wrap. The given parameter must be declared
     136 *              within the calling function using the ComSafeArrayOut macro.
     137 */
     138#define ComSafeArrayOutArg(aArg)        aArg
     139
     140/**
    72141 *  Returns the const reference to the IID (i.e., |const GUID &|) of the given
    73142 *  interface.
     
    79148#else /* defined (RT_OS_WINDOWS) */
    80149
    81 #error "VBOX_WITH_XPCOM is not defined!"
     150#error "VBOX_WITH_XPCOM must be defined on a platform other than Windows!"
    82151
    83152#endif /* defined (RT_OS_WINDOWS) */
     
    156225/* a type for an output GUID parameter in the interface method declaration */
    157226#define GUIDPARAMOUT        nsID **
     227
     228/* safearray input parameter macros */
     229#define ComSafeArrayIn(aType, aArg)         PRUint32 aArg##Size, aType *aArg
     230#define ComSafeArrayInIsNull(aArg)          (aArg == NULL)
     231#define ComSafeArrayInArg(aArg)             aArg##Size, aArg
     232
     233/* safearray output parameter macros */
     234#define ComSafeArrayOut(aType, aArg)        PRUint32 *aArg##Size, aType **aArg
     235#define ComSafeArrayOutIsNull(aArg)         (aArg == NULL)
     236#define ComSafeArrayOutArg(aArg)            aArg##Size, aArg
    158237
    159238/* CLSID and IID for compatibility with Win32 */
  • trunk/include/VBox/com/string.h

    r6076 r6851  
    184184
    185185    /**
    186      *  Intended to assign instances to |BSTR| out parameters from within the
    187      *  interface method. Transfers the ownership of the duplicated string to
    188      *  the caller.
     186     *  Intended to assign copies of instances to |BSTR| out parameters from
     187     *  within the interface method. Transfers the ownership of the duplicated
     188     *  string to the caller.
    189189     */
    190190    const Bstr &cloneTo (BSTR *pstr) const
     
    199199
    200200    /**
    201      *  Intended to assign instances to |char *| out parameters from within the
    202      *  interface method. Transfers the ownership of the duplicated string to
    203      *  the caller.
     201     *  Intended to assign instances to |BSTR| out parameters from within the
     202     *  interface method. Transfers the ownership of the original string to the
     203     *  caller and resets the instance to null.
     204     *
     205     *  As opposed to cloneTo(), this method doesn't create a copy of the
     206     *  string.
     207     */
     208    Bstr &detachTo (BSTR *pstr)
     209    {
     210        *pstr = bstr;
     211        bstr = NULL;
     212        return *this;
     213    }
     214
     215    /**
     216     *  Intended to assign copies of instances to |char *| out parameters from
     217     *  within the interface method. Transfers the ownership of the duplicated
     218     *  string to the caller.
    204219     */
    205220    const Bstr &cloneTo (char **pstr) const;
     
    211226    BSTR *asOutParam() { setNull(); return &bstr; }
    212227
    213     /** 
     228    /**
    214229     *  Static immutable null object. May be used for comparison purposes.
    215230     */
     
    405420
    406421    /**
     422     *  Intended to assign instances to |char *| out parameters from within the
     423     *  interface method. Transfers the ownership of the original string to the
     424     *  caller and resets the instance to null.
     425     *
     426     *  As opposed to cloneTo(), this method doesn't create a copy of the
     427     *  string.
     428     */
     429    Utf8Str &detachTo (char **pstr)
     430    {
     431        *pstr = str;
     432        str = NULL;
     433        return *this;
     434    }
     435
     436    /**
    407437     *  Intended to assign instances to |BSTR| out parameters from within the
    408438     *  interface method. Transfers the ownership of the duplicated string to the
     
    425455    char **asOutParam() { setNull(); return &str; }
    426456
    427     /** 
     457    /**
    428458     *  Static immutable null object. May be used for comparison purposes.
    429459     */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette