Ejemplo n.º 1
0
        public object get_SortKeyVariant(string bstrValue, LgCollatingOptions colopt)
        {
            EnsureCollator();
            var sortKey = m_collator.GetSortKey(bstrValue).KeyData;

            return(sortKey);
        }
Ejemplo n.º 2
0
        public object get_SortKeyVariant(string bstrValue, LgCollatingOptions colopt)
        {
            EnsureCollator();
            byte[] pbKey = Icu.GetSortKey(m_pCollator, bstrValue);

            return(pbKey);
        }
Ejemplo n.º 3
0
        public int Compare(string bstrValue1, string bstrValue2, LgCollatingOptions colopt)
        {
            EnsureCollator();
            var key1 = m_collator.GetSortKey(bstrValue1).KeyData;
            var key2 = m_collator.GetSortKey(bstrValue2).KeyData;

            return(CompareVariant(key1, key2, colopt));
        }
Ejemplo n.º 4
0
        public int Compare(string bstrValue1, string bstrValue2, LgCollatingOptions colopt)
        {
            EnsureCollator();
            byte[] pbKey1 = Icu.GetSortKey(m_pCollator, bstrValue1);
            byte[] pbKey2 = Icu.GetSortKey(m_pCollator, bstrValue2);

            return(CompareVariant(pbKey1, pbKey2, colopt));
        }
Ejemplo n.º 5
0
		public int Compare(string bstrValue1, string bstrValue2, LgCollatingOptions colopt)
		{
			EnsureCollator();
			byte[] pbKey1 = Icu.GetSortKey(m_pCollator, bstrValue1);
			byte[] pbKey2 = Icu.GetSortKey(m_pCollator, bstrValue2);

			return CompareVariant(pbKey1, pbKey2, colopt);
		}
Ejemplo n.º 6
0
        public object get_SortKeyVariant(string bstrValue, LgCollatingOptions colopt)
        {
            EnsureCollator();

            Int32 cbKey = keysize;

            byte[] rgbKey = new byte[keysize + 1];
            byte[] vbKey  = null;
            byte[] pbKey  = GetSortKey(bstrValue, rgbKey, ref cbKey, out vbKey);

            return(pbKey);
        }
Ejemplo n.º 7
0
        public void CompareTest()
        {
            using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
            {
                Assert.IsNotNull(icuCollator);

                var options = new LgCollatingOptions();

                Assert.IsTrue(icuCollator.Compare(string.Empty, String.Empty, options) == 0);
                Assert.IsTrue(icuCollator.Compare("abc", "abc", options) == 0);
                Assert.IsTrue(icuCollator.Compare("abc", "def", options) != 0);
            }
        }
		public void GetSortKeyVariantTest()
		{
			using (var icuCollator= ManagedLgIcuCollatorInitializerHelper())
			{
				Assert.IsNotNull(icuCollator);

				var options = new LgCollatingOptions();

				object obj = icuCollator.get_SortKeyVariant("abc", options);
				Assert.IsNotNull(obj);

				icuCollator.Close();
			}
		}
Ejemplo n.º 9
0
        public void GetSortKeyTest()
        {
            using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
            {
                Assert.IsNotNull(icuCollator);

                var options = new LgCollatingOptions();

                string result = icuCollator.get_SortKey("abc", options);
                Assert.IsNotEmpty(result);

                icuCollator.Close();
            }
        }
Ejemplo n.º 10
0
 public void GeneralTestWithTwoDifferentWs()
 {
     using (var icuCollator1 = new ManagedLgIcuCollator())
     {
         icuCollator1.Open("en");
         var    options = new LgCollatingOptions();
         object result1 = icuCollator1.get_SortKeyVariant("test", options);
         using (var icuCollator2 = new ManagedLgIcuCollator())
         {
             icuCollator2.Open("fr");
             object result2 = icuCollator2.get_SortKeyVariant("test", options);
         }
     }
 }
