|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Comparison functions used for SQl and indexing |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __D32COMP_H__ |
|
19 #define __D32COMP_H__ |
|
20 |
|
21 #ifndef __D32DBAS_H__ |
|
22 #include "D32DBAS.H" |
|
23 #endif |
|
24 |
|
25 /** |
|
26 @internalComponent |
|
27 */ |
|
28 class Comp |
|
29 { |
|
30 public: |
|
31 static inline TInt Compare(TInt32 aLeft,TInt32 aRight); |
|
32 static inline TInt Compare(TUint32 aLeft,TUint32 aRight); |
|
33 static TInt Compare(TReal32 aLeft,TReal32 aRight); |
|
34 static TInt Compare(TReal64 aLeft,TReal64 aRight); |
|
35 static TInt Compare(const TInt64& aLeft,const TInt64& aRight); |
|
36 static inline TInt Compare(const TTime& aLeft,const TTime& aRight); |
|
37 // |
|
38 static TInt Compare8L(MStreamBuf& aBufL,MStreamBuf& aBufR,TInt aSize,const TTextOps& aTextOp); |
|
39 static TInt Compare8L(MStreamBuf& aBuf,const TText8* aPtr,TInt aSize,const TTextOps& aTextOp); |
|
40 static TInt Compare8L(MStreamBuf& aBuf,TInt aSize,const TDesC8& aDes,const TTextOps& aTextOp); |
|
41 // |
|
42 static TInt Compare16L(MStreamBuf& aBufL,MStreamBuf& aBufR,TInt aSize,const TTextOps& aTextOp); |
|
43 static TInt Compare16L(MStreamBuf& aBuf,const TText16* aPtr,TInt aSize,const TTextOps& aTextOp); |
|
44 static TInt Compare16L(MStreamBuf& aBuf,TInt aSize,const TDesC16& aDes,const TTextOps& aTextOp); |
|
45 }; |
|
46 |
|
47 // class Comp |
|
48 inline TInt Comp::Compare(TInt32 aLeft,TInt32 aRight) |
|
49 { |
|
50 return aLeft<aRight ? -1 : aLeft!=aRight; |
|
51 } |
|
52 |
|
53 inline TInt Comp::Compare(TUint32 aLeft,TUint32 aRight) |
|
54 { |
|
55 return aLeft<aRight ? -1 : aLeft!=aRight; |
|
56 } |
|
57 |
|
58 inline TInt Comp::Compare(const TTime& aLeft,const TTime& aRight) |
|
59 { |
|
60 return Compare(aLeft.Int64(),aRight.Int64()); |
|
61 } |
|
62 |
|
63 #endif |