GME  13
CoreMetaAttribute.cpp
Go to the documentation of this file.
00001 
00002 #include "stdafx.h"
00003 
00004 #include "CoreMetaObject.h"
00005 #include "CoreMetaAttribute.h"
00006 
00007 // --------------------------- CCoreMetaAttribute
00008 
00009 CCoreMetaAttribute::CCoreMetaAttribute()
00010 {
00011 }
00012 
00013 // ------- COM methods
00014 
00015 STDMETHODIMP CCoreMetaAttribute::get_Object(ICoreMetaObject **p)
00016 {
00017         CHECK_OUT(p);
00018 
00019         ASSERT( object != NULL );
00020         CopyTo(object, p);
00021         return S_OK;
00022 }
00023 
00024 STDMETHODIMP CCoreMetaAttribute::get_AttrID(attrid_type *p)
00025 {
00026         CHECK_OUT(p);
00027 
00028         ASSERT( attrid > 0 );
00029         *p = attrid;
00030         return S_OK;
00031 }
00032 
00033 STDMETHODIMP CCoreMetaAttribute::get_Token(BSTR *p)
00034 {
00035         CHECK_OUT(p);
00036 
00037         *p = SysAllocString(token.c_str());
00038         if (*p == NULL)
00039                 return E_OUTOFMEMORY;
00040         return S_OK;
00041 }
00042 
00043 STDMETHODIMP CCoreMetaAttribute::get_Name(BSTR *p)
00044 {
00045         CHECK_OUT(p);
00046 
00047         *p = SysAllocString(name.c_str());
00048         if (*p == NULL)
00049                 return E_OUTOFMEMORY;
00050         return S_OK;
00051 }
00052 
00053 STDMETHODIMP CCoreMetaAttribute::get_ValueType(valtype_type *p)
00054 {
00055         CHECK_OUT(p);
00056 
00057         ASSERT( valtype > 0 );
00058         *p = valtype;
00059         return S_OK;
00060 }
00061 
00062 STDMETHODIMP CCoreMetaAttribute::get_LockAttrID(attrid_type *p)
00063 {
00064         CHECK_OUT(p);
00065 
00066         if( valtype == VALTYPE_LOCK )
00067                 *p = ATTRID_NONE;
00068         else
00069                 *p = ATTRID_LOCK;
00070 
00071         return S_OK;
00072 }
00073 
00074 STDMETHODIMP CCoreMetaAttribute::get_MaxSize(long *p)
00075 {
00076         CHECK_OUT(p);
00077 
00078         if( valtype == VALTYPE_STRING || valtype ==VALTYPE_BINARY )
00079                 *p = 254;
00080         else
00081                 *p = 0;
00082 
00083         return S_OK;
00084 }