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