Класс CComVariantCComVariant Class
Этот класс служит оболочкой для типа VARIANT, предоставляя член, указывающий тип хранимых данных.This class wraps the VARIANT type, providing a member indicating the type of data stored.
СинтаксисSyntax
class CComVariant : public tagVARIANT
ЧленыMembers
Открытые конструкторыPublic Constructors
nameName | ОписаниеDescription |
---|---|
CComVariant:: CComVariantCComVariant::CComVariant | Конструктор.The constructor. |
CComVariant:: ~ CComVariantCComVariant::~CComVariant | ДеструкторThe destructor. |
Открытые методыPublic Methods
nameName | ОписаниеDescription |
---|---|
CComVariant:: AttachCComVariant::Attach | Присоединяет вариант к CComVariant объекту.Attaches a VARIANT to the CComVariant object. |
CComVariant:: ChangeTypeCComVariant::ChangeType | Преобразует CComVariant объект в новый тип.Converts the CComVariant object to a new type. |
CComVariant:: ClearCComVariant::Clear | Очищает CComVariant объект.Clears the CComVariant object. |
CComVariant:: CopyCComVariant::Copy | Копирует вариант в CComVariant объект.Copies a VARIANT to the CComVariant object. |
CComVariant:: CopyToCComVariant::CopyTo | Копирует содержимое CComVariant объекта.Copies the contents of the CComVariant object. |
CComVariant::D етачCComVariant::Detach | Отсоединяет базовый вариант от CComVariant объекта.Detaches the underlying VARIANT from the CComVariant object. |
CComVariant:: DataSizeCComVariant::GetSize | Возвращает размер содержимого объекта в байтах CComVariant .Returns the size in number of bytes of the contents of the CComVariant object. |
CComVariant:: РеадфромстреамCComVariant::ReadFromStream | Загружает вариант из потока.Loads a VARIANT from a stream. |
CComVariant:: СетбирефCComVariant::SetByRef | Инициализирует CComVariant объект и задает vt для элемента значение VT_BYREF.Initializes the CComVariant object and sets the vt member to VT_BYREF. |
CComVariant:: ВритетостреамCComVariant::WriteToStream | Сохраняет базовый вариант в потоке.Saves the underlying VARIANT to a stream. |
Открытые операторыPublic Operators
ОператорOperator | ОписаниеDescription |
---|---|
CComVariant:: operator <CComVariant::operator < | Указывает, CComVariant меньше ли объект, чем указанный вариант.Indicates whether the CComVariant object is less than the specified VARIANT. |
CComVariant:: operator >CComVariant::operator > | Указывает, CComVariant больше ли объект, чем указанный вариант.Indicates whether the CComVariant object is greater than the specified VARIANT. |
operator! =operator != | Указывает, CComVariant не равен ли объект указанному варианту.Indicates whether the CComVariant object does not equal the specified VARIANT. |
Оператор =operator = | Присваивает значение CComVariant объекту.Assigns a value to the CComVariant object. |
Оператор = =operator == | Указывает, CComVariant равен ли объект заданному варианту.Indicates whether the CComVariant object equals the specified VARIANT. |
КомментарииRemarks
CComVariant
заключает в оболочку тип VARIANT и VARIANTARG, состоящий из объединения и члена, указывающего тип данных, хранящихся в объединении.CComVariant
wraps the VARIANT and VARIANTARG type, which consists of a union and a member indicating the type of the data stored in the union. Варианты обычно используются в автоматизации.VARIANTs are typically used in Automation.
CComVariant
является производным от типа VARIANT, поэтому его можно использовать везде, где можно использовать вариант.CComVariant
derives from the VARIANT type so it can be used wherever a VARIANT can be used. Например, можно использовать макрос V_VT для извлечения типа CComVariant
или получить доступ к vt
члену напрямую, как это можно сделать с вариантом.You can, for example, use the V_VT macro to extract the type of a CComVariant
or you can access the vt
member directly just as you can with a VARIANT.
Иерархия наследованияInheritance Hierarchy
tagVARIANT
CComVariant
ТребованияRequirements
Заголовок: atlcomcli. hHeader: atlcomcli.h
CComVariant:: AttachCComVariant::Attach
Безопасно очищает текущее содержимое CComVariant
объекта, копирует содержимое pSrc в этот объект, а затем задает для типа variant pSrc значение VT_EMPTY.Safely clears the current contents of the CComVariant
object, copies the contents of pSrc into this object, then sets the variant type of pSrc to VT_EMPTY.
HRESULT Attach(VARIANT* pSrc);
ПараметрыParameters
pSrcpSrc
окне Указывает на вариант , который должен быть присоединен к объекту.[in] Points to the VARIANT to be attached to the object.
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.
КомментарииRemarks
Владение данными, удерживаемыми pSrc , передается в CComVariant
объект.Ownership of the data held by pSrc is transferred to the CComVariant
object.
CComVariant:: CComVariantCComVariant::CComVariant
Каждый конструктор обрабатывает надежную инициализацию CComVariant
объекта путем вызова VariantInit
функции Win32 или установки значения и типа объекта в соответствии с передаваемыми параметрами.Each constructor handles the safe initialization of the CComVariant
object by calling the VariantInit
Win32 function or by setting the object's value and type according to the parameters passed.
CComVariant() throw();
CComVariant(const CComVariant& varSrc);
CComVariant(const VARIANT& varSrc);
CComVariant(LPCOLESTR lpszSrc);
CComVariant(LPCSTR lpszSrc);
CComVariant(bool bSrc);
CComVariant(BYTE nSrc) throw();
CComVariant(int nSrc, VARTYPE vtSrc = VT_I4) throw();
CComVariant(unsigned int nSrc, VARTYPE vtSrc = VT_UI4) throw();
CComVariant(shor nSrc) throw();
CComVariant(unsigned short nSrc) throw();
CComVariant(long nSrc, VARTYPE vtSrc = VT_I4) throw();
CComVariant(unsigned long nSrc) throw();
CComVariant(LONGLONG nSrc) throw();
CComVariant(ULONGLONG nSrc) throw();
CComVariant(float fltSrc) throw();
CComVariant(double dblSrc, VARTYPE vtSrc = VT_R8) throw();
CComVariant(CY cySrc) throw();
CComVariant(IDispatch* pSrc) throw();
CComVariant(IUnknown* pSrc) throw();
CComVariant(const SAFEARRAY* pSrc);
CComVariant(char cSrc) throw();
CComVariant(const CComBSTR& bstrSrc);
ПараметрыParameters
varSrcvarSrc
окне CComVariant
Вариант или, используемый для инициализации CComVariant
объекта.[in] The CComVariant
or VARIANT used to initialize the CComVariant
object. Содержимое исходного варианта копируется в место назначения без преобразования.The contents of the source variant are copied to the destination without conversion.
лпсзсркlpszSrc
окне Символьная строка, используемая для инициализации CComVariant
объекта.[in] The character string used to initialize the CComVariant
object. В ЛПКОЛЕСТР версии конструктора или строки ANSI в версию LPCSTR можно передать строку двухбайтовых символов (Юникод), заканчивающуюся нулем.You can pass a zero-terminated wide (Unicode) character string to the LPCOLESTR version of the constructor or an ANSI string to the LPCSTR version. В любом случае строка преобразуется в Юникод BSTR, выделенный с помощью SysAllocString
.In either case the string is converted to a Unicode BSTR allocated using SysAllocString
. Тип CComVariant
объекта будет VT_BSTR.The type of the CComVariant
object will be VT_BSTR.
бсркbSrc
окне bool
Объект, используемый для инициализации CComVariant
объекта.[in] The bool
used to initialize the CComVariant
object. bool
Перед сохранением аргумент преобразуется в VARIANT_BOOL.The bool
argument is converted to a VARIANT_BOOL before being stored. Тип CComVariant
объекта будет VT_BOOL.The type of the CComVariant
object will be VT_BOOL.
нсркnSrc
окне int
short
long
unsigned short
unsigned long
unsigned int
Для инициализации объекта используются, Byte,,, лонглонг, улонглонг,, или CComVariant
.[in] The int
, BYTE, short
, long
, LONGLONG, ULONGLONG, unsigned short
, unsigned long
, or unsigned int
used to initialize the CComVariant
object. Тип CComVariant
объекта будет VT_I4, VT_UI1, VT_I2, VT_I4, VT_I8, VT_UI8, VT_UI2, VT_UI4 или VT_UI4 соответственно.The type of the CComVariant
object will be VT_I4, VT_UI1, VT_I2, VT_I4, VT_I8, VT_UI8, VT_UI2, VT_UI4, or VT_UI4, respectively.
втсркvtSrc
окне Тип варианта.[in] The type of the variant. Если первый параметр имеет значение int
, допустимые типы — VT_I4 и VT_INT.When the first parameter is int
, valid types are VT_I4 and VT_INT. Если первый параметр имеет значение long
, допустимые типы — VT_I4 и VT_ERROR.When the first parameter is long
, valid types are VT_I4 and VT_ERROR. Если первый параметр имеет значение double
, допустимые типы — VT_R8 и VT_DATE.When the first parameter is double
, valid types are VT_R8 and VT_DATE. Если первый параметр имеет значение unsigned int
, допустимые типы — VT_UI4 и VT_UINT.When the first parameter is unsigned int
, valid types are VT_UI4 and VT_UINT.
флтсркfltSrc
окне float
Объект, используемый для инициализации CComVariant
объекта.[in] The float
used to initialize the CComVariant
object. Тип CComVariant
объекта будет VT_R4.The type of the CComVariant
object will be VT_R4.
дблсркdblSrc
окне double
Объект, используемый для инициализации CComVariant
объекта.[in] The double
used to initialize the CComVariant
object. Тип CComVariant
объекта будет VT_R8.The type of the CComVariant
object will be VT_R8.
цисркcySrc
окне CY
Объект, используемый для инициализации CComVariant
объекта.[in] The CY
used to initialize the CComVariant
object. Тип CComVariant
объекта будет VT_CY.The type of the CComVariant
object will be VT_CY.
pSrcpSrc
окне IDispatch
Указатель или, IUnknown
используемый для инициализации CComVariant
объекта.[in] The IDispatch
or IUnknown
pointer used to initialize the CComVariant
object. AddRef
будет вызываться для указателя интерфейса.AddRef
will be called on the interface pointer. Тип CComVariant
объекта будет VT_DISPATCH или VT_UNKNOWN соответственно.The type of the CComVariant
object will be VT_DISPATCH or VT_UNKNOWN, respectively.
Или указатель САФЕРРАЙ, используемый для инициализации CComVariant
объекта.Or, the SAFERRAY pointer used to initialize the CComVariant
object. Копия массива SAFEARRAY хранится в CComVariant
объекте.A copy of the SAFEARRAY is stored in the CComVariant
object. Тип CComVariant
объекта будет сочетанием исходного типа массива SafeArray и VT_ARRAY.The type of the CComVariant
object will be a combination of the original type of the SAFEARRAY and VT_ARRAY.
ксркcSrc
окне char
Объект, используемый для инициализации CComVariant
объекта.[in] The char
used to initialize the CComVariant
object. Тип CComVariant
объекта будет VT_I1.The type of the CComVariant
object will be VT_I1.
бстрсркbstrSrc
окне Объект BSTR, используемый для инициализации CComVariant
объекта.[in] The BSTR used to initialize the CComVariant
object. Тип CComVariant
объекта будет VT_BSTR.The type of the CComVariant
object will be VT_BSTR.
КомментарииRemarks
Деструктор управляет очисткой, вызывая CComVariant:: Clear.The destructor manages cleanup by calling CComVariant::Clear.
CComVariant:: ~ CComVariantCComVariant::~CComVariant
ДеструкторThe destructor.
~CComVariant() throw();
КомментарииRemarks
Этот метод управляет очисткой путем вызова CComVariant:: Clear.This method manages cleanup by calling CComVariant::Clear.
CComVariant:: ChangeTypeCComVariant::ChangeType
Преобразует CComVariant
объект в новый тип.Converts the CComVariant
object to a new type.
HRESULT ChangeType(VARTYPE vtNew, const VARIANT* pSrc = NULL);
ПараметрыParameters
втневvtNew
окне Новый тип для CComVariant
объекта.[in] The new type for the CComVariant
object.
pSrcpSrc
окне Указатель на вариант, значение которого будет преобразовано в новый тип.[in] A pointer to the VARIANT whose value will be converted to the new type. Значение по умолчанию — NULL, означающее, что CComVariant
объект будет преобразован на месте.The default value is NULL, meaning the CComVariant
object will be converted in place.
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.
КомментарииRemarks
Если передать значение для pSrc, ChangeType
будет использовать этот вариант в качестве источника для преобразования.If you pass a value for pSrc, ChangeType
will use this VARIANT as the source for the conversion. В противном случае CComVariant
объект будет источником.Otherwise, the CComVariant
object will be the source.
CComVariant:: ClearCComVariant::Clear
Очищает CComVariant
объект, вызывая VariantClear
функцию Win32.Clears the CComVariant
object by calling the VariantClear
Win32 function.
HRESULT Clear();
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.
КомментарииRemarks
Деструктор автоматически вызывает Clear
.The destructor automatically calls Clear
.
CComVariant:: CopyCComVariant::Copy
Освобождает CComVariant
объект и присваивает ему копию УКАЗАННОГО варианта.Frees the CComVariant
object and then assigns it a copy of the specified VARIANT.
HRESULT Copy(const VARIANT* pSrc);
ПараметрыParameters
pSrcpSrc
окне Указатель на копируемый объект Variant .[in] A pointer to the VARIANT to be copied.
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.
CComVariant:: CopyToCComVariant::CopyTo
Копирует содержимое CComVariant
объекта.Copies the contents of the CComVariant
object.
HRESULT CopyTo(BSTR* pstrDest);
ПараметрыParameters
пстрдестpstrDest
Указывает на BSTR, который получит копию содержимого CComVariant
объекта.Points to a BSTR that will receive a copy of the contents of the CComVariant
object.
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.
КомментарииRemarks
CComVariant
Объект должен иметь тип VT_BSTR.The CComVariant
object must be of type VT_BSTR.
CComVariant::D етачCComVariant::Detach
Отсоединяет базовый вариант от CComVariant
объекта и задает для типа объекта значение VT_EMPTY.Detaches the underlying VARIANT from the CComVariant
object and sets the object's type to VT_EMPTY.
HRESULT Detach(VARIANT* pDest);
ПараметрыParameters
pDestpDest
заполняет Возвращает базовое значение типа VARIANT объекта.[out] Returns the underlying VARIANT value of the object.
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.
КомментарииRemarks
Обратите внимание, что содержимое варианта, на которое ссылается пдест , будет автоматически очищаться перед присвоением значения и типа вызывающего CComVariant
объекта.Note that the contents of the VARIANT referenced by pDest will automatically be cleared before being assigned the value and type of the calling CComVariant
object.
CComVariant:: DataSizeCComVariant::GetSize
Для типов Variant с простым фиксированным размером этот метод возвращает sizeof
значение для базового типа данных и sizeof (VarType).For simple-fixed size VARIANTs, this method returns the sizeof
value for the underlying data type plus sizeof(VARTYPE).
ULONG GetSize() const;
Возвращаемое значениеReturn Value
Размер в байтах текущего содержимого CComVariant
объекта.The size in bytes of the current contents of the CComVariant
object.
КомментарииRemarks
Если вариант содержит указатель интерфейса, GetSize
запросы для IPersistStream
или IPersistStreamInit
.If the VARIANT contains an interface pointer, GetSize
queries for IPersistStream
or IPersistStreamInit
. В случае успеха возвращаемое значение является младшим младшим значением 32, возвращаемым GetSizeMax
плюс sizeof(CLSID)
и sizeof(VARTYPE)
.If successful, the return value is the low-order 32 bits of the value returned by GetSizeMax
plus sizeof(CLSID)
and sizeof(VARTYPE)
. Если указатель интерфейса имеет значение NULL, GetSize
возвращает sizeof(CLSID)
плюс sizeof(VARTYPE)
.If the interface pointer is NULL, GetSize
returns sizeof(CLSID)
plus sizeof(VARTYPE)
. Если общий размер больше, чем ULONG_MAX, GetSize
возвращает значение, sizeof(VARTYPE)
которое указывает на ошибку.If the total size is larger than ULONG_MAX, GetSize
returns sizeof(VARTYPE)
which indicates an error.
Во всех остальных случаях временный вариант типа VT_BSTR приводится к текущему ВАРИАНТу.In all other cases, a temporary VARIANT of type VT_BSTR is coerced from the current VARIANT. Длина этой BSTR вычисляется как размер длины строки плюс длина строки, а также размер символа NULL плюс sizeof (VarType).The length of this BSTR is calculated as the size of the length of the string plus the length of the string itself plus the size of the null character plus sizeof(VARTYPE). Если вариант не может быть приведен к типу VARIANT типа VT_BSTR, функция GetSize
возвращает sizeof (VarType).If the VARIANT cannot be coerced to a VARIANT of type VT_BSTR, GetSize
returns sizeof(VARTYPE).
Размер, возвращенный этим методом, соответствует числу байтов, используемых CComVariant:: вритетостреам в условиях успешного выполнения.The size returned by this method matches the number of bytes used by CComVariant::WriteToStream under successful conditions.
CComVariant:: operator =CComVariant::operator =
Присваивает объекту значение и соответствующий тип CComVariant
.Assigns a value and corresponding type to the CComVariant
object.
CComVariant& operator=(const CComVariant& varSrc);
CComVariant& operator=(const VARIANT& varSrc);
CComVariant& operator=(const CComBSTR& bstrSrc);
CComVariant& operator=(LPCOLESTR lpszSrc);
CComVariant& operator=(LPCSTR lpszSrc);
CComVariant& operator=(bool bSrc);
CComVariant& operator=(BYTE nSrc) throw();
CComVariant& operator=int nSrc) throw();
CComVariant& operator=(unsigned int nSrc) throw();
CComVariant& operator=(short nSrc) throw();
CComVariant& operator=(unsigned short nSrc) throw();
CComVariant& operator=(long nSrc) throw();
CComVariant& operator=(unsigned long nSrc) throw();
CComVariant& operator=(LONGLONG nSrc) throw();
CComVariant& operator=(ULONGLONG nSrc) throw();
CComVariant& operator=(float fltSrc) throw();
CComVariant& operator=(double dblSrc) throw();
CComVariant& operator=(CY cySrc) throw();
CComVariant& operator=(IDispatch* pSrc) throw();
CComVariant& operator=(IUnknown* pSrc) throw();
CComVariant& operator=(const SAFEARRAY* pSrc);
CComVariant& operator=(char cSrc) throw();
ПараметрыParameters
varSrcvarSrc
окне CComVariant
Вариант или, который должен быть назначен CComVariant
объекту.[in] The CComVariant
or VARIANT to be assigned to the CComVariant
object. Содержимое исходного варианта копируется в место назначения без преобразования.The contents of the source variant are copied to the destination without conversion.
бстрсркbstrSrc
окне Значение BSTR, присваиваемое CComVariant
объекту.[in] The BSTR to be assigned to the CComVariant
object. Тип CComVariant
объекта будет VT_BSTR.The type of the CComVariant
object will be VT_BSTR.
лпсзсркlpszSrc
окне Символьная строка, назначаемая CComVariant
объекту.[in] The character string to be assigned to the CComVariant
object. В ЛПКОЛЕСТР версию оператора или строку ANSI можно передать версию LPCSTR в виде расширенной строки символов с нулевым значением (Юникод).You can pass a zero-terminated wide (Unicode) character string to the LPCOLESTR version of the operator or an ANSI string to the LPCSTR version. В любом случае строка преобразуется в Юникод BSTR, выделенный с помощью SysAllocString
.In either case, the string is converted to a Unicode BSTR allocated using SysAllocString
. Тип CComVariant
объекта будет VT_BSTR.The type of the CComVariant
object will be VT_BSTR.
бсркbSrc
окне bool
Объект, назначаемый CComVariant
объекту.[in] The bool
to be assigned to the CComVariant
object. bool
Перед сохранением аргумент преобразуется в VARIANT_BOOL.The bool
argument is converted to a VARIANT_BOOL before being stored. Тип CComVariant
объекта будет VT_BOOL.The type of the CComVariant
object will be VT_BOOL.
нсркnSrc
окне int
Объект, Byte, short
,, long
лонглонг, улонглонг, unsigned short
, unsigned long
или, unsigned int
который должен быть назначен CComVariant
объекту.[in] The int
, BYTE, short
, long
, LONGLONG, ULONGLONG, unsigned short
, unsigned long
, or unsigned int
to be assigned to the CComVariant
object. Тип CComVariant
объекта будет VT_I4, VT_UI1, VT_I2, VT_I4, VT_I8, VT_UI8, VT_UI2, VT_UI4 или VT_UI4 соответственно.The type of the CComVariant
object will be VT_I4, VT_UI1, VT_I2, VT_I4, VT_I8, VT_UI8, VT_UI2, VT_UI4, or VT_UI4, respectively.
флтсркfltSrc
окне float
Объект, назначаемый CComVariant
объекту.[in] The float
to be assigned to the CComVariant
object. Тип CComVariant
объекта будет VT_R4.The type of the CComVariant
object will be VT_R4.
дблсркdblSrc
окне double
Объект, назначаемый CComVariant
объекту.[in] The double
to be assigned to the CComVariant
object. Тип CComVariant
объекта будет VT_R8.The type of the CComVariant
object will be VT_R8.
цисркcySrc
окне CY
Объект, назначаемый CComVariant
объекту.[in] The CY
to be assigned to the CComVariant
object. Тип CComVariant
объекта будет VT_CY.The type of the CComVariant
object will be VT_CY.
pSrcpSrc
окне IDispatch
Указатель или, IUnknown
который должен быть назначен CComVariant
объекту.[in] The IDispatch
or IUnknown
pointer to be assigned to the CComVariant
object. AddRef
будет вызываться для указателя интерфейса.AddRef
will be called on the interface pointer. Тип CComVariant
объекта будет VT_DISPATCH или VT_UNKNOWN соответственно.The type of the CComVariant
object will be VT_DISPATCH or VT_UNKNOWN, respectively.
Или — указатель SAFEARRAY, назначаемый CComVariant
объекту.Or, a SAFEARRAY pointer to be assigned to the CComVariant
object. Копия массива SAFEARRAY хранится в CComVariant
объекте.A copy of the SAFEARRAY is stored in the CComVariant
object. Тип CComVariant
объекта будет сочетанием исходного типа массива SafeArray и VT_ARRAY.The type of the CComVariant
object will be a combination of the original type of the SAFEARRAY and VT_ARRAY.
ксркcSrc
окне Символ, присваиваемый CComVariant
объекту.[in] The char to be assigned to the CComVariant
object. Тип CComVariant
объекта будет VT_I1.The type of the CComVariant
object will be VT_I1.
CComVariant:: operator = =CComVariant::operator ==
Указывает, CComVariant
равен ли объект заданному варианту.Indicates whether the CComVariant
object equals the specified VARIANT.
bool operator==(const VARIANT& varSrc) const throw();
КомментарииRemarks
Возвращает значение TRUE, если значение и тип варсрк равны значению и типу, соответственно, CComVariant
объекта.Returns TRUE if the value and type of varSrc are equal to the value and type, respectively, of the CComVariant
object. В противном случае — значение FALSE.Otherwise, FALSE. Оператор использует локаль пользователя по умолчанию для выполнения сравнения.The operator uses the user's default locale to perform the comparison.
Оператор сравнивает только значения типов Variant.The operator compares only the value of the variant types. Он сравнивает строки, целые числа и плавающие точки, но не массивы или записи.It compares strings, integers, and floating points, but not arrays or records.
CComVariant:: operator! =CComVariant::operator !=
Указывает, CComVariant
не равен ли объект указанному варианту.Indicates whether the CComVariant
object does not equal the specified VARIANT.
bool operator!=(const VARIANT& varSrc) const throw();
КомментарииRemarks
Возвращает значение TRUE, если значение или тип варсрк не равны значению или типу объекта, соответственно CComVariant
.Returns TRUE if either the value or type of varSrc is not equal to the value or type, respectively, of the CComVariant
object. В противном случае — значение FALSE.Otherwise, FALSE. Оператор использует локаль пользователя по умолчанию для выполнения сравнения.The operator uses the user's default locale to perform the comparison.
Оператор сравнивает только значения типов Variant.The operator compares only the value of the variant types. Он сравнивает строки, целые числа и плавающие точки, но не массивы или записи.It compares strings, integers, and floating points, but not arrays or records.
CComVariant:: operator <CComVariant::operator <
Указывает, CComVariant
меньше ли объект, чем указанный вариант.Indicates whether the CComVariant
object is less than the specified VARIANT.
bool operator<(const VARIANT& varSrc) const throw();
КомментарииRemarks
Возвращает значение TRUE, если значение CComVariant
объекта меньше значения параметра варсрк.Returns TRUE if the value of the CComVariant
object is less than the value of varSrc. В противном случае — значение FALSE.Otherwise, FALSE. Оператор использует локаль пользователя по умолчанию для выполнения сравнения.The operator uses the user's default locale to perform the comparison.
CComVariant:: operator >CComVariant::operator >
Указывает, CComVariant
больше ли объект, чем указанный вариант.Indicates whether the CComVariant
object is greater than the specified VARIANT.
bool operator>(const VARIANT& varSrc) const throw();
КомментарииRemarks
Возвращает значение TRUE, если значение CComVariant
объекта больше значения параметра варсрк.Returns TRUE if the value of the CComVariant
object is greater than the value of varSrc. В противном случае — значение FALSE.Otherwise, FALSE. Оператор использует локаль пользователя по умолчанию для выполнения сравнения.The operator uses the user's default locale to perform the comparison.
CComVariant:: РеадфромстреамCComVariant::ReadFromStream
Задает базовый вариант для варианта, содержащегося в указанном потоке.Sets the underlying VARIANT to the VARIANT contained in the specified stream.
HRESULT ReadFromStream(IStream* pStream);
ПараметрыParameters
пстреамpStream
окне Указатель на интерфейс IStream в потоке, содержащем данные.[in] A pointer to the IStream interface on the stream containing the data.
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.
КомментарииRemarks
ReadToStream
требуется предыдущий вызов вритетостреам.ReadToStream
requires a previous call to WriteToStream.
CComVariant:: СетбирефCComVariant::SetByRef
Инициализирует CComVariant
объект и задает vt
для элемента значение VT_BYREF.Initializes the CComVariant
object and sets the vt
member to VT_BYREF.
template < typename T >
void SetByRef(T* pT) throw();
ПараметрыParameters
TT
Тип VARIANT, например BSTR, int
или char
.The type of VARIANT, for example, BSTR, int
, or char
.
ЛуторpT
Указатель, используемый для инициализации CComVariant
объекта.The pointer used to initialize the CComVariant
object.
КомментарииRemarks
SetByRef
— Это шаблон функции, который инициализирует CComVariant
объект по указателю PT и задает vt
для элемента значение VT_BYREF.SetByRef
is a function template that initializes the CComVariant
object to the pointer pT and sets the vt
member to VT_BYREF. Пример:For example:
CComVariant var;
int nData = 10;
var.SetByRef(&nData);
CComVariant:: ВритетостреамCComVariant::WriteToStream
Сохраняет базовый вариант в потоке.Saves the underlying VARIANT to a stream.
HRESULT WriteToStream(IStream* pStream);
ПараметрыParameters
пстреамpStream
окне Указатель на интерфейс IStream в потоке.[in] A pointer to the IStream interface on a stream.
Возвращаемое значениеReturn Value
Стандартное значение HRESULT.A standard HRESULT value.