1 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
2 | * Version: CDDL 1.0/LGPL 2.1
|
---|
3 | *
|
---|
4 | * The contents of this file are subject to the COMMON DEVELOPMENT AND
|
---|
5 | * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
|
---|
6 | * this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at http://www.sun.com/cddl/
|
---|
8 | *
|
---|
9 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
11 | * for the specific language governing rights and limitations under the
|
---|
12 | * License.
|
---|
13 | *
|
---|
14 | * The Original Code is "NOM" Netlabs Object Model
|
---|
15 | *
|
---|
16 | * The Initial Developer of the Original Code is
|
---|
17 | * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
|
---|
18 | * Portions created by the Initial Developer are Copyright (C) 2005-2007
|
---|
19 | * the Initial Developer. All Rights Reserved.
|
---|
20 | *
|
---|
21 | * Contributor(s):
|
---|
22 | *
|
---|
23 | * Alternatively, the contents of this file may be used under the terms of
|
---|
24 | * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
|
---|
25 | * case the provisions of the LGPL are applicable instead of those above. If
|
---|
26 | * you wish to allow use of your version of this file only under the terms of
|
---|
27 | * the LGPL, and not to allow others to use your version of this file under
|
---|
28 | * the terms of the CDDL, indicate your decision by deleting the provisions
|
---|
29 | * above and replace them with the notice and other provisions required by the
|
---|
30 | * LGPL. If you do not delete the provisions above, a recipient may use your
|
---|
31 | * version of this file under the terms of any one of the CDDL or the LGPL.
|
---|
32 | *
|
---|
33 | * ***** END LICENSE BLOCK ***** */
|
---|
34 |
|
---|
35 | #ifndef NOMPATH_IDL_INCLUDED
|
---|
36 | #define NOMPATH_IDL_INCLUDED
|
---|
37 |
|
---|
38 | #include "nomstring.idl"
|
---|
39 | #include "nomfoundation.idl"
|
---|
40 |
|
---|
41 | NOMCLASSNAME(NOMPath);
|
---|
42 |
|
---|
43 | /** \class NOMPath
|
---|
44 | NOMPath is a specialized string class for dealing with file or directory paths.
|
---|
45 | */
|
---|
46 | interface NOMPath : NOMString
|
---|
47 | {
|
---|
48 | #ifdef __NOM_IDL_COMPILER__
|
---|
49 | filestem=nomfilepath;
|
---|
50 | #endif
|
---|
51 | /**
|
---|
52 | The current version of this class is 1.0
|
---|
53 | */
|
---|
54 | NOMCLASSVERSION(1, 0);
|
---|
55 |
|
---|
56 | /**
|
---|
57 | Append a path to the string. A path separator will be added to the current path
|
---|
58 | if necessary and the given string appended. If the given string starts with a separator
|
---|
59 | no additional separator will be added to the path prior to appending. If the given string
|
---|
60 | starts with a separator and the current path ends with a separator the ending separator
|
---|
61 | will be removed before appending.
|
---|
62 | If no input path is given only a separator is appended if necessary.
|
---|
63 |
|
---|
64 | \remark
|
---|
65 | Note that there's no check if the input string is an absolute path. So if an absolute path
|
---|
66 | is given as input the resulting path may not be valid.
|
---|
67 |
|
---|
68 | \return
|
---|
69 | The method returns the same NOMPath instance after appending.
|
---|
70 |
|
---|
71 | \sa append(), appendCString()
|
---|
72 | */
|
---|
73 | PNOMPath appendPath(in PNOMPath nomPath);
|
---|
74 |
|
---|
75 | /**
|
---|
76 | Append a separator to the path. If the path already has a separator at the end this method
|
---|
77 | does nothing other than returning the path object. If the given path has zero length
|
---|
78 | the path object only holding a separator is returned.
|
---|
79 |
|
---|
80 | \remark The returned string object is not newly allocated. Be aware that the string data
|
---|
81 | held by the object may.
|
---|
82 |
|
---|
83 | \return
|
---|
84 | This method returns the NOMPath. This is not a copy.
|
---|
85 |
|
---|
86 | \sa append(), appendPath()
|
---|
87 | */
|
---|
88 | PNOMPath appendSeparator();
|
---|
89 |
|
---|
90 | /**
|
---|
91 | Strips the path separator from the end of a path if there's one.
|
---|
92 |
|
---|
93 | \return
|
---|
94 | This method returns the same instance of a NOMPath.
|
---|
95 |
|
---|
96 | \sa appendSeparator()
|
---|
97 | */
|
---|
98 | PNOMPath stripSeparator();
|
---|
99 |
|
---|
100 | /**
|
---|
101 |
|
---|
102 | \remark This method is only implemented for OS/2.
|
---|
103 |
|
---|
104 | \return
|
---|
105 | Returns TRUE if the given path is absolute. On OS/2 this means it starts with a letter
|
---|
106 | followed by a colon.
|
---|
107 | */
|
---|
108 | boolean pathIsAbsolute();
|
---|
109 |
|
---|
110 | /**
|
---|
111 | Returns the root of the current path. On OS/2 that is a letter followed by a colon.
|
---|
112 |
|
---|
113 | \remark This method is only implemented for OS/2.
|
---|
114 |
|
---|
115 | \return
|
---|
116 | This method always returns a new instance of a NOMPath owned by the caller.
|
---|
117 | */
|
---|
118 | PNOMPath queryRoot();
|
---|
119 |
|
---|
120 | /**
|
---|
121 | This method strips all characters from the beginning of a path till the first
|
---|
122 | directory separator and also this first separator. If there's no separator in
|
---|
123 | the path a zero length path is returned.
|
---|
124 |
|
---|
125 | \return
|
---|
126 | This method always returns a new instance of a NOMPath owned by the caller.
|
---|
127 |
|
---|
128 | \sa queryPathBegin()
|
---|
129 | */
|
---|
130 | PNOMPath erasePathBegin();
|
---|
131 |
|
---|
132 | /**
|
---|
133 | Returns the part of the path up to the first directory separator ('\' on OS/2).
|
---|
134 | If there's no directory separator the whole path is returned. This method does
|
---|
135 | not remove the part from the given path. Use erasePathBegin() to do that.
|
---|
136 |
|
---|
137 | \remark This method only works for null terminated string.
|
---|
138 |
|
---|
139 | \return
|
---|
140 | A new NOMString object holding the first part of a path.
|
---|
141 |
|
---|
142 | \sa erasePathBegin()
|
---|
143 | */
|
---|
144 | PNOMPath queryPathBegin();
|
---|
145 | };
|
---|
146 |
|
---|
147 | #endif /* NOMPATH_IDL_INCLUDED */
|
---|
148 |
|
---|
149 |
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 |
|
---|
154 |
|
---|
155 |
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|
161 |
|
---|
162 |
|
---|
163 |
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 |
|
---|
168 |
|
---|
169 |
|
---|
170 |
|
---|
171 |
|
---|
172 |
|
---|
173 |
|
---|