Update ContentFilter class 83/119283/2 accepted/tizen/common/20170316.161912 accepted/tizen/ivi/20170316.101948 accepted/tizen/mobile/20170316.101846 accepted/tizen/tv/20170316.101932 accepted/tizen/unified/20170316.102000 submit/tizen/20170316.093029
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 16 Mar 2017 08:03:52 +0000 (17:03 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 16 Mar 2017 09:00:51 +0000 (18:00 +0900)
Separate collationType by order and condition

Change-Id: I32ae6da990eec8c17bbcaefecccba6d0b497fdb1
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs
packaging/csapi-media-content.spec

index 9f4d848..de26f7c 100755 (executable)
@@ -101,11 +101,21 @@ namespace Tizen.Content.MediaContent
     {
         private IntPtr _filterHandle = IntPtr.Zero;
         private bool _disposedValue = false;
+        private ContentCollation _conditionCollate = ContentCollation.Default;
+        private ContentCollation _orderCollate = ContentCollation.Default;
+        private ContentOrder _orderType = ContentOrder.Asc;
+        private string _orderKeyword = null;
+        private string _conditionMsg = null;
 
         internal IntPtr Handle
         {
             get
             {
+                if (_filterHandle == IntPtr.Zero)
+                {
+                    throw new ObjectDisposedException(nameof(ContentFilter));
+                }
+
                 return _filterHandle;
             }
         }
@@ -120,7 +130,7 @@ namespace Tizen.Content.MediaContent
                 int offset;
                 int count;
                 MediaContentValidator.ThrowIfError(
-                    Interop.Filter.GetOffset(_filterHandle, out offset, out count), "Failed to get offset");
+                    Interop.Filter.GetOffset(Handle, out offset, out count), "Failed to get offset");
 
                 return offset;
             }
@@ -128,7 +138,7 @@ namespace Tizen.Content.MediaContent
             set
             {
                 MediaContentValidator.ThrowIfError(
-                    Interop.Filter.SetOffset(_filterHandle, value, this.Count), "Failed to set offset");
+                    Interop.Filter.SetOffset(Handle, value, this.Count), "Failed to set offset");
             }
         }
 
@@ -148,7 +158,7 @@ namespace Tizen.Content.MediaContent
                 int offset;
                 int count;
                 MediaContentValidator.ThrowIfError(
-                    Interop.Filter.GetOffset(_filterHandle, out offset, out count), "Failed to get count");
+                    Interop.Filter.GetOffset(Handle, out offset, out count), "Failed to get count");
 
                 return count;
             }
@@ -156,7 +166,7 @@ namespace Tizen.Content.MediaContent
             set
             {
                 MediaContentValidator.ThrowIfError(
-                    Interop.Filter.SetOffset(_filterHandle, this.Offset, value), "Failed to set count");
+                    Interop.Filter.SetOffset(Handle, this.Offset, value), "Failed to set count");
             }
         }
 
@@ -167,38 +177,37 @@ namespace Tizen.Content.MediaContent
         {
             get
             {
-                ContentOrder order;
-                IntPtr val = IntPtr.Zero;
-                ContentCollation collate;
-                try
-                {
-                    MediaContentValidator.ThrowIfError(
-                        Interop.Filter.GetOrder(_filterHandle, out order, out val, out collate), "Failed to get order");
+                return _orderType;
+            }
 
-                    return order;
-                }
-                finally
+            set
+            {
+                if (_orderKeyword != null)
                 {
-                    Interop.Libc.Free(val);
+                    MediaContentValidator.ThrowIfError(
+                        Interop.Filter.SetOrder(Handle, value, _orderKeyword, _orderCollate), "Failed to set order");
                 }
+
+                _orderType = value;
             }
         }
 
         /// <summary>
-        /// The collate type for comparing two strings
+        /// The search order keyword
         /// </summary>
-        public ContentCollation CollationType
+        public string OrderKey
         {
             get
             {
+                ContentOrder order;
                 IntPtr val = IntPtr.Zero;
                 ContentCollation type;
                 try
                 {
                     MediaContentValidator.ThrowIfError(
-                        Interop.Filter.GetCondition(_filterHandle, out val, out type), "Failed to get collation");
+                        Interop.Filter.GetOrder(Handle, out order, out val, out type), "Failed to GetOrder for OrderKey");
 
-                    return type;
+                    return Marshal.PtrToStringAnsi(val);
                 }
                 finally
                 {
@@ -209,7 +218,31 @@ namespace Tizen.Content.MediaContent
             set
             {
                 MediaContentValidator.ThrowIfError(
-                    Interop.Filter.SetCondition(_filterHandle, this.Condition, value), "Failed to set collation");
+                    Interop.Filter.SetOrder(Handle, _orderType, value, _orderCollate), "Failed to set OrderKey");
+
+                _orderKeyword = value;
+            }
+        }
+
+        /// <summary>
+        /// The collate type for comparing two strings
+        /// </summary>
+        public ContentCollation OrderCollationType
+        {
+            get
+            {
+                return _orderCollate;
+            }
+
+            set
+            {
+                if (_orderKeyword != null)
+                {
+                    MediaContentValidator.ThrowIfError(
+                        Interop.Filter.SetOrder(Handle, _orderType, _orderKeyword, value), "Failed to set collation");
+                }
+
+                _orderCollate = value;
             }
         }
 
