Merge "[Tizen.WebView] Fix document build warnings"
[platform/core/csapi/tizenfx.git] / src / Tizen.Pims.Calendar / Tizen.Pims.Calendar / CalendarQuery.cs
index 941699a..050e7a8 100644 (file)
  */
 
 using System;
-using static Interop.Calendar.Query;
+using System.Diagnostics.CodeAnalysis;
 
 namespace Tizen.Pims.Calendar
 {
+    /// <summary>
     /// A query is used to retrieve data which satisfies given criteria.
     /// </summary>
+    /// <since_tizen> 4 </since_tizen>
     /// <remarks>
     /// A query is used to retrieve calendar data which satisfies a given criteria,
     /// such as an integer property being greater than a given value,
     /// or a string property containing a given substring.
     /// A query needs a filter which can set the conditions for the search.
     /// </remarks>
-    public class CalendarQuery : IDisposable
+    public class CalendarQuery:IDisposable
     {
         internal IntPtr _queryHandle;
 
         /// <summary>
         /// Creates a query.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        /// <feature>http://tizen.org/feature/calendar</feature>
         /// <param name="viewUri">The view URI of a query</param>
-        /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+        /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
         /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
         /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+        [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")]
         public CalendarQuery(string viewUri)
         {
-            int error = Interop.Calendar.Query.Create(viewUri, out _queryHandle);
+            int error = Interop.Query.Create(viewUri, out _queryHandle);
             if (CalendarError.None != (CalendarError)error)
             {
                 Log.Error(Globals.LogTag, "CalendarQuery Failed with error " + error);
@@ -53,6 +58,9 @@ namespace Tizen.Pims.Calendar
             _queryHandle = handle;
         }
 
+        /// <summary>
+        /// Destructor
+        /// </summary>
         ~CalendarQuery()
         {
             Dispose(false);
@@ -61,17 +69,20 @@ namespace Tizen.Pims.Calendar
 #region IDisposable Support
         private bool disposedValue = false;
 
+        /// <summary>
+        /// Disposes of the resources (other than memory) used by the CalendarQuery.
+        /// </summary>
+        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (!disposedValue)
             {
                 Log.Debug(Globals.LogTag, "Dispose :" + disposing);
 
-                int error = Interop.Calendar.Query.Destroy(_queryHandle);
+                int error = Interop.Query.Destroy(_queryHandle);
                 if (CalendarError.None != (CalendarError)error)
                 {
                     Log.Error(Globals.LogTag, "CalendarQueryDestroy Failed with error " + error);
-                    throw CalendarErrorFactory.GetException(error);
                 }
                 disposedValue = true;
             }
@@ -79,22 +90,31 @@ namespace Tizen.Pims.Calendar
 
         /// <summary>
         /// Releases all resources used by the CalendarQuery.
-        /// It should be called after finished using of the object.
+        /// It should be called after having finished using of the object.
         /// </summary>
         public void Dispose()
         {
             Dispose(true);
+            GC.SuppressFinalize(this);
         }
 #endregion
 
         /// <summary>
         /// Adds property IDs for projection.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="propertyIdArray">The property ID array </param>
+        /// <feature>http://tizen.org/feature/calendar</feature>
+        /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
         /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
         public void SetProjection(uint[] propertyIdArray)
         {
-            int error = Interop.Calendar.Query.SetProjection(_queryHandle, propertyIdArray, propertyIdArray.Length);
+            if (propertyIdArray == null)
+            {
+                throw new ArgumentException("Invalid Parameters Provided");
+            }
+
+            int error = Interop.Query.SetProjection(_queryHandle, propertyIdArray, propertyIdArray.Length);
             if (CalendarError.None != (CalendarError)error)
             {
                 Log.Error(Globals.LogTag, "SetProjection Failed with error " + error);
@@ -105,11 +125,14 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Sets the "distinct" option for projection.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="set">If true it is set, otherwise if false it is unset</param>
+        /// <feature>http://tizen.org/feature/calendar</feature>
+        /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
         /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
         public void SetDistinct(bool set)
         {
-            int error = Interop.Calendar.Query.SetDistinct(_queryHandle, set);
+            int error = Interop.Query.SetDistinct(_queryHandle, set);
             if (CalendarError.None != (CalendarError)error)
             {
                 Log.Error(Globals.LogTag, "SetDistinct Failed with error " + error);
@@ -120,11 +143,14 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Sets the filter for a query.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="filter">The filter</param>
+        /// <feature>http://tizen.org/feature/calendar</feature>
+        /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
         /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
         public void SetFilter(CalendarFilter filter)
         {
-            int error = Interop.Calendar.Query.SetFilter(_queryHandle, filter._filterHandle);
+            int error = Interop.Query.SetFilter(_queryHandle, filter._filterHandle);
             if (CalendarError.None != (CalendarError)error)
             {
                 Log.Error(Globals.LogTag, "SetFilter Failed with error " + error);
@@ -135,12 +161,15 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Sets the sort mode for a query.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="propertyId">The property ID to sort</param>
         /// <param name="isAscending">If true it sorts in the ascending order, otherwise if false it sorts in the descending order</param>
+        /// <feature>http://tizen.org/feature/calendar</feature>
+        /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
         /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
         public void SetSort(uint propertyId, bool isAscending)
         {
-            int error = Interop.Calendar.Query.SetSort(_queryHandle, propertyId, isAscending);
+            int error = Interop.Query.SetSort(_queryHandle, propertyId, isAscending);
             if (CalendarError.None != (CalendarError)error)
             {
                 Log.Error(Globals.LogTag, "SetSort Failed with error " + error);