1*37adc4f0SAndrew Rist /**************************************************************
2*37adc4f0SAndrew Rist  *
3*37adc4f0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*37adc4f0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*37adc4f0SAndrew Rist  * distributed with this work for additional information
6*37adc4f0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*37adc4f0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*37adc4f0SAndrew Rist  * "License"); you may not use this file except in compliance
9*37adc4f0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*37adc4f0SAndrew Rist  *
11*37adc4f0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*37adc4f0SAndrew Rist  *
13*37adc4f0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*37adc4f0SAndrew Rist  * software distributed under the License is distributed on an
15*37adc4f0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*37adc4f0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*37adc4f0SAndrew Rist  * specific language governing permissions and limitations
18*37adc4f0SAndrew Rist  * under the License.
19*37adc4f0SAndrew Rist  *
20*37adc4f0SAndrew Rist  *************************************************************/
21*37adc4f0SAndrew Rist 
22*37adc4f0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "sal/config.h"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <algorithm>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "osl/diagnose.h"
29cdf0e10cSrcweir #include "rtl/byteseq.hxx"
30cdf0e10cSrcweir #include "rtl/ustring.hxx"
31cdf0e10cSrcweir #include "sal/types.h"
32cdf0e10cSrcweir #include "typelib/typeclass.h"
33cdf0e10cSrcweir #include "typelib/typedescription.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include "lessoperators.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace uno {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir bool operator <(TypeDescription const & left, TypeDescription const & right) {
40cdf0e10cSrcweir     OSL_ASSERT(left.is() && right.is());
41cdf0e10cSrcweir     typelib_TypeClass tc1 = left.get()->eTypeClass;
42cdf0e10cSrcweir     typelib_TypeClass tc2 = right.get()->eTypeClass;
43cdf0e10cSrcweir     return tc1 < tc2 ||
44cdf0e10cSrcweir         (tc1 == tc2 &&
45cdf0e10cSrcweir          (rtl::OUString(left.get()->pTypeName) <
46cdf0e10cSrcweir           rtl::OUString(right.get()->pTypeName)));
47cdf0e10cSrcweir }
48cdf0e10cSrcweir 
49cdf0e10cSrcweir } } } }
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace rtl {
52cdf0e10cSrcweir 
53cdf0e10cSrcweir bool operator <(ByteSequence const & left, ByteSequence const & right) {
54cdf0e10cSrcweir     for (sal_Int32 i = 0; i != std::min(left.getLength(), right.getLength());
55cdf0e10cSrcweir          ++i)
56cdf0e10cSrcweir     {
57cdf0e10cSrcweir         if (left[i] < right[i]) {
58cdf0e10cSrcweir             return true;
59cdf0e10cSrcweir         }
60cdf0e10cSrcweir         if (right[i] < left[i]) {
61cdf0e10cSrcweir             return false;
62cdf0e10cSrcweir         }
63cdf0e10cSrcweir     }
64cdf0e10cSrcweir     return left.getLength() < right.getLength();
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir }
68