SL_Variant.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Softimage 3D Games & 3D Bridge team
00004 //
00005 // (c) Copyright 2001-2002 Avid Technology, Inc. . All rights reserved.
00006 //
00007 //***************************************************************************************
00008 
00009 /****************************************************************************************
00010 THIS CODE IS PUBLISHED AS A SAMPLE ONLY AND IS PROVIDED "AS IS".
00011 IN NO EVENT SHALL SOFTIMAGE, AVID TECHNOLOGY, INC. AND/OR THEIR RESPECTIVE
00012 SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
00013 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00014 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00015 CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE .
00016 
00017 COPYRIGHT NOTICE. Copyright © 1999-2002 Avid Technology Inc. . All rights reserved. 
00018 
00019 SOFTIMAGE is a registered trademark of Avid Technology Inc. or its subsidiaries 
00020 or divisions. Windows NT is a registered trademark of Microsoft Corp. All other
00021 trademarks contained herein are the property of their respective owners. 
00022 ****************************************************************************************/
00023 
00024 
00025 #ifndef __VARIANT_H__
00026 #define __VARIANT_H__
00027 
00028 #include "SLTypes.h"
00029 //#include <memory.h>
00030 
00047 class XSIEXPORT CSLVariantProxy
00048 {
00049 public:
00051      enum EValueType
00052     {
00053         SI_SLVT_INVALID  = 0,
00054         SI_SLVT_BOOL,       
00055         SI_SLVT_BYTE,       
00056         SI_SLVT_UBYTE,      
00057         SI_SLVT_DOUBLE,     
00058         SI_SLVT_FLOAT,      
00059         SI_SLVT_INT,        
00060         SI_SLVT_LONG,       
00061         SI_SLVT_ULONG,      
00062         SI_SLVT_SHORT,      
00063         SI_SLVT_STRING      
00064     };
00065 
00074     union
00075     {
00076         CSLBoolProxy    *m_pBool;   
00077         CSLByteProxy    *m_pByte;   
00078         CSLUByteProxy   *m_pUByte;  
00079         CSLDoubleProxy  *m_pDouble; 
00080         CSLFloatProxy   *m_pFloat;  
00081         CSLIntProxy     *m_pInt;    
00082         CSLLongProxy    *m_pLong;   
00083         CSLULongProxy   *m_pULong;  
00084         CSLShortProxy   *m_pShort;  
00085         CSLStringProxy  *m_pString; 
00086     };
00087 
00092     CSLVariantProxy();
00093 
00095     ~CSLVariantProxy();
00096 
00103     SI_Error Connect( CdotXSITemplate *in_pTemplate, SI_Int in_nIndex );
00104 
00109     CSLVariantProxy( CdotXSITemplate *in_pTemplate, SI_Int in_nIndex );
00110 
00113     EValueType GetType() const;
00114 
00121     SI_Error GetValue( SI_TinyVariant &out_Variant ) const;
00122 
00130     SI_Error SetValue( const SI_TinyVariant &in_vVariant );
00131 
00139     SI_Error SetValue( const CSLVariantProxy &in_vVariant );
00140 
00147     static SI_Error TinyVarType2SLVarType( const SI_TinyVariant &in_TinyVariant, EValueType &out_Type );
00148 
00155     SI_Error GetTinyVarType( SI_Int &out_VariantType ) const;
00156 
00157 private:
00158     CSLVariantProxy(const CSLVariantProxy& );                   // @cmember  Disable Copy Constructor
00159     const CSLVariantProxy& operator=(const CSLVariantProxy );   //@cmember Disable Assignment operator
00160 
00161     void Clear();
00162     EValueType m_ValueType;
00163 };
00164 
00165 #endif //__VARIANT_H__