Merge "fixed wrong link page" into tizen_2.1
[platform/framework/native/nfc.git] / inc / FNetNfcNdefRecordType.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  * @file    FNetNfcNdefRecordType.h
19  * @brief   This is the header file for the %NdefRecordType class.
20  *
21  * This header file contains the declarations of the %NdefRecordType class.
22  */
23
24 #ifndef _FNET_NFC_NDEF_RECORD_TYPE_H_
25 #define _FNET_NFC_NDEF_RECORD_TYPE_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FNetNfcNfcTypes.h>
30
31 namespace Tizen { namespace Base
32 {
33 class String;
34 } }
35
36 namespace Tizen { namespace Net { namespace Nfc
37 {
38
39 class _NdefRecordTypeImpl;
40
41 /**
42  * @if OSPDEPREC
43  * Defines the NDEF RTD Smart Poster type.
44  *
45  * @brief <i> [Deprecated] </i>
46  * @deprecated  This object is provided only for backward compatibility and will be deleted in the near future.
47  *                              Use @c NFC_NDEF_RTD_SMART_POSTER instead of this object.
48  * @since   2.0
49  * @endif
50  */
51 _OSP_EXPORT_ extern const Tizen::Base::String NDEF_RTD_SMART_POSTER;
52
53 /**
54  * Defines the NDEF RTD Smart Poster type. ("Sp")
55  *
56  * @since 2.0
57  */
58 _OSP_EXPORT_ extern const wchar_t NFC_NDEF_RTD_SMART_POSTER[];
59
60 /**
61  * @if OSPDEPREC
62  * Defines the NDEF RTD %Text type.
63  *
64  * @brief <i> [Deprecated] </i>
65  * @deprecated  This object is provided only for backward compatibility and will be deleted in the near future.
66  *                              Use @c NFC_NDEF_RTD_TEXT instead of this object.
67  * @since   2.0
68  * @endif
69  */
70 _OSP_EXPORT_ extern const Tizen::Base::String NDEF_RTD_TEXT;
71
72 /**
73  * Defines the NDEF RTD %Text type. ("T")
74  *
75  * @since 2.0
76  */
77 _OSP_EXPORT_ extern const wchar_t NFC_NDEF_RTD_TEXT[];
78
79 /**
80  * @if OSPDEPREC
81  * Defines the NDEF RTD URI type.
82  *
83  * @brief <i> [Deprecated] </i>
84  * @deprecated  This object is provided only for backward compatibility and will be deleted in the near future.
85  *                              Use @c NFC_NDEF_RTD_URI instead of this object.
86  * @since   2.0
87  * @endif
88  */
89 _OSP_EXPORT_ extern const Tizen::Base::String NDEF_RTD_URI;
90
91 /**
92  * Defines the NDEF RTD URI type. ("U")
93  *
94  * @since 2.0
95  */
96 _OSP_EXPORT_ extern const wchar_t NFC_NDEF_RTD_URI[];
97
98 /**
99  * @class   NdefRecordType
100  * @brief   This class represents the type of an NDEF record.
101  *
102  * @since   2.0
103  *
104  * The %NdefRecordType class represents the type of an NDEF record. It encapsulates the name and the name format of the
105  * NDEF record type. @n
106  * The name format is represented by the enumeration type, Tizen::Net::Nfc::NdefRecordTypeNameFormat. The name is
107  * encoded using the US_ASCII character set and follows the rules defined by the NFC forum RTDs and RFCs. The name does
108  * not include the prefix @c "urn:nfc:wkt:" and @c "urn:nfc:ext:" defined by the NFC forum.
109  *
110  * For more information on the class features, see
111  * <a href="../org.tizen.native.appprogramming/html/guide/net/nfc.htm">NFC Guide</a>.
112  */
113
114 class _OSP_EXPORT_ NdefRecordType
115         : public Tizen::Base::Object
116 {
117 public:
118         /**
119          * This is the default constructor for this class. @n
120          * Initializes this instance of %NdefRecordType with the specified parameter.
121          *
122          * @since       2.0
123          *
124          * @param[in]   format          The NDEF record type name format
125          */
126         NdefRecordType(NdefRecordTypeNameFormat format = NDEF_TNF_EMPTY);
127
128         /**
129          * Copying of objects using this copy constructor is allowed.
130          *
131          * @since       2.0
132          *
133          * @param[in]   recordType      An instance of %NdefRecordType
134          */
135         NdefRecordType(const NdefRecordType& recordType);
136
137         /**
138          * This destructor overrides Tizen::Base::Object::~Object().
139          *
140          * @since       2.0
141          */
142         virtual ~NdefRecordType(void);
143
144         /**
145          * Copying of objects using this copy assignment operator is allowed.
146          *
147          * @since       2.0
148          *
149          * @param[in]   rhs             An instance of %NdefRecordType
150          */
151         NdefRecordType& operator =(const NdefRecordType& rhs);
152
153         /**
154          * Compares the specified instance of Tizen::Base::Object with the calling instance of %NdefRecordType.
155          *
156          * @since       2.0
157          *
158          * @return      @c true if the values match, @n
159          *              else @c false
160          * @param[in]   obj             The Tizen::Base::Object to compare
161          * @remarks     The method returns @c false if the specified object is not an %NdefRecordType instance. @n
162          *              Additionally, the comparison rules for the record type name are different depending on the Type
163          *              Name Format (TNF) value, as follows: @n
164          * <table border=1 cellpadding="1" cellspacing="1">
165          * <tr>
166          *      <th>Type Name Format (TNF) value</th>
167          *      <th>The comparison rule for the record type name</th>
168          * </tr>
169          * <tr>
170          *      <td>NDEF_TNF_WELL_KNOWN</td>
171          *      <td>Compares a name, character by character in a case-sensitive manner </td>
172          * </tr>
173          * <tr>
174          *      <td>NDEF_TNF_MIME_MEDIA </td>
175          *      <td>Compares a name, character by character in a case-insensitive manner until the first semi-colon (;)
176          *      appears </td>
177          * </tr>
178          * <tr>
179          *      <td>NDEF_TNF_ABSOLUTE_URI </td>
180          *      <td>The reserved characters must be percent encoded and the hexadecimal digits are normalized to upper-case 
181          *      letters. The URI scheme and host parts of the URI must be normalized to lower case. After this, the URIs 
182          *      are compared character by character in a case-sensitive manner. </td>
183          * </tr>
184          * <tr>
185          *      <td>NDEF_TNF_EXTERNAL </td>
186          *      <td>Compares a name, character by character in a case-insensitive manner </td>
187          * </tr>
188          * <tr>
189          *      <td>NDEF_TNF_EMPTY | NDEF_TNF_UNKNOWN </td>
190          *      <td>Both record type names must be empty </td>
191          * </tr>
192          * </table>
193          */
194         virtual bool Equals(const Tizen::Base::Object& obj) const;
195
196         /**
197          * Gets the hash value of the current instance.
198          *
199          * @since       2.0
200          *
201          * @return      The hash value of the current instance
202          * @remarks     The two equal %NdefRecordType instances return the same hash value.
203          */
204         virtual int GetHashCode(void) const;
205
206         /**
207          * Gets the name format of this record type.
208          *
209          * @since       2.0
210          *
211          * @return      The name format of this record type
212          */
213         NdefRecordTypeNameFormat GetNameFormat(void) const;
214
215         /**
216          * Gets the name of this record type.
217          *
218          * @since       2.0
219          *
220          * @return      The name of this record type, @n
221          *              else an empty string if the name format is NDEF_TNF_EMPTY or NDEF_TNF_UNKNOWN
222          * @remarks
223          *              - The returned name does not have the prefix @c "urn:nfc:wkt:" and @c "urn:nfc:ext:" defined by the
224          *                NFC forum.
225          *              - In case of @c NDEF_TNF_ABSOLUTE_URI name format, this method returns the name in the same format as
226          *                it is given in the constructor, that is, with or without percent encoding. The name consists of
227          *                the characters encoded using the US_ASCII character set.
228          */
229         Tizen::Base::String GetName(void) const;
230
231         /**
232          * Sets the name of this record type.
233          *
234          * @since       2.0
235          *
236          * @return      An error code
237          * @param[in]   name                        The name of this record type
238          * @exception   E_SUCCESS                   The method is successful.
239          * @exception   E_INVALID_OPERATION         This operation is not allowed if the name format is NDEF_TNF_EMPTY,
240          *                                          NDEF_TNF_UNKNOWN, or NDEF_TNF_ALL.
241          * @exception   E_INVALID_ENCODING_RANGE    The specified input string contains the code points that are outside 
242          *                                          the bounds specified by the US_ASCII encoding scheme.
243          * @exception   E_INVALID_FORMAT            The specified format of the @c name is invalid as per the 
244          *                                          specifications defined for each type of the name format.
245          * @exception   E_MAX_EXCEEDED              The length of the name exceeds @c 256 characters.
246          * @remarks     The input name must not have the prefix defined by the NFC forum such as @c "urn:nfc:wkt:" and 
247          *              @c "urn:nfc:ext:".
248          */
249         result SetName(const Tizen::Base::String& name);
250
251 private:
252         _NdefRecordTypeImpl* __pImpl;
253
254         friend class _NdefRecordTypeImpl;
255
256 }; // NdefRecordType
257
258 } } } // Tizen::Net::Nfc
259
260 #endif // _FNET_NFC_NDEF_RECORD_TYPE_H_