SL_Variant.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Crosswalk team
00004 //
00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.  
00006 // Use of this software is subject to the terms of the Autodesk license agreement 
00007 // provided at the time of installation or download, or which otherwise accompanies 
00008 // this software in either electronic or hard copy form.
00009 //
00010 //***************************************************************************************
00011 
00012 #ifndef __VARIANT_H__
00013 #define __VARIANT_H__
00014 
00015 #include "SLTypes.h"
00016 //#include <memory.h>
00017 
00034 class XSIEXPORT CSLVariantProxy
00035 {
00036 public:
00038      enum EValueType
00039     {
00040         SI_SLVT_INVALID  = 0,
00041         SI_SLVT_BOOL,       
00042         SI_SLVT_BYTE,       
00043         SI_SLVT_UBYTE,      
00044         SI_SLVT_DOUBLE,     
00045         SI_SLVT_FLOAT,      
00046         SI_SLVT_INT,        
00047         SI_SLVT_LONG,       
00048         SI_SLVT_ULONG,      
00049         SI_SLVT_SHORT,      
00050         SI_SLVT_STRING      
00051     };
00052 
00061     union
00062     {
00063         CSLBoolProxy    *m_pBool;   
00064         CSLByteProxy    *m_pByte;   
00065         CSLUByteProxy   *m_pUByte;  
00066         CSLDoubleProxy  *m_pDouble; 
00067         CSLFloatProxy   *m_pFloat;  
00068         CSLIntProxy     *m_pInt;    
00069         CSLLongProxy    *m_pLong;   
00070         CSLULongProxy   *m_pULong;  
00071         CSLShortProxy   *m_pShort;  
00072         CSLStringProxy  *m_pString; 
00073     };
00074 
00079     CSLVariantProxy();
00080 
00082     ~CSLVariantProxy();
00083 
00090     SI_Error Connect( CdotXSITemplate *in_pTemplate, SI_Int in_nIndex );
00091 
00096     CSLVariantProxy( CdotXSITemplate *in_pTemplate, SI_Int in_nIndex );
00097 
00100     EValueType GetType() const;
00101 
00108     SI_Error GetValue( SI_TinyVariant &out_Variant ) const;
00109 
00117     SI_Error SetValue( const SI_TinyVariant &in_vVariant );
00118 
00126     SI_Error SetValue( const CSLVariantProxy &in_vVariant );
00127 
00134     static SI_Error TinyVarType2SLVarType( const SI_TinyVariant &in_TinyVariant, EValueType &out_Type );
00135 
00142     SI_Error GetTinyVarType( SI_Int &out_VariantType ) const;
00143 
00144 private:
00145     CSLVariantProxy(const CSLVariantProxy& );                   // @cmember  Disable Copy Constructor
00146     const CSLVariantProxy& operator=(const CSLVariantProxy );   //@cmember Disable Assignment operator
00147 
00148     void Clear();
00149     EValueType m_ValueType;
00150 };
00151 
00152 #endif //__VARIANT_H__