lowlevellibsandfws/apputils/inc/stringpool.inl
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2001-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 //
       
    15 
       
    16 #ifndef __STRINGPOOL_INL__
       
    17 #define __STRINGPOOL_INL__
       
    18 
       
    19 
       
    20 #include <stringpoolerr.h>
       
    21 
       
    22 inline RStringTokenBase::RStringTokenBase()
       
    23 		: iVal(0)
       
    24 /** Default constructor. */
       
    25 	{
       
    26 	}
       
    27 
       
    28 
       
    29 inline RStringTokenBase RStringTokenBase::operator=(RStringBase aVal)
       
    30 /** Assignment operator, which makes a string token from a string. 
       
    31 
       
    32 @param aVal The value of the string to copy.
       
    33 @return The string token base. */
       
    34 	{
       
    35 	iVal = aVal.iVal;
       
    36 	return *this;
       
    37 	}
       
    38 
       
    39 
       
    40 inline TBool RStringTokenBase::IsNull() const
       
    41 /** Tests if the string is null or not.
       
    42 
       
    43 @return ETrue if the string is null, otherwise EFalse. */
       
    44 	{
       
    45 	return (iVal == 0);
       
    46 	}
       
    47 
       
    48 
       
    49 inline TBool RStringToken::operator==(RStringToken aVal) const
       
    50 /** Equality operator. 
       
    51 
       
    52 @param aVal The string to compare.
       
    53 @return ETrue if the strings are the same, otherwise EFalse. */
       
    54 	{
       
    55 	return iVal == aVal.iVal;
       
    56 	}
       
    57 
       
    58 
       
    59 inline TBool RStringToken::operator!=(RStringToken aVal) const
       
    60 /** Inequality operator. 
       
    61 
       
    62 @param aVal The string to compare.
       
    63 @return ETrue if the strings are different, else EFalse */
       
    64 	{
       
    65 	return iVal != aVal.iVal;
       
    66 	}
       
    67 
       
    68 
       
    69 inline RStringToken RStringToken::operator=(RString aVal)
       
    70 /** Assignment operator, which makes a string token from a string. 
       
    71 
       
    72 @param aVal The string to copy.
       
    73 @return The string token. */
       
    74 	{
       
    75 	iVal = aVal.iVal;
       
    76 	return *this;
       
    77 	}
       
    78 
       
    79 
       
    80 inline TBool RStringTokenF::operator==(RStringTokenF aVal) const
       
    81 /** Equality operator.
       
    82 
       
    83 @param aVal The string to compare.
       
    84 @return ETrue if the strings are the same, otherwise EFalse. */
       
    85 	{
       
    86 	return iVal == aVal.iVal;
       
    87 	}
       
    88 
       
    89 
       
    90 inline TBool RStringTokenF::operator!=(RStringTokenF aVal) const
       
    91 /** Inequality operator. 
       
    92 
       
    93 @param aVal The string to compare.
       
    94 @return ETrue if any strings are different, else EFalse */
       
    95 	{
       
    96 	return iVal != aVal.iVal;
       
    97 	}
       
    98 
       
    99 
       
   100 inline RStringTokenF RStringTokenF::operator=(RStringF aVal)
       
   101 /** Assignment operator that makes a string token from a string. 
       
   102 
       
   103 @param aVal The string to compare.
       
   104 @return The string token. */
       
   105 	{
       
   106 	iVal = aVal.iVal;
       
   107 	return *this;
       
   108 	}
       
   109 
       
   110 
       
   111 inline RStringBase::RStringBase()
       
   112 		: iVal(0)
       
   113 /** Default constructor. */
       
   114 	{
       
   115 	}
       
   116 
       
   117 /** Returns a compact string equivalent to the string  */
       
   118 inline RStringBase::operator RStringTokenBase() const
       
   119 	{
       
   120 	RStringTokenBase s;
       
   121 	s.iVal = iVal;
       
   122 	return s;
       
   123 	}
       
   124 
       
   125 inline RString RString::Copy()
       
   126 /** Copies a string. 
       
   127 
       
   128 Both the original and the copy must be separately closed.
       
   129 
       
   130 @return The string to copy. */
       
   131 	{
       
   132 	RStringBase::Copy();
       
   133 	return *this;
       
   134 	}
       
   135 
       
   136 /** Returns a compact string equivalent to the string (for case-sensitive strings)  */
       
   137 inline RString::operator RStringToken() const
       
   138 	{
       
   139 	RStringToken s;
       
   140 	s.iVal = iVal;
       
   141 	return s;
       
   142 	}
       
   143 
       
   144 inline RStringF RStringF::Copy()
       
   145 /** Copies a string. 
       
   146 
       
   147 Both the original and the copy must be separately closed.
       
   148 
       
   149 @return The string to copy. */
       
   150 	{
       
   151 	RStringBase::Copy();
       
   152 	return *this;
       
   153 	}
       
   154 
       
   155 
       
   156 inline TBool RStringF::operator==(const RStringF& aVal) const
       
   157 /** Equality operator.
       
   158 
       
   159 @param aVal The string to compare.
       
   160 @return ETrue if the strings are equal, else EFalse */
       
   161 	{
       
   162 	__ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
       
   163 	return (iVal == aVal.iVal);
       
   164 	}
       
   165 
       
   166 
       
   167 inline TBool RStringF::operator!=(const RStringF& aVal) const
       
   168 /** Inequality operator.
       
   169 
       
   170 @param aVal The string to compare.
       
   171 @return ETrue if the strings are not equal, else EFalse */
       
   172 	{
       
   173 	__ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
       
   174 	return (iVal != aVal.iVal);
       
   175 	}
       
   176 
       
   177 
       
   178 inline RStringF::operator RStringTokenF() const
       
   179 	{
       
   180 	RStringTokenF s;
       
   181 	s.iVal = iVal;
       
   182 	return s;
       
   183 	}
       
   184 
       
   185 
       
   186 inline RStringPool RStringBase::Pool() const 
       
   187 /** Gets the string pool.
       
   188 
       
   189 @return The string pool. */
       
   190 	{
       
   191 	return iPool;
       
   192 	}
       
   193 
       
   194 
       
   195 inline TBool RString::operator==(const RString& aVal) const
       
   196 /** Equality operator.
       
   197 
       
   198 @param aVal The string to compare.
       
   199 @return ETrue if the strings are equal, else EFalse */
       
   200 	{
       
   201 	__ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
       
   202 	return (iVal == aVal.iVal);
       
   203 	}
       
   204 
       
   205 
       
   206 inline TBool RString::operator!=(const RString& aVal) const
       
   207 /** Inequality operator.
       
   208 
       
   209 @param aVal The string to compare.
       
   210 @return ETrue if the strings are not equal, else EFalse */
       
   211 	{
       
   212 	__ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
       
   213 	return (iVal != aVal.iVal);
       
   214 	}
       
   215 
       
   216 inline RStringPool::RStringPool()
       
   217 		: iImplementation(0)
       
   218 /** Default constructor. */
       
   219 	{
       
   220 	}
       
   221 
       
   222 
       
   223 #endif // __STRINGPOOL_INL__