sync with tizen_2.0
[platform/framework/native/appfw.git] / src / locales / FLcl_FieldPosition.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 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        FLcl_FieldPosition.h
20  * @brief       This is the header file for the FieldPosition class.
21  */
22
23 #ifndef _FLCL_INTERNAL_FIELD_POSITION_H_
24 #define _FLCL_INTERNAL_FIELD_POSITION_H_
25
26 // Includes
27 #include <FBaseObject.h>
28
29
30 namespace Tizen { namespace Locales
31 {
32
33
34 /**
35  * @class       _FieldPosition
36  * @brief       This class is for the @e Field position management.
37  *
38  * @since       1.0
39  *
40  * @final       This class is not intended for extension.
41  *
42  * FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted output.
43  * FieldPosition keeps track of the position of the field within the formatted output with two indices:
44  * the index of the first character of the field and the index of the last character of the field.
45  *
46  * The example code below should be updated.
47  *  @code
48
49     #include "FBase.h"
50     #include "FLocales.h"
51
52     using Tizen::Base;
53     using Tizen::Locales;
54
55     void
56     main(void)
57     {
58         result r;
59         double num = 12345678.9
60         NumberFormat* pMyFormat;
61         pMyFormat = NumberFormat::CreateNumberFormat();
62         if (IsFailed(GetLastResult())) goto CATCH;
63         FieldPosition fp(NumberFormat::ALIGNMENT_FIELD_INTEGER);
64
65         String strBuf;
66         strBuf.Contruct();
67         r = pMyFormat->Format(doubleNum,  fp, strBuf);
68         if (IsFailed(r) ) goto CATCH;
69         return;
70
71     CATCH:
72      // Error handling code
73     }
74
75     @endcode
76  *
77  *
78  */
79 class _FieldPosition
80         : public Tizen::Base::Object
81 {
82 // Construct Operations
83 public:
84         /**
85          * Initializes an instance of FieldPosition with the specified field identifier.
86          *
87          * @param[in]   field           The field identifier
88          */
89         _FieldPosition(int field);
90
91
92         /**
93          * Initializes an instance of FieldPosition with the values same as that of the specified instance.
94          *
95          * @param[in]   fieldPosition   An instance of FieldPosition
96          */
97         _FieldPosition(const _FieldPosition& fieldPosition);
98
99
100         /**
101          * This is the destructor for this class.
102          */
103         virtual ~_FieldPosition(void);
104
105
106 // Operations
107 public:
108         /**
109          * Assigns the values of the member variables of the specified instance of FieldPosition
110          * to the member variables of the current instance.
111          *
112          * @return          An FieldPosition object with new values for the member variables
113          * @param[in]   fieldPosition       The other FieldPosition instance
114          */
115         _FieldPosition& operator =(const _FieldPosition& fieldPosition);
116
117
118         /**
119          * Gets the field identifier.
120          *
121          * @return      An integer value representing the field identifier
122          *
123          */
124         int GetField(void) const;
125
126
127         /**
128          * Gets the index of the first character in the requested field.
129          *
130          * @return      An integer value representing the begin index
131          *
132          * @see         SetBeginIndex
133          *
134          */
135         int GetBeginIndex(void) const;
136
137
138         /**
139          * Sets the begin index with the specified index value.
140          *
141          * @param[in]   beginIndex      The begin index of the field
142          *
143          * @see         GetBeginIndex
144          *
145          */
146         void SetBeginIndex(int beginIndex);
147
148
149         /**
150          * Gets the index of the character following the last character in the requested field.
151          *
152          * @return      An integer value representing the end index
153          *
154          * @see         SetEndIndex
155          *
156          */
157         int GetEndIndex(void) const;
158
159
160         /**
161          * Sets the end index with the specified index value.
162          *
163          * @param[in]   endIndex        The end index of the field
164          *
165          * @see         GetEndIndex
166          *
167          */
168         void SetEndIndex(int endIndex);
169
170
171 private:
172         int __field;            // field identifier of this field position
173         int __beginIndex;       // begin index of this field position
174         int __endIndex;         // end index of this field position
175 }; // FieldPosition
176
177 }} // Tizen::Locales
178
179 #endif //_FLCL_INTERNAL_FIELD_POSITION_H_