|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <ChatSdpAttributeParser.h>
Public Types | |
| enum | TNodeCommand { ECheckType, ECheckValue, ECheckEnd, ESkip, EReadValue, EFinished } |
Public Member Functions | |
| TChatSdpAttributeParser (RArray< TChatSdpAttributeParser::TChatSdpAttributeNode > &aNodeList, MChatSdpAttributeNotifier &aObserver) | |
| virtual | ~TChatSdpAttributeParser () |
| TBool | HasFinished () const |
| void | VisitAttributeValueL (CSdpAttrValue &aValue, TSdpElementType aType) |
| void | StartListL (CSdpAttrValueList &aList) |
| void | EndListL () |
Private Member Functions | |
| void | CheckTypeL (TSdpElementType aElementType) const |
| void | CheckValueL (CSdpAttrValue &aValue) const |
| void | ReadValueL (CSdpAttrValue &aValue) const |
| void | AdvanceL () |
Private Attributes | |
| MChatSdpAttributeNotifier & | iObserver |
| RArray< TChatSdpAttributeParser::TChatSdpAttributeNode > & | iNodeList |
| TInt | iCurrentNodeIndex |
| TChatSdpAttributeNode | iCurrentNode |
Classes | |
| class | TChatSdpAttributeNode |
Definition at line 31 of file ChatSdpAttributeParser.h.
|
|
TNodeCommand The command to be carried out at a node ECheckType. Check the type of the value ECheckValue. Check the type and the value ECheckEnd. Check that a list ends at this point ESkip. Do not check this value - can not match a list end EReadValue. Pass the value onto the observer EFinished. Marks the end of the node list Definition at line 45 of file ChatSdpAttributeParser.h. 00046 { 00047 ECheckType, 00048 ECheckValue, 00049 ECheckEnd, 00050 ESkip, 00051 EReadValue, 00052 EFinished 00053 };
|
|
||||||||||||
|
TChatSdpAttributeParser Construct a TChatSdpAttributeParser
Definition at line 30 of file ChatSdpAttributeParser.cpp. References iCurrentNode, iCurrentNodeIndex, and iNodeList. 00032 : 00033 iObserver( aObserver ), 00034 iNodeList( aNodeList ), 00035 iCurrentNodeIndex( 0 ) 00036 { 00037 iCurrentNode = iNodeList[iCurrentNodeIndex]; 00038 }
|
|
|
~TChatSdpAttributeParser Destructor Definition at line 45 of file ChatSdpAttributeParser.cpp.
|
|
|
HasFinished Check if parsing processed the whole list
Definition at line 55 of file ChatSdpAttributeParser.cpp. References TChatSdpAttributeParser::TChatSdpAttributeNode::Command(), and iCurrentNode. 00056 { 00057 return ( iCurrentNode.Command() == EFinished ); 00058 }
|
|
||||||||||||
|
VisitAttributeValueL Process a data element
Definition at line 65 of file ChatSdpAttributeParser.cpp. References CheckTypeL(), CheckValueL(), TChatSdpAttributeParser::TChatSdpAttributeNode::Command(), iCurrentNode, and ReadValueL(). 00067 { 00068 switch ( iCurrentNode.Command() ) 00069 { 00070 case ECheckType: 00071 CheckTypeL( aType ); 00072 break; 00073 00074 case ECheckValue: 00075 CheckTypeL( aType ); 00076 CheckValueL( aValue ); 00077 break; 00078 00079 case ECheckEnd: 00080 User::Leave( KErrTooBig ); //list element contains too many items 00081 break; 00082 00083 case ESkip: 00084 break; // no checking required 00085 00086 case EReadValue: 00087 CheckTypeL( aType ); 00088 ReadValueL( aValue ); 00089 break; 00090 00091 case EFinished: 00092 User::Leave( KErrEof ); // element is after 00093 return; // value should have ended 00094 00095 default: 00096 Panic( EChatSdpAttributeParserInvalidCommand ); 00097 } 00098 00099 AdvanceL(); 00100 }
|
|
|
StartListL Process the start of a data element list
Definition at line 107 of file ChatSdpAttributeParser.cpp.
|
|
|
EndListL Process the end of a data element list Definition at line 117 of file ChatSdpAttributeParser.cpp. References TChatSdpAttributeParser::TChatSdpAttributeNode::Command(), and iCurrentNode. 00118 { 00119 // check we are at the end of a list 00120 if ( iCurrentNode.Command() != ECheckEnd ) 00121 { 00122 User::Leave( KErrGeneral ); 00123 } 00124 00125 AdvanceL(); 00126 }
|
|
|
CheckTypeL Check the type of the current node is the same as the specified type.
Definition at line 133 of file ChatSdpAttributeParser.cpp. References iCurrentNode, and TChatSdpAttributeParser::TChatSdpAttributeNode::Type(). 00134 { 00135 if ( iCurrentNode.Type() != aElementType ) 00136 { 00137 User::Leave( KErrGeneral ); 00138 } 00139 }
|
|
|
CheckValueL Check the value of the current node is the same as the specified value
Definition at line 146 of file ChatSdpAttributeParser.cpp. References iCurrentNode, and TChatSdpAttributeParser::TChatSdpAttributeNode::Value(). 00147 { 00148 switch ( aValue.Type() ) 00149 { 00150 case ETypeNil: 00151 Panic( EChatSdpAttributeParserNoValue ); 00152 break; 00153 00154 case ETypeUint: 00155 if ( aValue.Uint() != ( TUint ) iCurrentNode.Value() ) 00156 { 00157 User::Leave( KErrArgument ); 00158 } 00159 break; 00160 00161 case ETypeInt: 00162 if ( aValue.Int() != iCurrentNode.Value() ) 00163 { 00164 User::Leave( KErrArgument ); 00165 } 00166 break; 00167 00168 case ETypeBoolean: 00169 if ( aValue.Bool() != iCurrentNode.Value() ) 00170 { 00171 User::Leave( KErrArgument ); 00172 } 00173 break; 00174 00175 case ETypeUUID: 00176 if ( aValue.UUID() != TUUID( iCurrentNode.Value() ) ) 00177 { 00178 User::Leave( KErrArgument ); 00179 } 00180 break; 00181 00182 case ETypeDES: 00183 case ETypeDEA: 00184 Panic( EChatSdpAttributeParserValueIsList ); 00185 break; 00186 00187 default: 00188 Panic( EChatSdpAttributeParserValueTypeUnsupported ); 00189 break; 00190 } 00191 }
|
|
|
ReadValueL Pass the data element value to the observer
Definition at line 198 of file ChatSdpAttributeParser.cpp. References MChatSdpAttributeNotifier::FoundElementL(), iCurrentNode, iObserver, and TChatSdpAttributeParser::TChatSdpAttributeNode::Value(). 00199 { 00200 iObserver.FoundElementL( iCurrentNode.Value(), aValue ); 00201 }
|
|
|
AdvanceL Advance to the next node. Leaves with KErrEof if at the finished node. Definition at line 208 of file ChatSdpAttributeParser.cpp. References TChatSdpAttributeParser::TChatSdpAttributeNode::Command(), and iCurrentNode. 00209 { 00210 // check not at end 00211 if ( iCurrentNode.Command() == EFinished ) 00212 { 00213 User::Leave( KErrEof ); 00214 } 00215 00216 // move to the next item 00217 iCurrentNode = iNodeList[++iCurrentNodeIndex]; 00218 }
|
|
|
iObserver the observer to read values Definition at line 225 of file ChatSdpAttributeParser.h. |
|
|
iNodeList a list defining the expected structure of the value Definition at line 231 of file ChatSdpAttributeParser.h. |
|
|
iCurrentNodeIndex the index of the current node in iNodeList Definition at line 236 of file ChatSdpAttributeParser.h. |
|
|
iCurrentNode the current node Definition at line 241 of file ChatSdpAttributeParser.h. |
|
© Nokia 2006 |