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