Home | History | Annotate | Download | only in src
      1 #include "dmt.hpp"
      2 
      3 
      4 DmtAttributes::DmtAttributes()
      5 {
      6     m_nVersion = -1;
      7     m_nSize = -1;
      8     m_nTimestamp = -1;
      9 }
     10 
     11 DmtAttributes::DmtAttributes( CPCHAR name,
     12                                CPCHAR format,
     13                                CPCHAR title,
     14                                CPCHAR type,
     15                                INT32 version,
     16                                INT32 size,
     17                                const JemDate& timestamp,
     18                                const DmtAcl& acl)
     19 {
     20     Set(name,format,title,type,version,size,timestamp,acl);
     21 }
     22 
     23 
     24 
     25 SYNCML_DM_RET_STATUS_T DmtAttributes::Set( const DmtAttributes & oAttr )
     26 {
     27     return Set( oAttr.GetName(),
     28                 oAttr.GetFormat(),
     29                 oAttr.GetTitle(),
     30                 oAttr.GetType(),
     31                 oAttr.GetVersion(),
     32                 oAttr.GetSize(),
     33                 oAttr.GetTimestamp(),
     34                 oAttr.GetAcl());
     35 }
     36 
     37 SYNCML_DM_RET_STATUS_T DmtAttributes::Set( CPCHAR name,
     38                                 CPCHAR format,
     39                                 CPCHAR title,
     40                                 CPCHAR type,
     41                                 INT32 version,
     42                                 INT32 size,
     43                                 const JemDate& timestamp,
     44                                 const DmtAcl& acl)
     45 {
     46     m_nVersion = version;
     47     m_nSize = size;
     48     m_nTimestamp = timestamp;
     49     m_oAcl = acl;
     50 
     51     if(SetName(name) !=SYNCML_DM_SUCCESS )
     52 		return SYNCML_DM_DEVICE_FULL;
     53 
     54     if(SetFormat(format) !=SYNCML_DM_SUCCESS )
     55 			return SYNCML_DM_DEVICE_FULL;
     56 
     57     if(SetTitle(title) !=SYNCML_DM_SUCCESS )
     58 		return SYNCML_DM_DEVICE_FULL;
     59 
     60 
     61     if ( type && type[0] )
     62     {
     63         m_strType = type;
     64         if ( m_strType == NULL )
     65             return SYNCML_DM_DEVICE_FULL;
     66     }
     67     else
     68         m_strType = NULL;
     69 
     70     return SYNCML_DM_SUCCESS;
     71 
     72 }
     73 //--------------------------------------------------------------------------------------------
     74 // FUNCTION        : DmtAttributes::SetName
     75 // DESCRIPTION     : Set name of the Node
     76 // ARGUMENTS PASSED:
     77 //
     78 // RETURN VALUE    : SYNCML_DM_RET_STATUS_T : Returns SYNCML_DM_SUCCESS if success, otherwise fails
     79 //
     80 //--------------------------------------------------------------------------------------------
     81 SYNCML_DM_RET_STATUS_T DmtAttributes::SetName( CPCHAR name)
     82 {
     83     if ( name && name[0] )
     84     {
     85         m_strName = name;
     86         if ( m_strName == NULL )
     87             return SYNCML_DM_DEVICE_FULL;
     88     }
     89     else
     90         m_strName = NULL;
     91 
     92     return SYNCML_DM_SUCCESS;
     93 }
     94 //--------------------------------------------------------------------------------------------
     95 // FUNCTION        : DmtAttributes::SetFormat
     96 // DESCRIPTION     : Set format of the Node
     97 // ARGUMENTS PASSED:
     98 //
     99 // RETURN VALUE    : SYNCML_DM_RET_STATUS_T : Returns SYNCML_DM_SUCCESS if success, otherwise fails
    100 //
    101 //--------------------------------------------------------------------------------------------
    102 SYNCML_DM_RET_STATUS_T DmtAttributes::SetFormat( CPCHAR format)
    103 {
    104     if ( format && format[0] )
    105     {
    106         m_strFormat = format;
    107         if ( m_strFormat == NULL )
    108             return SYNCML_DM_DEVICE_FULL;
    109     }
    110     else
    111         m_strFormat = NULL;
    112     return SYNCML_DM_SUCCESS;
    113 }
    114 //--------------------------------------------------------------------------------------------
    115 // FUNCTION        : DmtAttributes::SetTitle
    116 // DESCRIPTION     : Set title of the Node
    117 // ARGUMENTS PASSED:
    118 //
    119 // RETURN VALUE    : SYNCML_DM_RET_STATUS_T : Returns SYNCML_DM_SUCCESS if success, otherwise fails
    120 //
    121 //--------------------------------------------------------------------------------------------
    122 SYNCML_DM_RET_STATUS_T DmtAttributes::SetTitle( CPCHAR title)
    123 {
    124     if ( title && title[0] )
    125     {
    126         m_strTitle = title;
    127         if ( m_strTitle == NULL )
    128             return SYNCML_DM_DEVICE_FULL;
    129     }
    130     else
    131         m_strTitle = NULL;
    132     return SYNCML_DM_SUCCESS;
    133 
    134 }
    135 //--------------------------------------------------------------------------------------------
    136 // FUNCTION        : DmtAttributes::SetSize
    137 // DESCRIPTION     : Set size of the Node
    138 // ARGUMENTS PASSED:
    139 //
    140 // RETURN VALUE    : None
    141 //
    142 //--------------------------------------------------------------------------------------------
    143 void DmtAttributes::SetSize( INT32 size)
    144 {
    145     m_nSize = size;
    146 }
    147 
    148