1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef __DMTATTRIBUTES_H__
18#define __DMTATTRIBUTES_H__
19
20#ifndef __cplusplus
21#error "This is a C++ header file; it requires C++ to compile."
22#endif
23
24/**
25 \file dmtAttributes.hpp
26 \brief  The dmtAttributes.hpp header file contains DmtAttributes class definition. \n
27           This class encapsulates all standard DMT attributes.
28*/
29
30#include "jem_defs.hpp"
31#include "dmtAcl.hpp"
32
33/**
34* This class encapsulates all standard DMT attributes.<P>
35*
36* <TABLE>
37* <TR><TD>ACL</TD><TD>Access Control List</TD></TR>
38* <TR><TD>Format</TD><TD>Specifies how object values should be interpreted (b64, int, boolean, string ��)</TD></TR>
39* <TR><TD>Name</TD><TD>The name of the object in the tree</TD></TR>
40* <TR><TD>Size</TD><TD>Size of the object value in bytes</TD></TR>
41* <TR><TD>Title</TD><TD>Human readable name</TD></TR>
42* <TR><TD>TStamp</TD><TD>Time stamp, date and time of last change</TD></TR>
43* <TR><TD>Type</TD><TD>The MIME type of the object</TD></TR>
44* <TR><TD>VerNo</TD><TD>Version number, automatically incremented at each modification</TD></TR>
45* </TABLE>
46* \par Category: General
47* \par Persistence: Transient
48* \par Security: Non-Secure
49* \par Migration State: FINAL
50*/
51class DmtAttributes
52{
53private:
54  DMString  m_strName;
55  DMString  m_strFormat;
56  DMString  m_strTitle;
57  DMString  m_strType;
58  INT32     m_nVersion;
59  INT32     m_nSize;
60  JemDate    m_nTimestamp;
61  DmtAcl     m_oAcl;
62
63public:
64 /**
65  * Default constructor - no memory allocation performed.
66  */
67  DmtAttributes();
68
69  /**
70   * Constructs DmtAttributes object with provided values . The memory required for DmtAttributes object will be allocated.
71   * \param name [in] - Name of attribute
72   * \param format [in] - Attribute format
73   * \param title [in] - Attribute titles
74   * \param type [in] - Attribute type
75   * \param version [in] - Version number
76   * \param size [in] - Attribute size
77   * \param timestamp [in] - Timestamp is number of milliseconds since the standard base time known as "the epoch",
78   * namely January 1, 1970, 00:00:00 GMT.
79   * which is locale-independent.
80   * \param acl [in] - access control list (DmtAcl type)
81   */
82  DmtAttributes( CPCHAR name,
83                 CPCHAR format,
84                 CPCHAR title,
85                 CPCHAR type,
86                 INT32 version,
87                 INT32 size,
88                 const JemDate& timestamp,
89                 const DmtAcl& acl);
90
91  /**
92  * Sets all required parameters.
93  * \par Sync (or) Async:
94  * This is a Synchronous function.
95  * \par Secure (or) Non-Secure (or) N/A:
96  * This is a Non-Secure function.
97  * \param name [in] - Name of attribute
98  * \param format [in] - Attribute format
99  * \param title [in] - Attribute titles
100  * \param type [in] - Attribute type
101  * \param version [in] - Version number
102  * \param size [in] - Attribute size
103  * \param timestamp [in] - Timestamp is number of milliseconds since the standard base time known as "the epoch",
104  * namely January 1, 1970, 00:00:00 GMT.
105  * which is locale-independent.
106  * \param acl [in] - access control list (DmtAcl type)
107  * \return Return Type (SYNCML_DM_RET_STATUS_T) \n
108  * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n
109  * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n
110  * \par Prospective Clients:
111  * All potential applications that require configuration settings.
112  */
113   SYNCML_DM_RET_STATUS_T Set( CPCHAR name,
114                              CPCHAR format,
115                              CPCHAR title,
116                              CPCHAR type,
117                              INT32 version,
118                              INT32 size,
119                              const JemDate& timestamp,
120                              const DmtAcl& acl);
121
122
123
124  /**
125  * Sets all required parameters.
126  * \par Sync (or) Async:
127  * This is a Synchronous function.
128  * \par Secure (or) Non-Secure (or) N/A:
129  * This is a Non-Secure function.
130  * \param oAttr [in] - reference to DmtAttributes object with all attributes
131  * \return Return Type (SYNCML_DM_RET_STATUS_T) \n
132  * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n
133  * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n
134  * \par Prospective Clients:
135  * All potential applications that require configuration settings.
136  */
137   SYNCML_DM_RET_STATUS_T Set( const DmtAttributes & oAttr );
138
139
140  /**
141  * Sets name of the Node
142  * \par Sync (or) Async:
143  * This is a Synchronous function.
144  * \par Secure (or) Non-Secure (or) N/A:
145  * This is a Non-Secure function.
146  * \param name [in] - name of the node
147  * \return Return Type (SYNCML_DM_RET_STATUS_T) \n
148  * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n
149  * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n
150  * \par Prospective Clients:
151  * All potential applications that require configuration settings.
152  */
153   SYNCML_DM_RET_STATUS_T SetName( CPCHAR name);
154
155  /**
156  * Sets title of the Node
157  * \par Sync (or) Async:
158  * This is a Synchronous function.
159  * \par Secure (or) Non-Secure (or) N/A:
160  * This is a Non-Secure function.
161  * \param title [in] - title of the node
162  * \return Return Type (SYNCML_DM_RET_STATUS_T) \n
163  * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n
164  * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n
165  * \par Prospective Clients:
166  * All potential applications that require configuration settings.
167  */
168   SYNCML_DM_RET_STATUS_T SetTitle( CPCHAR title);
169
170  /**
171  * Sets format of the Node
172  * \par Sync (or) Async:
173  * This is a Synchronous function.
174  * \par Secure (or) Non-Secure (or) N/A:
175  * This is a Non-Secure function.
176  * \param format [in] - format of the node
177  * \return Return Type (SYNCML_DM_RET_STATUS_T) \n
178  * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n
179  * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n
180  * \par Prospective Clients:
181  * All potential applications that require configuration settings.
182  */
183   SYNCML_DM_RET_STATUS_T SetFormat( CPCHAR format);
184
185  /**
186  * Sets size of the Node value in bytes
187  * \par Sync (or) Async:
188  * This is a Synchronous function.
189  * \par Secure (or) Non-Secure (or) N/A:
190  * This is a Non-Secure function.
191  * \param size [in] - size of the node value in bytes
192  * \return None
193  * \par Prospective Clients:
194  * All potential applications that require configuration settings.
195  */
196   void SetSize( INT32 size);
197
198  /**
199  * Retrieves format of the Node.
200  * \par Sync (or) Async:
201  * This is a Synchronous function.
202  * \par Secure (or) Non-Secure (or) N/A:
203  * This is a Non-Secure function.
204  * \return Format (String, Binary, Integer...) of the Node
205  * \par Prospective Clients:
206  * All potential applications that require configuration settings.
207  */
208   inline const DMString& GetFormat() const
209   {
210      return m_strFormat;
211   }
212
213
214  /**
215  * Retrieves name of the node
216  * \par Sync (or) Async:
217  * This is a Synchronous function.
218  * \par Secure (or) Non-Secure (or) N/A:
219  * This is a Non-Secure function.
220  * \return Node name.
221  * \par Prospective Clients:
222  * All potential applications that require configuration settings.
223  */
224   inline const DMString& GetName() const
225   {
226      return m_strName;
227   }
228
229  /**
230  * Retrieves access control list for the node
231  * \par Sync (or) Async:
232  * This is a Synchronous function.
233  * \par Secure (or) Non-Secure (or) N/A:
234  * This is a Non-Secure function.
235  * \return DmtAcl (DMT access control list ) for node
236  * \warning DMT access control could be null!
237  * \par Prospective Clients:
238  * All potential applications that require configuration settings.
239  */
240   inline const DmtAcl& GetAcl() const
241   {
242      return m_oAcl;
243   }
244
245  /**
246  * Retrieves node size
247  * \par Sync (or) Async:
248  * This is a Synchronous function.
249  * \par Secure (or) Non-Secure (or) N/A:
250  * This is a Non-Secure function.
251  * \return node value's size (32-bit).
252  * \par Prospective Clients:
253  * All potential applications that require configuration settings.
254  */
255   inline INT32 GetSize() const
256   {
257      return m_nSize;
258   }
259
260  /**
261  * Retrieves node titles
262  * \par Sync (or) Async:
263  * This is a Synchronous function.
264  * \par Secure (or) Non-Secure (or) N/A:
265  * This is a Non-Secure function.
266  * \return title (optional), could be null.
267  * \par Prospective Clients:
268  * All potential applications that require configuration settings.
269  */
270   inline const DMString& GetTitle() const
271   {
272      return m_strTitle;
273   }
274
275  /**
276  * Retrieves node type
277  * \par Sync (or) Async:
278  * This is a Synchronous function.
279  * \par Secure (or) Non-Secure (or) N/A:
280  * This is a Non-Secure function.
281  * \return Mime-type of the Node, Could be null.
282  * \par Prospective Clients:
283  * All potential applications that require configuration settings.
284  */
285   inline const DMString& GetType() const
286   {
287      return m_strType;
288   }
289
290  /**
291  * Retrieves  timestamp
292  * \par Sync (or) Async:
293  * This is a Synchronous function.
294  * \par Secure (or) Non-Secure (or) N/A:
295  * This is a Non-Secure function.
296  * \return number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
297  * which is locale-independent
298  * \par Prospective Clients:
299  * All potential applications that require configuration settings.
300  */
301   inline const JemDate& GetTimestamp() const
302   {
303      return m_nTimestamp;
304   }
305
306  /**
307  * Retrieves version
308  * \par Sync (or) Async:
309  * This is a Synchronous function.
310  * \par Secure (or) Non-Secure (or) N/A:
311  * This is a Non-Secure function.
312  * \return Version ( a 16 bit unsigned integer ). Each time an object with this property changes value,\n
313  * through a management operation or other event, this value is incremented. If the property\n
314  * value has reached FFFF, and then is incremented, it returns to 0000.\n
315  * \par Prospective Clients:
316  * All potential applications that require configuration settings.
317  */
318   inline INT32 GetVersion() const
319   {
320      return m_nVersion;
321   }
322
323};
324
325//Changed Version from String to int to be compatible with Java API
326
327#endif
328