| 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-2006
|
|---|
| 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 NOMSTRING_IDL_INCLUDED
|
|---|
| 36 | #define NOMSTRING_IDL_INCLUDED
|
|---|
| 37 |
|
|---|
| 38 | #include "nomobj.idl"
|
|---|
| 39 | #include "nomfoundation.idl"
|
|---|
| 40 |
|
|---|
| 41 | NOMCLASSNAME(NOMString);
|
|---|
| 42 |
|
|---|
| 43 | /** \class NOMString
|
|---|
| 44 | The NOMString class is used for strings which automatically grow or shrink.
|
|---|
| 45 | Methods are provided for common tasks when dealing with strings like inserting or
|
|---|
| 46 | appending strings. A string object never can be empty. It always is a string which may have a length of zero.
|
|---|
| 47 |
|
|---|
| 48 | Note that you don't have to delete a NOMString object. This is done by the garbage collector. Deleting
|
|---|
| 49 | it doesn't hurt, though.
|
|---|
| 50 | */
|
|---|
| 51 | interface NOMString : NOMObject
|
|---|
| 52 | {
|
|---|
| 53 | #ifdef __NOM_IDL_COMPILER__
|
|---|
| 54 | filestem=nomstring;
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | /**
|
|---|
| 58 | The current version of this class is 1.0
|
|---|
| 59 | */
|
|---|
| 60 | NOMCLASSVERSION(1, 0);
|
|---|
| 61 |
|
|---|
| 62 | /**
|
|---|
| 63 | Assign a string to this NOMString. An initially created NOMString object is empty.
|
|---|
| 64 | This method can be used to assign some value to it.
|
|---|
| 65 |
|
|---|
| 66 | \remark
|
|---|
| 67 | This method does not work on a copy. So by assigning a value to the NOMString the
|
|---|
| 68 | old contents is lost. This may have sideeffects in multithreaded environments if used without care.
|
|---|
| 69 |
|
|---|
| 70 | \sa assignCString()
|
|---|
| 71 | */
|
|---|
| 72 | PNOMString assign(in PNOMString nomString);
|
|---|
| 73 |
|
|---|
| 74 | /**
|
|---|
| 75 | Assign a C string to this NOMString. An initially created NOMString object is empty.
|
|---|
| 76 | This method can be used to assign some value to it.
|
|---|
| 77 |
|
|---|
| 78 | \remark
|
|---|
| 79 | This method does not work on a copy. So by assigning a value to the NOMString the old contents
|
|---|
| 80 | is lost. This may have sideeffects in multithreaded environments if used without care.
|
|---|
| 81 |
|
|---|
| 82 | \sa assign()
|
|---|
| 83 | */
|
|---|
| 84 | PNOMString assignCString(in string chrString);
|
|---|
| 85 |
|
|---|
| 86 | /**
|
|---|
| 87 | Returns the C string holding the info inside the string object. Use with care.
|
|---|
| 88 | In most cases you rather want to use copyCString() instead.
|
|---|
| 89 |
|
|---|
| 90 | \return The C string representing the contents of the string object. This is not a copy.
|
|---|
| 91 |
|
|---|
| 92 | \sa copyCString()
|
|---|
| 93 | */
|
|---|
| 94 | string queryCString();
|
|---|
| 95 |
|
|---|
| 96 | /**
|
|---|
| 97 | Add the NOMString nomString to the end of the string object.
|
|---|
| 98 |
|
|---|
| 99 | \remark The returned string object is not newly allocated. Be aware that the string data
|
|---|
| 100 | held by the object is.
|
|---|
| 101 |
|
|---|
| 102 | \param nomString A NOMString object to be put at the end of the string.
|
|---|
| 103 | \return
|
|---|
| 104 | Modified NOMString object with the given string object appended. This is not a copy.
|
|---|
| 105 |
|
|---|
| 106 | \sa appendCString(), prepend()
|
|---|
| 107 | */
|
|---|
| 108 | PNOMString append(in PNOMString nomString);
|
|---|
| 109 |
|
|---|
| 110 | /**
|
|---|
| 111 | Prepend the NOMString \e nomString to the given string object and return the modified
|
|---|
| 112 | NOMString.
|
|---|
| 113 |
|
|---|
| 114 | \remark The returned string object is not newly allocated. Be aware that the string data
|
|---|
| 115 | held by the object is.
|
|---|
| 116 |
|
|---|
| 117 | \param nomString A NOMString object to be put in front of the string.
|
|---|
| 118 | \return
|
|---|
| 119 | NOMString object with the string prepended. This is not a copy.
|
|---|
| 120 |
|
|---|
| 121 | \sa prependCString()
|
|---|
| 122 | */
|
|---|
| 123 | PNOMString prepend(in PNOMString nomString);
|
|---|
| 124 |
|
|---|
| 125 | /**
|
|---|
| 126 | Append the given C string to the end of the string held by the NOMString object.
|
|---|
| 127 |
|
|---|
| 128 | \remark The returned string object is not newly allocated. Be aware that the string data
|
|---|
| 129 | held by the object is.
|
|---|
| 130 |
|
|---|
| 131 | \param chrString A null terminated string.
|
|---|
| 132 | \return
|
|---|
| 133 | Modified NOMString object with the C string appended. This is not a copy.
|
|---|
| 134 |
|
|---|
| 135 | \sa append(), prependCString()
|
|---|
| 136 | */
|
|---|
| 137 | PNOMString appendCString(in string chrString);
|
|---|
| 138 |
|
|---|
| 139 | /**
|
|---|
| 140 | Prepend the C string to the string object.
|
|---|
| 141 |
|
|---|
| 142 | \remark The returned string object is not newly allocated. Be aware that the string data
|
|---|
| 143 | held by the object is.
|
|---|
| 144 |
|
|---|
| 145 | \param chrString A null terminated string.
|
|---|
| 146 | \return
|
|---|
| 147 | Modified NOMString object with the C string prepended. This is not a copy.
|
|---|
| 148 |
|
|---|
| 149 | \sa appendCString(), prepend()
|
|---|
| 150 | */
|
|---|
| 151 | PNOMString prependCString(in string chrString);
|
|---|
| 152 |
|
|---|
| 153 | /**
|
|---|
| 154 | \return Returns the length of the string in characters.
|
|---|
| 155 | */
|
|---|
| 156 | unsigned long length();
|
|---|
| 157 |
|
|---|
| 158 | /**
|
|---|
| 159 | Cuts off the end of a string leaving the first ulNewLen characters.
|
|---|
| 160 |
|
|---|
| 161 | \remark The returned string object is not newly allocated. Be aware that the string data
|
|---|
| 162 | held by the object is.
|
|---|
| 163 |
|
|---|
| 164 | \return
|
|---|
| 165 | Truncated NOMString object. This is not a copy.
|
|---|
| 166 | */
|
|---|
| 167 | PNOMString truncate(in unsigned long ulNewLen);
|
|---|
| 168 |
|
|---|
| 169 | /**
|
|---|
| 170 | Create a copy of the NOMString object this method is called on. The caller
|
|---|
| 171 | owns the new NOMString object.
|
|---|
| 172 |
|
|---|
| 173 | \return A new NOMString object
|
|---|
| 174 |
|
|---|
| 175 | \sa copyCString()
|
|---|
| 176 | */
|
|---|
| 177 | PNOMString copy();
|
|---|
| 178 |
|
|---|
| 179 | /**
|
|---|
| 180 | Returns a copy of the C string holding the info inside the string object.
|
|---|
| 181 |
|
|---|
| 182 | \return
|
|---|
| 183 | The returned C string is owned by the caller.
|
|---|
| 184 |
|
|---|
| 185 | \sa copy()
|
|---|
| 186 | */
|
|---|
| 187 | string copyCString();
|
|---|
| 188 |
|
|---|
| 189 | /**
|
|---|
| 190 | Override of nomInit() to initialize the GString */
|
|---|
| 191 | NOMOVERRIDE(nomInit);
|
|---|
| 192 |
|
|---|
| 193 | /**
|
|---|
| 194 | The GString holding the data
|
|---|
| 195 | */
|
|---|
| 196 | NOMINSTANCEVAR(PGString gString);
|
|---|
| 197 | };
|
|---|
| 198 |
|
|---|
| 199 | #endif /* NOMSTRING_IDL_INCLUDED */
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|