Ejemplo n.º 11
0
        public void GetSortKeyVariantTest()
        {
            using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
            {
                Assert.IsNotNull(icuCollator);

                var options = new LgCollatingOptions();

                object obj = icuCollator.get_SortKeyVariant("abc", options);
                Assert.IsNotNull(obj);

                icuCollator.Close();
            }
        }
		public void GetSortKeyTest()
		{
			using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
			{
				Assert.IsNotNull(icuCollator);

				var options = new LgCollatingOptions();

				string result = icuCollator.get_SortKey("abc", options);
				Assert.IsNotEmpty(result);

				icuCollator.Close();
			}
		}
		public void GeneralTestWithTwoDifferentWs()
		{
			using (var icuCollator1 = new ManagedLgIcuCollator())
			{
				icuCollator1.Open("en");
				var options = new LgCollatingOptions();
				object result1 = icuCollator1.get_SortKeyVariant("test", options);
				using (var icuCollator2 = new ManagedLgIcuCollator())
				{
					icuCollator2.Open("fr");
					object result2 = icuCollator2.get_SortKeyVariant("test", options);
				}
			}
		}
Ejemplo n.º 14
0
        public int Compare(string bstrValue1, string bstrValue2, LgCollatingOptions colopt)
        {
            EnsureCollator();
            Int32 cbKey1 = keysize;

            byte[] rgbKey1 = new byte[keysize + 1];
            byte[] vbKey1  = null;
            byte[] pbKey1  = GetSortKey(bstrValue1, rgbKey1, ref cbKey1, out vbKey1);

            Int32 cbKey2 = keysize;

            byte[] rgbKey2 = new byte[keysize + 1];
            byte[] vbKey2  = null;
            byte[] pbKey2  = GetSortKey(bstrValue2, rgbKey2, ref cbKey2, out vbKey2);

            return(CompareVariant(pbKey1, pbKey2, colopt));
        }
Ejemplo n.º 15
0
        public void CompareVariantTest1()
        {
            using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
            {
                Assert.IsNotNull(icuCollator);

                var options = new LgCollatingOptions();

                object obj1 = icuCollator.get_SortKeyVariant("abc", options);
                object obj2 = obj1;
                object obj3 = icuCollator.get_SortKeyVariant("def", options);

                Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) == 0, " obj1 == obj2");
                Assert.IsTrue(icuCollator.CompareVariant(obj1, obj3, options) != 0, " obj1 != obj3");

                icuCollator.Close();
            }
        }
Ejemplo n.º 16
0
        public int CompareVariant(object saValue1, object saValue2, LgCollatingOptions colopt)
        {
            byte[] key1 = saValue1 as byte[];
            byte[] key2 = saValue2 as byte[];

            EnsureCollator();

            if (key1 == null)
            {
                return(1);
            }
            if (key2 == null)
            {
                return(-1);
            }

            int maxlen = key1.Length > key2.Length ? key1.Length : key2.Length;

            for (int i = 0; i < maxlen; ++i)
            {
                if (key1[i] > key2[i])
                {
                    return(1);
                }
                if (key2[i] > key1[i])
                {
                    return(-1);
                }
            }

            if (key1.Length > key2.Length)
            {
                return(1);
            }
            if (key2.Length > key1.Length)
            {
                return(-1);
            }

            return(0);
        }
