|
1 /* |
|
2 * Copyright (c) 2002-2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 // INCLUDE FILES |
|
26 #include "idwsfserviceprovider.h" |
|
27 |
|
28 CIdWsfServiceProvider* CIdWsfServiceProvider::NewL(const TDesC8& aProviderID, |
|
29 const TDesC8& aServiceURL) |
|
30 { |
|
31 CIdWsfServiceProvider* self = |
|
32 CIdWsfServiceProvider::NewLC(aProviderID,aServiceURL); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CIdWsfServiceProvider* CIdWsfServiceProvider::NewLC(const TDesC8& aProviderID, |
|
38 const TDesC8& aServiceURL) |
|
39 { |
|
40 CIdWsfServiceProvider* self = new (ELeave) CIdWsfServiceProvider(); |
|
41 CleanupStack::PushL(self); |
|
42 self->ConstructL(aProviderID,aServiceURL); |
|
43 return self; |
|
44 } |
|
45 |
|
46 CIdWsfServiceProvider::CIdWsfServiceProvider() |
|
47 { |
|
48 } |
|
49 |
|
50 void CIdWsfServiceProvider::ConstructL(const TDesC8& aProviderID, |
|
51 const TDesC8& aEndpoint) |
|
52 { |
|
53 SetProviderIdL(aProviderID); |
|
54 SetEndPointL(aEndpoint); |
|
55 } |
|
56 |
|
57 |
|
58 CIdWsfServiceProvider::~CIdWsfServiceProvider() |
|
59 { |
|
60 delete ipProviderId; |
|
61 delete ipEndpoint; |
|
62 } |
|
63 |
|
64 TInt CIdWsfServiceProvider::SetProviderIdL(const TDesC8& aProviderID) |
|
65 { |
|
66 HBufC8* pNew = NULL; |
|
67 if(aProviderID.Length()>0) |
|
68 { |
|
69 pNew = aProviderID.AllocL(); |
|
70 } |
|
71 delete ipProviderId; |
|
72 ipProviderId = pNew; |
|
73 return KErrNone; |
|
74 } |
|
75 |
|
76 TInt CIdWsfServiceProvider::SetEndPointL(const TDesC8& aServiceURL) |
|
77 { |
|
78 HBufC8* pNew = NULL; |
|
79 if(aServiceURL.Length()>0) |
|
80 { |
|
81 pNew = aServiceURL.AllocL(); |
|
82 } |
|
83 delete ipEndpoint; |
|
84 ipEndpoint = pNew; |
|
85 return KErrNone; |
|
86 } |
|
87 |
|
88 TPtrC8 CIdWsfServiceProvider::ProviderId() |
|
89 { |
|
90 if(ipProviderId) |
|
91 return *ipProviderId; |
|
92 else |
|
93 return KNullDesC8(); |
|
94 } |
|
95 |
|
96 TPtrC8 CIdWsfServiceProvider::Endpoint() |
|
97 { |
|
98 if(ipEndpoint) |
|
99 return *ipEndpoint; |
|
100 else |
|
101 return KNullDesC8(); |
|
102 } |
|
103 |
|
104 |
|
105 TBool CIdWsfServiceProvider::Equals(const TDesC8& aProviderID) |
|
106 { |
|
107 TPtrC8 provider(KNullDesC8()); |
|
108 if(ipProviderId) |
|
109 { |
|
110 provider.Set(*ipProviderId); |
|
111 } |
|
112 |
|
113 if(provider == aProviderID) |
|
114 { |
|
115 return ETrue; |
|
116 } |
|
117 else |
|
118 { |
|
119 return EFalse; |
|
120 } |
|
121 } |
|
122 |
|
123 // End of File |