syncmlfw/ds/dsutils/dbcaps/src/NSmlDevInfProp.cpp
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Source for CNSmlDevInfProp class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <badesca.h>
       
    21 
       
    22 #include <nsmldebug.h>
       
    23 #include "nsmldbcaps.h"
       
    24 #include "smldevinfdtd.h"
       
    25 #include "smlmetinfdtd.h"
       
    26 #include "smldevinftags.h"
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CNSmlDevInfProp::CNSmlDevInfProp
       
    33 // Constructor.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C CNSmlDevInfProp::CNSmlDevInfProp( SmlDevInfPropertyPtr_t aPropPtr )
       
    37  : iPropPtr(aPropPtr)
       
    38 	{
       
    39 	//_DBG_FILE("CNSmlDevInfProp::CNSmlDevInfProp(): begin");
       
    40 	//_DBG_FILE("CNSmlDevInfProp::CNSmlDevInfProp(): end");
       
    41 	}
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CNSmlDevInfProp::~CNSmlDevInfProp
       
    45 // Destructor.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CNSmlDevInfProp::~CNSmlDevInfProp()
       
    49 	{
       
    50 	//_DBG_FILE("CNSmlDevInfProp::~CNSmlDevInfProp(): begin");
       
    51 	//_DBG_FILE("CNSmlDevInfProp::~CNSmlDevInfProp(): end");
       
    52 	}
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CNSmlDevInfProp::AddParamLC
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C CNSmlPropParam* CNSmlDevInfProp::AddParamLC( const TDesC8& aParam )
       
    59 	{
       
    60 	//_DBG_FILE("CNSmlDevInfProp::AddParamL(): begin");
       
    61 	SmlDevInfPropParamListPtr_t param = new (ELeave) SmlDevInfPropParamList_t();
       
    62 	CleanupStack::PushL(param);
       
    63 	GenericListAddL(&iPropPtr->propparam, param);
       
    64 	CleanupStack::Pop(); // param
       
    65 	param->data = new (ELeave) SmlDevInfPropParam_t();
       
    66 	param->data->paramname = new (ELeave) SmlPcdata_t();
       
    67 	param->data->paramname->SetDataL(aParam);
       
    68 	CNSmlPropParam* p = new (ELeave) CNSmlPropParam(param->data);
       
    69 	CleanupStack::PushL(p);
       
    70 	//_DBG_FILE("CNSmlDevInfProp::AddParamL(): end");
       
    71 	return p;
       
    72 	}
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CNSmlDevInfProp::SetDisplayNameL
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 EXPORT_C void CNSmlDevInfProp::SetDisplayNameL( const TDesC8& aDispName )
       
    79 	{
       
    80     if (!iPropPtr->displayname )
       
    81         {
       
    82 	    iPropPtr->displayname = new (ELeave) SmlPcdata_t();
       
    83 	    iPropPtr->displayname->SetDataL(aDispName);
       
    84         }
       
    85     else
       
    86         {
       
    87 	    iPropPtr->displayname->SetDataL(aDispName);
       
    88         }
       
    89 	}
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CNSmlDevInfProp::AddValEnumL
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 EXPORT_C void CNSmlDevInfProp::AddValEnumL( const TDesC8& aValEnum )
       
    96 	{
       
    97 	//_DBG_FILE("CNSmlDevInfProp::AddValEnumL(): begin");
       
    98 	SmlPcdataListPtr_t valenum = new (ELeave) SmlPcdataList_t();
       
    99 	CleanupStack::PushL(valenum);
       
   100 	GenericListAddL(&iPropPtr->valenum, valenum);
       
   101 	CleanupStack::Pop(); // valenum
       
   102 	valenum->data = new (ELeave) SmlPcdata_t();
       
   103 	valenum->data->SetDataL(aValEnum);
       
   104 	//_DBG_FILE("CNSmlDevInfProp::AddValEnumL(): end");
       
   105 	}
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CNSmlDevInfProp::SetDataTypeL
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C void CNSmlDevInfProp::SetDataTypeL( const TDesC8& aDataType )
       
   112 	{
       
   113     if ( !iPropPtr->datatype )
       
   114         {
       
   115 	    iPropPtr->datatype = new (ELeave) SmlPcdata_t();
       
   116 	    iPropPtr->datatype->SetDataL(aDataType);
       
   117         }
       
   118     else
       
   119         {
       
   120         iPropPtr->datatype->SetDataL(aDataType);
       
   121         }
       
   122 	}
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CNSmlDevInfProp::SetMaxOccurL
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 EXPORT_C void CNSmlDevInfProp::SetMaxOccurL( const TDesC8& aMaxOccur )
       
   129     {
       
   130     if ( !iPropPtr->maxoccur )
       
   131         {
       
   132 	    iPropPtr->maxoccur = new (ELeave) SmlPcdata_t();
       
   133 	    iPropPtr->maxoccur->SetDataL(aMaxOccur);
       
   134         }
       
   135     else
       
   136         {
       
   137         iPropPtr->maxoccur->SetDataL(aMaxOccur);
       
   138         }
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CNSmlDevInfProp::SetMaxSizeL
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C void CNSmlDevInfProp::SetMaxSizeL( const TDesC8& aMaxSize )
       
   146     {
       
   147     if ( !iPropPtr->maxsize )
       
   148         {
       
   149 	    iPropPtr->maxsize = new (ELeave) SmlPcdata_t();
       
   150 	    iPropPtr->maxsize->SetDataL(aMaxSize);
       
   151         }
       
   152     else
       
   153         {
       
   154         iPropPtr->maxsize->SetDataL(aMaxSize);
       
   155         }
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CNSmlDevInfProp::SetNoTruncateL
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 EXPORT_C void CNSmlDevInfProp::SetNoTruncateL()
       
   163     {
       
   164     if ( !iPropPtr->notruncate )
       
   165         {
       
   166 	    iPropPtr->notruncate = new (ELeave) SmlPcdata_t();
       
   167         iPropPtr->notruncate->SetDataL(TPtrC8());
       
   168         }
       
   169     else
       
   170         {
       
   171         iPropPtr->notruncate->SetDataL(TPtrC8());
       
   172         }
       
   173     }
       
   174 
       
   175 //  End of File