Ejemplo n.º 17
0
        public void SortKeyVariantTestWithValues()
        {
            using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
            {
                Assert.IsNotNull(icuCollator);

                var options = new LgCollatingOptions();

                object obj1 = icuCollator.get_SortKeyVariant("action", options);

                Assert.That((obj1 as byte[])[0], Is.EqualTo(41));
                Assert.That((obj1 as byte[])[1], Is.EqualTo(45));
                Assert.That((obj1 as byte[])[2], Is.EqualTo(79));
                Assert.That((obj1 as byte[])[3], Is.EqualTo(57));
                Assert.That((obj1 as byte[])[4], Is.EqualTo(69));
                Assert.That((obj1 as byte[])[5], Is.EqualTo(67));
                Assert.That((obj1 as byte[])[6], Is.EqualTo(1));
                Assert.That((obj1 as byte[])[7], Is.EqualTo(10));
                Assert.That((obj1 as byte[])[8], Is.EqualTo(1));
                Assert.That((obj1 as byte[])[9], Is.EqualTo(10));
                Assert.That((obj1 as byte[])[10], Is.EqualTo(0));
            }
        }
        public void SortKeyVariantTestWithValues()
        {
            using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
            {
                Assert.IsNotNull(icuCollator);

                var options = new LgCollatingOptions();

                object obj1 = icuCollator.get_SortKeyVariant("action", options);

                Assert.IsTrue((obj1 as byte[])[0] == 44);
                Assert.IsTrue((obj1 as byte[])[1] == 48);
                Assert.IsTrue((obj1 as byte[])[2] == 82);
                Assert.IsTrue((obj1 as byte[])[3] == 60);
                Assert.IsTrue((obj1 as byte[])[4] == 72);
                Assert.IsTrue((obj1 as byte[])[5] == 70);
                Assert.IsTrue((obj1 as byte[])[6] == 1);
                Assert.IsTrue((obj1 as byte[])[7] == 10);
                Assert.IsTrue((obj1 as byte[])[8] == 1);
                Assert.IsTrue((obj1 as byte[])[9] == 10);
                Assert.IsTrue((obj1 as byte[])[10] == 0);
            }
        }
Ejemplo n.º 19
0
        public void CompareVariantTest2()
        {
            using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
            {
                Assert.IsNotNull(icuCollator);

                var options = new LgCollatingOptions();

                object obj1 = icuCollator.get_SortKeyVariant("action", options);
                object obj2 = icuCollator.get_SortKeyVariant("actiom", options);

                Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) != 0, " action != actionm");

                obj1 = icuCollator.get_SortKeyVariant("tenepa", options);
                obj2 = icuCollator.get_SortKeyVariant("tenepo", options);
                Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) != 0, " tenepa != tenepo");

                obj1 = icuCollator.get_SortKeyVariant("hello", options);
                obj2 = icuCollator.get_SortKeyVariant("hello", options);

                Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) == 0, " hello == hello");


                obj1 = icuCollator.get_SortKeyVariant("tenepaa", options);
                obj2 = icuCollator.get_SortKeyVariant("tenepa", options);

                Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) > 0, " tenepaa > tenepa");

                obj1 = icuCollator.get_SortKeyVariant("tenepa", options);
                obj2 = icuCollator.get_SortKeyVariant("tenepaa", options);

                Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) < 0, " tenepaa < tenepa");

                icuCollator.Close();
            }
        }
		public void CompareTest()
		{
			using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
			{
				Assert.IsNotNull(icuCollator);

				var options = new LgCollatingOptions();

				Assert.IsTrue(icuCollator.Compare(string.Empty, String.Empty, options) == 0);
				Assert.IsTrue(icuCollator.Compare("abc", "abc", options) == 0);
				Assert.IsTrue(icuCollator.Compare("abc", "def", options) != 0);
			}
		}
		public void CompareVariantTest1()
		{
			using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
			{
				Assert.IsNotNull(icuCollator);

				var options = new LgCollatingOptions();

				object obj1 = icuCollator.get_SortKeyVariant("abc", options);
				object obj2 = obj1;
				object obj3 = icuCollator.get_SortKeyVariant("def", options);

				Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) == 0, " obj1 == obj2");
				Assert.IsTrue(icuCollator.CompareVariant(obj1, obj3, options) != 0, " obj1 != obj3");

				icuCollator.Close();
			}
		}
		public void CompareVariantTest2()
		{
			using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
			{
				Assert.IsNotNull(icuCollator);

				var options = new LgCollatingOptions();

				object obj1 = icuCollator.get_SortKeyVariant("action", options);
				object obj2 = icuCollator.get_SortKeyVariant("actiom", options);

				Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) != 0, " action != actionm");

				obj1 = icuCollator.get_SortKeyVariant("tenepa", options);
				obj2 = icuCollator.get_SortKeyVariant("tenepo", options);
				Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) != 0, " tenepa != tenepo");

				obj1 = icuCollator.get_SortKeyVariant("hello", options);
				obj2 = icuCollator.get_SortKeyVariant("hello", options);

				Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) == 0, " hello == hello");


				obj1 = icuCollator.get_SortKeyVariant("tenepaa", options);
				obj2 = icuCollator.get_SortKeyVariant("tenepa", options);

				Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) > 0, " tenepaa > tenepa");

				obj1 = icuCollator.get_SortKeyVariant("tenepa", options);
				obj2 = icuCollator.get_SortKeyVariant("tenepaa", options);

				Assert.IsTrue(icuCollator.CompareVariant(obj1, obj2, options) < 0, " tenepaa < tenepa");

				icuCollator.Close();
			}
		}
		public void SortKeyVariantTestWithValues()
		{
			using (var icuCollator = ManagedLgIcuCollatorInitializerHelper())
			{
				Assert.IsNotNull(icuCollator);

				var options = new LgCollatingOptions();

				object obj1 = icuCollator.get_SortKeyVariant("action", options);

				Assert.IsTrue((obj1 as byte[])[0] == 44);
				Assert.IsTrue((obj1 as byte[])[1] == 48);
				Assert.IsTrue((obj1 as byte[])[2] == 82);
				Assert.IsTrue((obj1 as byte[])[3] == 60);
				Assert.IsTrue((obj1 as byte[])[4] == 72);
				Assert.IsTrue((obj1 as byte[])[5] == 70);
				Assert.IsTrue((obj1 as byte[])[6] == 1);
				Assert.IsTrue((obj1 as byte[])[7] == 10);
				Assert.IsTrue((obj1 as byte[])[8] == 1);
				Assert.IsTrue((obj1 as byte[])[9] == 10);
				Assert.IsTrue((obj1 as byte[])[10] == 0);
			}
		}
