syncmlfw/common/wbxml/src/syncml/smlmetinfdtd.cpp
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 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:  Meta information command struct implementations.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // ------------------------------------------------------------------------------------------------
       
    20 // Includes
       
    21 // ------------------------------------------------------------------------------------------------
       
    22 
       
    23 #include "smldtd.h"
       
    24 #include "smlmetinfdtd.h"
       
    25 #include "smlmetinftags.h"
       
    26 #include "WBXMLSyncMLParser.h"
       
    27 #include "WBXMLParserError.h"
       
    28 
       
    29 // ------------------------------------------------------------------------------------------------
       
    30 // External functions
       
    31 // ------------------------------------------------------------------------------------------------
       
    32 extern CXMLElement* AddPCDataL( SmlPcdataListPtr_t* aList );
       
    33 
       
    34 // ------------------------------------------------------------------------------------------------
       
    35 // sml_metinf_metinf_s
       
    36 // ------------------------------------------------------------------------------------------------
       
    37 EXPORT_C sml_metinf_metinf_s::sml_metinf_metinf_s()
       
    38 	{
       
    39 	}
       
    40 
       
    41 // ------------------------------------------------------------------------------------------------
       
    42 EXPORT_C sml_metinf_metinf_s::~sml_metinf_metinf_s()
       
    43 	{
       
    44 	delete fieldLevel;	//1.2 CHANGES: Fieldlevel
       
    45 	delete format;
       
    46 	delete type;
       
    47 	delete mark;
       
    48 	delete size;
       
    49 	delete nextnonce;
       
    50 	delete version;
       
    51 	delete maxmsgsize;
       
    52 	delete maxobjsize;
       
    53 	delete mem;	
       
    54 	GenericListDelete( emi );
       
    55 	delete anchor;
       
    56 	}
       
    57 
       
    58 // ------------------------------------------------------------------------------------------------
       
    59 CXMLElement* sml_metinf_metinf_s::BeginElementL( TUint8 aTag, const TXMLElementParams& /*aParams*/ )
       
    60 	{
       
    61 	switch( aTag )
       
    62 		{
       
    63 		//1.2 CHANGES: Fieldlevel
       
    64 		case EFieldLevel:
       
    65 			fieldLevel = new (ELeave) SmlPcdata_t();
       
    66 			return fieldLevel;
       
    67 		// Changes end
       
    68 
       
    69 		case EMetFormat:
       
    70 			format = new (ELeave) SmlPcdata_t();
       
    71 			return format;
       
    72 
       
    73 		case EMetType:
       
    74 			type = new (ELeave) SmlPcdata_t();
       
    75 			return type;
       
    76 
       
    77 		case EMetMark:
       
    78 			mark = new (ELeave) SmlPcdata_t();
       
    79 			return mark;
       
    80 
       
    81 		case EMetSize:
       
    82 			size = new (ELeave) SmlPcdata_t();
       
    83 			return size;
       
    84 
       
    85 		case EMetNextNonce:
       
    86 			nextnonce = new (ELeave) SmlPcdata_t();
       
    87 			return nextnonce;
       
    88 
       
    89 		case EMetVersion:
       
    90 			version = new (ELeave) SmlPcdata_t();
       
    91 			return version;
       
    92 
       
    93 		case EMetMaxMsgSize:
       
    94 			maxmsgsize = new (ELeave) SmlPcdata_t();
       
    95 			return maxmsgsize;
       
    96 
       
    97 		case EMetMaxObjSize:
       
    98 			maxobjsize = new (ELeave) SmlPcdata_t();
       
    99 			return maxobjsize;
       
   100 
       
   101 		case EMetMem:
       
   102 			mem = new (ELeave) SmlMetInfMem_t();
       
   103 			return mem;
       
   104 
       
   105 		case EMetEMI:
       
   106 			return AddPCDataL(&emi);
       
   107 
       
   108 		case EMetAnchor:
       
   109 			anchor = new (ELeave) SmlMetInfAnchor_t();
       
   110 			return anchor;
       
   111 
       
   112 		default:
       
   113 			User::Leave(KWBXMLParserErrorInvalidTag);
       
   114 		}
       
   115 	return 0;
       
   116 	}
       
   117 
       
   118 // ------------------------------------------------------------------------------------------------
       
   119 // sml_metinf_mem_s
       
   120 // ------------------------------------------------------------------------------------------------
       
   121 EXPORT_C sml_metinf_mem_s::sml_metinf_mem_s()
       
   122 	{
       
   123 	}
       
   124 
       
   125 // ------------------------------------------------------------------------------------------------
       
   126 EXPORT_C sml_metinf_mem_s::~sml_metinf_mem_s()
       
   127 	{
       
   128 	delete shared;
       
   129 	delete free;
       
   130 	delete freeid;
       
   131 	}
       
   132 
       
   133 // ------------------------------------------------------------------------------------------------
       
   134 CXMLElement* sml_metinf_mem_s::BeginElementL( TUint8 aTag, const TXMLElementParams& /*aParams*/ )
       
   135 	{
       
   136 	switch( aTag )
       
   137 		{
       
   138 		case EMetSharedMem:
       
   139 			shared = new (ELeave) SmlPcdata_t();
       
   140 			return shared;
       
   141 		
       
   142 		case EMetFreeMem:
       
   143 			free = new (ELeave) SmlPcdata_t();
       
   144 			return free;
       
   145 
       
   146 		case EMetFreeID:
       
   147 			freeid = new (ELeave) SmlPcdata_t();
       
   148 			return freeid;
       
   149 
       
   150 		default:
       
   151 			User::Leave(KWBXMLParserErrorInvalidTag);
       
   152 		}
       
   153 	return 0;
       
   154 	}
       
   155 
       
   156 // ------------------------------------------------------------------------------------------------
       
   157 // sml_metinf_anchor_s
       
   158 // ------------------------------------------------------------------------------------------------
       
   159 EXPORT_C sml_metinf_anchor_s::sml_metinf_anchor_s()
       
   160 	{
       
   161 	}
       
   162 
       
   163 // ------------------------------------------------------------------------------------------------
       
   164 EXPORT_C sml_metinf_anchor_s::~sml_metinf_anchor_s()
       
   165 	{
       
   166 	delete last;
       
   167 	delete next;
       
   168 	}
       
   169 
       
   170 // ------------------------------------------------------------------------------------------------
       
   171 CXMLElement* sml_metinf_anchor_s::BeginElementL( TUint8 aTag, const TXMLElementParams& /*aParams*/ )
       
   172 	{
       
   173 	switch( aTag )
       
   174 		{
       
   175 		case EMetLast:
       
   176 			last = new (ELeave) SmlPcdata_t();
       
   177 			return last;
       
   178 		
       
   179 		case EMetNext:
       
   180 			next = new (ELeave) SmlPcdata_t();
       
   181 			return next;
       
   182 
       
   183 		default:
       
   184 			User::Leave(KWBXMLParserErrorInvalidTag);
       
   185 		}
       
   186 	return 0;
       
   187 	}