99045518f0e14abbe5d3126535e639d056c693c4
[platform/framework/native/net.git] / inc / FNetHttpHttpCredentials.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FNetHttpHttpCredentials.h
20  * @brief               This is the header file for the %HttpCredentials class.
21  *
22  * This header file contains the declarations of the %HttpCredentials class.
23  */
24
25 #ifndef _FNET_HTTP_HTTP_CREDENTIALS_H_
26 #define _FNET_HTTP_HTTP_CREDENTIALS_H_
27
28 #include <FNetHttpHttpTypes.h>
29
30 namespace Tizen { namespace Net { namespace Http
31 {
32
33 /////////////////////////////////////////////////////////////////////////////
34 /**
35  * @class       HttpCredentials
36  * @brief       This class represents the credentials required for authentication.
37  *
38  * @since   2.0
39  *
40  * The %HttpCredentials class represents the credentials required for authentication, that is, the user name and password.
41  *
42  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/net/http_connectivity.htm">HTTP Guide</a>.
43  */
44 //////////////////////////////////////////////////////////////////////////
45 class _OSP_EXPORT_ HttpCredentials
46         : public Tizen::Base::Object
47 {
48
49 public:
50         /**
51          * This is the default constructor for this class.
52          *
53          * @since       2.0
54          */
55         HttpCredentials(void);
56
57         /**
58          * Initializes an instance of %HttpCredentials with the specified user name and password.
59          *
60          * @since       2.0
61          *
62          * @param[in]   name                            The user name string
63          * @param[in]   password                        The password string
64          */
65         HttpCredentials(const Tizen::Base::String& name, const Tizen::Base::String& password);
66
67         /**
68         * Copying of objects using this copy constructor is allowed.
69         *
70         * @since        2.0
71         *
72         * @param[in]    rhs     An instance of %HttpCredentials
73         */
74         HttpCredentials(const HttpCredentials& rhs);
75
76         /**
77          * This destructor overrides Tizen::Base::Object::~Object().
78          *
79          * @since       2.0
80          */
81         virtual ~HttpCredentials(void);
82
83         /**
84          * Copying of objects using this copy assignment operator is allowed.
85          *
86          * @since       2.0
87          *
88          * @param[in]   rhs             An instance of %HttpCredentials
89          */
90         HttpCredentials& operator =(const HttpCredentials& rhs);
91
92         /**
93          * Sets the user name for the current instance of %HttpCredentials.
94          *
95          * @since                       2.0
96          * @privlevel           public
97          * @privilege           %http://tizen.org/privilege/http
98          *
99          * @param[in]   name                            The user name string
100          * @exception   E_SUCCESS                       The method is successful.
101          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
102          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
103          * @exception   E_SYSTEM                        A system error has occurred.
104          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
105          */
106         result SetName(const Tizen::Base::String& name);
107
108         /**
109          * Sets the password for the current instance of %HttpCredentials.
110          *
111          * @since                       2.0
112          * @privlevel           public
113          * @privilege           %http://tizen.org/privilege/http
114          *
115          * @param[in]   password                        The password string
116          * @exception   E_SUCCESS                       The method is successful.
117          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
118          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
119          * @exception   E_SYSTEM                        A system error has occurred.
120          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
121          */
122         result SetPassword(const Tizen::Base::String& password);
123
124         /**
125          * Gets the user name of the current instance of %HttpCredentials.
126          *
127          * @since                       2.0
128          * @privlevel           public
129          * @privilege           %http://tizen.org/privilege/http
130          *
131          * @return                      The user name
132          * @exception   E_SUCCESS                               The method is successful.
133          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
134          * @exception   E_SYSTEM                                A system error has occurred.
135          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
136          * @remarks             The specific error code can be accessed using the GetLastResult() method.
137          */
138         Tizen::Base::String GetName(void) const;
139
140         /**
141          * Gets the password of the current instance of %HttpCredentials.
142          *
143          * @since                       2.0
144          * @privlevel           public
145          * @privilege           %http://tizen.org/privilege/http
146          *
147          * @return                      The password
148          * @exception   E_SUCCESS                               The method is successful.
149          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
150          * @exception   E_SYSTEM                                A system error has occurred.
151          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
152          * @remarks             The specific error code can be accessed using the GetLastResult() method.
153          */
154         Tizen::Base::String GetPassword(void) const;
155
156         /**
157          * Compares the specified instance of %HttpCredentials with the calling instance.
158          *
159          * @since               2.0
160          *
161          * @return              @c true if the values match, @n
162          *                          else @c false
163          * @param[in]   rhs     The other Tizen::Base::Object to compare
164          * @see         Tizen::Base::Object::Equals()
165          */
166         virtual bool Equals(const Tizen::Base::Object& rhs) const;
167
168         /**
169          * Gets the hash value of the current instance.
170          *
171          * @since               2.0
172          *
173          * @return      The hash value of the current instance
174          */
175         virtual int GetHashCode(void) const;
176
177 private:
178         Tizen::Base::String __userName;
179         Tizen::Base::String __password;
180
181         friend class HttpCredentialsImpl;
182         class HttpCredentialsImpl* __pHttpCredentialsImpl;
183
184 }; // HttpCredentials
185
186 } } } //Tizen::Net::Http
187 #endif // _FNET_HTTP_HTTP_CREDENTIALS_H_