1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/ineturilistdef.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,333 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Place holder for common constants, type definitions and enums.
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __INETURILISTDEF_H__
1.29 +#define __INETURILISTDEF_H__
1.30 +
1.31 +#include <e32base.h>
1.32 +
1.33 +/**
1.34 +@publishedAll
1.35 +@released
1.36 +*/
1.37 +namespace InetUriList
1.38 + {
1.39 + /**
1.40 + Types of supported service type.
1.41 +
1.42 + @publishedAll
1.43 + @released
1.44 + */
1.45 + enum TServiceType
1.46 + {
1.47 + /** Browser */
1.48 + EBrowser =0x01,
1.49 + /** WapPush */
1.50 + EWapPush =0x02,
1.51 + /** PushEMail */
1.52 + EPushEMail =0x03,
1.53 + /** DevProv */
1.54 + EDevProv =0x04,
1.55 + /** VOIP */
1.56 + EVoip =0x05
1.57 + };
1.58 +
1.59 + /**
1.60 + Types of supported list type.
1.61 +
1.62 + @publishedAll
1.63 + @released
1.64 + */
1.65 + enum TListType
1.66 + {
1.67 + /** BlackList **/
1.68 + EBlackList =0x01,
1.69 + /** WhiteList **/
1.70 + EWhiteList =0x02
1.71 + };
1.72 +
1.73 + /**
1.74 + Types of permission.
1.75 +
1.76 + @publishedAll
1.77 + @released
1.78 + */
1.79 + enum TPermission
1.80 + {
1.81 + /** ReadOnly **/
1.82 + EReadOnly =0x01,
1.83 + /** ReadWrite **/
1.84 + EReadWrite =0x02
1.85 + };
1.86 +
1.87 + /**
1.88 + Types of matches.
1.89 +
1.90 + @publishedAll
1.91 + @released
1.92 + */
1.93 + enum TURIMatch
1.94 + {
1.95 + /** Exact match **/
1.96 + EExact =0x01,
1.97 + /** Domain match **/
1.98 + EDomain =0x02,
1.99 + /** Exact path match **/
1.100 + EExactPath =0x03,
1.101 + /** partial prefix path match **/
1.102 + EPartialPrefixPath =0x04,
1.103 + /** Partial suffix path match **/
1.104 + EPartialSuffixPath =0x05
1.105 + };
1.106 +
1.107 + /**
1.108 + Error codes error numbers -7650 to -7699 have been reserved for InetUriList.
1.109 + */
1.110 + static const TInt KErrorBase = -7650;
1.111 + /**
1.112 + URI already exists in database.
1.113 + */
1.114 + static const TInt KErrUriAlreadyExists = KErrorBase;
1.115 + /**
1.116 + URI not found in database.
1.117 + */
1.118 + static const TInt KErrUriNotFound = KErrorBase - 1;
1.119 + /**
1.120 + Addition of URI failed.
1.121 + */
1.122 + static const TInt KErrUriAddFailed = KErrorBase - 2;
1.123 + /**
1.124 + Removal of URI failed.
1.125 + */
1.126 + static const TInt KErrUriRemoveFailed = KErrorBase - 3;
1.127 + /**
1.128 + Updation of URI properties failed.
1.129 + */
1.130 + static const TInt KErrUriUpdateFailed = KErrorBase - 4;
1.131 + /**
1.132 + URI is read only.
1.133 + */
1.134 + static const TInt KErrUriReadOnly = KErrorBase - 5;
1.135 + /**
1.136 + Service type of URI is missing.
1.137 + */
1.138 + static const TInt KErrServiceTypeNotPresent = KErrorBase - 6;
1.139 + /**
1.140 + Handle is not open.
1.141 + */
1.142 + static const TInt KErrNotOpen = KErrorBase - 7;
1.143 + /**
1.144 + Invalid stream handle
1.145 + */
1.146 + static const TInt KErrInvalidStreamHandle = KErrorBase - 8;
1.147 +
1.148 + /**
1.149 + Panic text if handle is not open.
1.150 + */
1.151 + _LIT(KInetUriListErrHandleNotOpen, "Handle not open");
1.152 +
1.153 + }
1.154 +
1.155 +/**
1.156 +This class defines the argument parameters for the query operation. It is possible to
1.157 +set the arguments in various combinations. The argument types can be ServiceType,
1.158 +ListType, URI in TDesC8 form, and URIMatch.
1.159 +
1.160 +@publishedAll
1.161 +@released
1.162 +*/
1.163 +class TQueryArgs
1.164 + {
1.165 + public:
1.166 + /**
1.167 + The argument types.
1.168 +
1.169 + @internalComponent
1.170 + */
1.171 + enum TArgType
1.172 + {
1.173 + EUri = 1,
1.174 + EServiceType,
1.175 + EListType,
1.176 + EURIMatch
1.177 + };
1.178 + /**
1.179 + Bit width of the type.
1.180 +
1.181 + @internalComponent
1.182 + */
1.183 + enum
1.184 + {
1.185 + KBitsPerType = 3
1.186 + };
1.187 +
1.188 + /**
1.189 + Default constructor
1.190 + */
1.191 + inline TQueryArgs ()
1.192 + :iFlags ( 0 )
1.193 + {}
1.194 +
1.195 +
1.196 + /**
1.197 + A templated constructor that constructs the query argument.
1.198 + It takes one argument.
1.199 + */
1.200 + template < class T0 >
1.201 + explicit inline TQueryArgs ( T0 a0 )
1.202 + {
1.203 + Assign ( a0 );
1.204 + iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType));
1.205 + }
1.206 +
1.207 + /**
1.208 + A templated constructor that constructs the query argument.
1.209 + It takes two arguments.
1.210 + */
1.211 + template < class T0, class T1 >
1.212 + inline TQueryArgs ( T0 a0, T1 a1 )
1.213 + {
1.214 + Assign ( a0 );
1.215 + Assign ( a1 );
1.216 + iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)) |
1.217 + (Type(a1)<<(( Type(a1))*KBitsPerType));
1.218 + }
1.219 +
1.220 + /**
1.221 + A templated constructor that constructs the query argument.
1.222 + It takes three arguments.
1.223 + */
1.224 + template < class T0, class T1, class T2 >
1.225 + inline TQueryArgs ( T0 a0, T1 a1, T2 a2 )
1.226 + {
1.227 + Assign ( a0 );
1.228 + Assign ( a1 );
1.229 + Assign ( a2 );
1.230 + iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) |
1.231 + (Type(a1)<<(Type(a1)*KBitsPerType)) |
1.232 + (Type(a2)<<(Type(a2)*KBitsPerType));
1.233 + }
1.234 +
1.235 + /**
1.236 + A templated constructor that constructs the query argument.
1.237 + It takes four arguments.
1.238 + */
1.239 + template < class T0, class T1, class T2, class T3 >
1.240 + inline TQueryArgs ( T0 a0, T1 a1, T2 a2, T3 a3 )
1.241 + {
1.242 + Assign ( a0 );
1.243 + Assign ( a1 );
1.244 + Assign ( a2 );
1.245 + Assign ( a3 );
1.246 + iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) |
1.247 + (Type(a1)<<(Type(a1)*KBitsPerType)) |
1.248 + (Type(a2)<<(Type(a2)*KBitsPerType)) |
1.249 + (Type(a3)<<(Type(a3)*KBitsPerType));
1.250 + }
1.251 +
1.252 +
1.253 + /**
1.254 + Checks whether the flag is set for the given argument type.
1.255 +
1.256 + @internalComponent
1.257 + */
1.258 + TBool IsSet ( TArgType aType ) const
1.259 + {
1.260 + TInt val = iFlags & ( aType << ( aType * KBitsPerType ) );
1.261 + return iFlags & ( aType << ( aType * KBitsPerType ) );
1.262 + }
1.263 +
1.264 + /**
1.265 + Returns the argument if set, otherwise returns KErrNotFound.
1.266 +
1.267 + @internalComponent
1.268 + */
1.269 + TInt Get ( TArgType aType ) const
1.270 + {
1.271 + if ( IsSet ( aType ) )
1.272 + return iArgs[aType - 1];
1.273 + return KErrNotFound;
1.274 + }
1.275 +
1.276 + /**
1.277 + Maximum number of arguments. Currently set as 4.
1.278 +
1.279 + @internalComponent
1.280 + */
1.281 + enum
1.282 + {
1.283 + KMaxArguments = 4
1.284 + };
1.285 +
1.286 + private:
1.287 +
1.288 + /**
1.289 + @internalComponent
1.290 + */
1.291 + TArgType Type ( const TDesC8* )
1.292 + {
1.293 + return EUri;
1.294 + }
1.295 +
1.296 + TArgType Type ( InetUriList::TServiceType )
1.297 + {
1.298 + return EServiceType;
1.299 + }
1.300 +
1.301 + TArgType Type ( InetUriList::TListType )
1.302 + {
1.303 + return EListType;
1.304 + }
1.305 +
1.306 + TArgType Type ( InetUriList::TURIMatch )
1.307 + {
1.308 + return EURIMatch;
1.309 + }
1.310 +
1.311 + void Assign ( const TDesC8* aValue )
1.312 + {
1.313 + iArgs[Type(aValue)-1] = (TInt)aValue;
1.314 + }
1.315 +
1.316 + void Assign ( InetUriList::TServiceType aValue )
1.317 + {
1.318 + iArgs[Type(aValue)-1] = aValue;
1.319 + }
1.320 +
1.321 + void Assign ( InetUriList::TListType aValue )
1.322 + {
1.323 + iArgs[Type(aValue)-1] = aValue;
1.324 + }
1.325 +
1.326 + void Assign ( InetUriList::TURIMatch aValue )
1.327 + {
1.328 + iArgs[Type(aValue)-1] = aValue;
1.329 + }
1.330 +
1.331 + private:
1.332 + TInt iArgs [KMaxArguments];
1.333 + TInt iFlags;
1.334 + };
1.335 +
1.336 +#endif // __INETURILISTDEF_H__