735 // |
736 // |
736 // --------------------------------------------------------------------------- |
737 // --------------------------------------------------------------------------- |
737 // |
738 // |
738 TBool CCPLiwMap::IsPublisherNameL() const |
739 TBool CCPLiwMap::IsPublisherNameL() const |
739 { |
740 { |
740 TBool result( EFalse ); |
741 return IsPropertyValidL( KPublisherId ); |
741 RBuf buffer; |
|
742 buffer.CleanupClosePushL(); |
|
743 result = GetPropertyL( KPublisherId, buffer ); |
|
744 if( result && buffer.Length() == KErrNone ) |
|
745 { |
|
746 User::Leave( KErrArgument ); |
|
747 } |
|
748 CleanupStack::PopAndDestroy( &buffer ); |
|
749 return result; |
|
750 } |
742 } |
751 |
743 |
752 // --------------------------------------------------------------------------- |
744 // --------------------------------------------------------------------------- |
753 // |
745 // |
754 // --------------------------------------------------------------------------- |
746 // --------------------------------------------------------------------------- |
755 // |
747 // |
756 TBool CCPLiwMap::IsContentTypeL() const |
748 TBool CCPLiwMap::IsContentTypeL() const |
757 { |
749 { |
758 TBool result( EFalse ); |
750 return IsPropertyValidL( KContentType ); |
759 RBuf buffer; |
|
760 buffer.CleanupClosePushL(); |
|
761 result = GetPropertyL( KContentType, buffer ); |
|
762 if( result && buffer.Length() == KErrNone ) |
|
763 { |
|
764 User::Leave( KErrArgument ); |
|
765 } |
|
766 CleanupStack::PopAndDestroy( &buffer ); |
|
767 return result; |
|
768 } |
751 } |
769 |
752 |
770 // --------------------------------------------------------------------------- |
753 // --------------------------------------------------------------------------- |
771 // |
754 // |
772 // --------------------------------------------------------------------------- |
755 // --------------------------------------------------------------------------- |
773 // |
756 // |
774 TBool CCPLiwMap::IsContentIdL() const |
757 TBool CCPLiwMap::IsContentIdL() const |
775 { |
758 { |
776 TBool result( EFalse ); |
759 return IsPropertyValidL( KContentId ); |
777 RBuf buffer; |
|
778 buffer.CleanupClosePushL(); |
|
779 result = GetPropertyL( KContentId, buffer ); |
|
780 if( result && buffer.Length() == KErrNone ) |
|
781 { |
|
782 User::Leave( KErrArgument ); |
|
783 } |
|
784 CleanupStack::PopAndDestroy( &buffer ); |
|
785 return result; |
|
786 } |
760 } |
787 |
761 |
788 // --------------------------------------------------------------------------- |
762 // --------------------------------------------------------------------------- |
789 // |
763 // |
790 // --------------------------------------------------------------------------- |
764 // --------------------------------------------------------------------------- |
1264 TInt ret( aStmt.ColumnIndex( aColumnName ) ); |
1238 TInt ret( aStmt.ColumnIndex( aColumnName ) ); |
1265 User::LeaveIfError( ret ); |
1239 User::LeaveIfError( ret ); |
1266 return ret; |
1240 return ret; |
1267 } |
1241 } |
1268 |
1242 |
1269 |
1243 // --------------------------------------------------------------------------- |
1270 |
1244 // |
|
1245 // --------------------------------------------------------------------------- |
|
1246 // |
|
1247 TBool CCPLiwMap::IsPropertyValidL( const TDesC8& aProperty ) const |
|
1248 { |
|
1249 CP_DEBUG( _L8("CCPLiwMap::IsPropertyValidL") ); |
|
1250 TBool found( EFalse ); |
|
1251 TInt pos( 0 ); |
|
1252 const TLiwGenericParam* paramForValue = iMap->FindFirst( pos, aProperty ); |
|
1253 if ( pos != KErrNotFound ) |
|
1254 { |
|
1255 found = ETrue; |
|
1256 TInt length; |
|
1257 if( paramForValue->Value().TypeId() == EVariantTypeDesC ) |
|
1258 { |
|
1259 length = paramForValue->Value().AsDes().Length(); |
|
1260 } |
|
1261 else if ( paramForValue->Value().TypeId() == EVariantTypeDesC8 ) |
|
1262 { |
|
1263 length = paramForValue->Value().AsData().Length(); |
|
1264 } |
|
1265 else |
|
1266 { |
|
1267 User::Leave( KErrBadName ); |
|
1268 } |
|
1269 |
|
1270 if ( length == 0 ) |
|
1271 { |
|
1272 User::Leave( KErrArgument ); |
|
1273 } |
|
1274 } |
|
1275 return found; |
|
1276 } |
|
1277 |