@@ -225,7 +258,7 @@ namespace Tizen.Content.MediaContent
                 try
                 {
                     MediaContentValidator.ThrowIfError(
-                        Interop.Filter.GetCondition(_filterHandle, out val, out type), "Failed to get condition");
+                        Interop.Filter.GetCondition(Handle, out val, out type), "Failed to get condition");
 
                     return Marshal.PtrToStringAnsi(val);
                 }
@@ -238,53 +271,47 @@ namespace Tizen.Content.MediaContent
             set
             {
                 MediaContentValidator.ThrowIfError(
-                    Interop.Filter.SetCondition(_filterHandle, value, this.CollationType), "Failed to set condition");
+                    Interop.Filter.SetCondition(Handle, value, _conditionCollate), "Failed to set condition");
+
+                _conditionMsg = value;
             }
         }
 
         /// <summary>
-        /// Sets the storage id for the given filter.
-        /// You can use this property when you want to search items only in the specific storage
+        /// The collate type for comparing two strings
         /// </summary>
-        public string StorageId
+        public ContentCollation ConditionCollationType
         {
             get
             {
-                IntPtr val = IntPtr.Zero;
-                try
-                {
-                    MediaContentValidator.ThrowIfError(
-                        Interop.Filter.GetStorage(_filterHandle, out val), "Failed to get condition");
-
-                    return Marshal.PtrToStringAnsi(val);
-                }
-                finally
-                {
-                    Interop.Libc.Free(val);
-                }
+                return _conditionCollate;
             }
 
             set
             {
-                MediaContentValidator.ThrowIfError(
-                    Interop.Filter.SetStorage(_filterHandle, value), "Failed to set condition");
+                if (_conditionMsg != null)
+                {
+                    MediaContentValidator.ThrowIfError(
+                        Interop.Filter.SetCondition(Handle, _conditionMsg, value), "Failed to set collation");
+                }
+
+                _conditionCollate = value;
             }
         }
 
         /// <summary>
-        /// The search order keyword
+        /// Sets the storage id for the given filter.
+        /// You can use this property when you want to search items only in the specific storage
         /// </summary>
-        public string OrderKey
+        public string StorageId
         {
             get
             {
-                ContentOrder order;
                 IntPtr val = IntPtr.Zero;
-                ContentCollation type;
                 try
                 {
                     MediaContentValidator.ThrowIfError(
-                        Interop.Filter.GetOrder(_filterHandle, out order, out val, out type), "Failed to GetOrder for OrderKey");
+                        Interop.Filter.GetStorage(Handle, out val), "Failed to get condition");
 
                     return Marshal.PtrToStringAnsi(val);
                 }
@@ -293,6 +320,12 @@ namespace Tizen.Content.MediaContent
                     Interop.Libc.Free(val);
                 }
             }
+
+            set
+            {
+                MediaContentValidator.ThrowIfError(
+                    Interop.Filter.SetStorage(Handle, value), "Failed to set condition");
+            }
         }
 
         /// <summary>
@@ -301,18 +334,6 @@ namespace Tizen.Content.MediaContent
         public MediaGroupType GroupType { get; set; }
 
         /// <summary>
-        /// SetOrderProperties like OrderType and OrderKey.
-        /// </summary>
-        /// <param name="order">ordering type</param>
-        /// <param name="oderKey">Keywords to sort</param>
-        public void SetOrderProperties(ContentOrder order, string oderKey)
-        {
-            MediaContentValidator.ThrowIfError(
-                Interop.Filter.SetOrder(_filterHandle, order, oderKey, CollationType), "Failed to set order");
-        }
-
-
-        /// <summary>
         /// Dispose API for closing the internal resources.
         /// This function can be used to stop all effects started by Vibrate().
         /// </summary>
index 1d0ba47..74088c5 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       csapi-media-content
 Summary:    Tizen Media Content API for C#
-Version:    1.0.9
+Version:    1.0.10
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0