|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Static utility class for GFLM |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef GFLMUTILS_H |
|
21 #define GFLMUTILS_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32def.h> |
|
26 #include <e32std.h> |
|
27 #include "FileManagerDebug.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class TEntry; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 /** |
|
34 * GflmUtils is a static utility class |
|
35 * |
|
36 * @lib GFLM.lib |
|
37 * @since 2.0 |
|
38 */ |
|
39 NONSHARABLE_CLASS(GflmUtils) |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Returns the index of a Nth character in a descriptor. The search |
|
45 * is started from the end of the descriptor |
|
46 * @since 2.0 |
|
47 * @param aDescriptor The descriptor upon which the search is made |
|
48 * @param aChar The character that is located |
|
49 * @param aNth Tells how many matches are made |
|
50 * @return Index to the located character. KErrNotFound if the character |
|
51 * was not found. KErrArgument if aNth was <= 0 |
|
52 */ |
|
53 static TInt LocateReverseNth( |
|
54 const TDesC& aDescriptor, TChar aChar, const TInt aNth); |
|
55 |
|
56 /** |
|
57 * Ensures that final backslash is set |
|
58 * @since 3.1 |
|
59 * @param aPath |
|
60 */ |
|
61 IMPORT_C static void EnsureFinalBackslash( TDes& aPath ); |
|
62 |
|
63 /** |
|
64 * Strips final backslash if it exists |
|
65 * @since 3.1 |
|
66 * @param aPath |
|
67 * @return Pointer to stripped path |
|
68 */ |
|
69 IMPORT_C static TPtrC StripFinalBackslash( const TDesC& aPath ); |
|
70 |
|
71 /** |
|
72 * Checks if final backslash exist |
|
73 * @since 3.2 |
|
74 * @param aPath Directory path |
|
75 */ |
|
76 IMPORT_C static TBool HasFinalBackslash( const TDesC& aPath ); |
|
77 |
|
78 /** |
|
79 * Gets item full path |
|
80 * @since 3.2 |
|
81 * @param aDir Parent directory path |
|
82 * @param aEntry File system entry |
|
83 * @param aFullPath Full path to item |
|
84 */ |
|
85 IMPORT_C static void GetFullPath( |
|
86 const TDesC& aDir, const TEntry& aEntry, TDes& aFullPath ); |
|
87 |
|
88 /** |
|
89 * Gets item full path |
|
90 * @since 3.2 |
|
91 * @param aDir Parent directory path |
|
92 * @param aEntry File system entry |
|
93 * @return Pointer to full path |
|
94 */ |
|
95 IMPORT_C static HBufC* FullPathLC( |
|
96 const TDesC& aDir, const TEntry& aEntry ); |
|
97 |
|
98 /** |
|
99 * Gets item full path |
|
100 * @since 3.2 |
|
101 * @param aDir Parent directory path |
|
102 * @param aEntry File system entry |
|
103 * @return Pointer to full path |
|
104 */ |
|
105 IMPORT_C static HBufC* FullPathL( |
|
106 const TDesC& aDir, const TEntry& aEntry ); |
|
107 |
|
108 /** |
|
109 * Strips final dot if it exists |
|
110 * @since 3.1 |
|
111 * @param aPath |
|
112 * @return Pointer to stripped path |
|
113 */ |
|
114 static TPtrC StripFinalDot( const TDesC& aPath ); |
|
115 |
|
116 /** |
|
117 * Strips given string from end if it exists |
|
118 * @since 3.2 |
|
119 * @param aString |
|
120 * @param aStringToStrip |
|
121 * @return Pointer to stripped string |
|
122 */ |
|
123 static TPtrC StripFinal( const TDesC& aString, const TDesC& aStringToStrip ); |
|
124 |
|
125 /** |
|
126 * Checks if string contains any wild cards |
|
127 * @since 3.2 |
|
128 * @param aString |
|
129 * @return ETrue if string contains a wild card. Otherwise EFalse. |
|
130 */ |
|
131 static TBool HasWildCard( const TDesC& aString ); |
|
132 |
|
133 }; |
|
134 |
|
135 #endif // GFLMUTILS_H |
|
136 |
|
137 // End of File |