Ejemplo n.º 24
0
 public void SortKeyRgch(string _ch, int cchIn, LgCollatingOptions colopt, int cchMaxOut, ArrayPtr _chKey, out int _cchOut)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 25
0
		public void SortKeyRgch(string _ch, int cchIn, LgCollatingOptions colopt, int cchMaxOut, ArrayPtr _chKey, out int _cchOut)
		{
			throw new NotImplementedException();
		}
Ejemplo n.º 26
0
		public int CompareVariant(object saValue1, object saValue2, LgCollatingOptions colopt)
		{
			byte[] key1 = saValue1 as byte[];
			byte[] key2 = saValue2 as byte[];

			EnsureCollator();

			if (key1 == null)
			{
				return 1;
			}
			if (key2 == null)
			{
				return -1;
			}

			int maxlen = key1.Length > key2.Length ? key1.Length : key2.Length;
			for (int i = 0; i < maxlen; ++i)
			{
				if (key1[i] > key2[i])
					return 1;
				if (key2[i] > key1[i])
					return -1;
			}

			if (key1.Length > key2.Length)
				return 1;
			if (key2.Length > key1.Length)
				return -1;

			return 0;
		}
Ejemplo n.º 27
0
 public string get_SortKey(string bstrValue, LgCollatingOptions colopt)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 28
0
		public string get_SortKey(string bstrValue, LgCollatingOptions colopt)
		{
			throw new NotImplementedException();
		}
Ejemplo n.º 29
0
		public object get_SortKeyVariant(string bstrValue, LgCollatingOptions colopt)
		{
			EnsureCollator();
			byte[] pbKey = Icu.GetSortKey(m_pCollator, bstrValue);

			return pbKey;
		}