2010-10-14 08:30:07 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 14:18:43 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 09:42:22 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 14:18:43 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 14:18:43 +00:00
|
|
|
*
|
2008-04-10 09:42:22 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 14:18:43 +00:00
|
|
|
*
|
2008-04-10 09:42:22 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 14:18:43 +00:00
|
|
|
*
|
2008-04-10 09:42:22 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 14:18:43 +00:00
|
|
|
*
|
2008-04-10 09:42:22 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 14:18:43 +00:00
|
|
|
*
|
2008-04-10 09:42:22 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 14:18:43 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _RTL_STRING_HXX_
|
|
|
|
#define _RTL_STRING_HXX_
|
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
#include "sal/config.h"
|
|
|
|
|
|
|
|
#include <cassert>
|
2001-03-16 14:17:03 +00:00
|
|
|
|
|
|
|
#include <osl/diagnose.h>
|
2000-09-18 14:18:43 +00:00
|
|
|
#include <rtl/memory.h>
|
|
|
|
#include <rtl/textenc.h>
|
2001-03-16 14:17:03 +00:00
|
|
|
#include <rtl/string.h>
|
2011-11-23 15:45:43 +01:00
|
|
|
#include "sal/log.hxx"
|
2000-09-18 14:18:43 +00:00
|
|
|
|
2004-03-30 15:28:07 +00:00
|
|
|
#if !defined EXCEPTIONS_OFF
|
|
|
|
#include <new>
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
namespace rtl
|
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
|
|
|
|
/* ======================================================================= */
|
2000-09-18 14:18:43 +00:00
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
This String class provide base functionality for C++ like 8-Bit
|
|
|
|
character array handling. The advantage of this class is, that it
|
|
|
|
handle all the memory managament for you - and it do it
|
|
|
|
more efficient. If you assign a string to another string, the
|
|
|
|
data of both strings are shared (without any copy operation or
|
2001-10-30 12:41:07 +00:00
|
|
|
memory allocation) as long as you do not change the string. This class
|
2001-03-16 14:17:03 +00:00
|
|
|
stores also the length of the string, so that many operations are
|
|
|
|
faster as the C-str-functions.
|
|
|
|
|
|
|
|
This class provide only readonly string handling. So you could create
|
|
|
|
a string and you could only query the content from this string.
|
|
|
|
It provide also functionality to change the string, but this results
|
|
|
|
in every case in a new string instance (in the most cases with an
|
|
|
|
memory allocation). You don't have functionality to change the
|
|
|
|
content of the string. If you want change the string content, than
|
|
|
|
you should us the OStringBuffer class, which provide these
|
|
|
|
functionality and avoid to much memory allocation.
|
|
|
|
|
|
|
|
The design of this class is similar to the string classes in Java
|
|
|
|
and so more people should have fewer understanding problems when they
|
|
|
|
use this class.
|
|
|
|
*/
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
class OString
|
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
public:
|
2012-01-05 19:40:38 +01:00
|
|
|
/// @cond INTERNAL
|
2001-03-16 14:17:03 +00:00
|
|
|
rtl_String * pData;
|
2012-01-05 19:40:38 +01:00
|
|
|
/// @endcond
|
2001-03-16 14:17:03 +00:00
|
|
|
|
|
|
|
private:
|
2000-09-18 14:18:43 +00:00
|
|
|
class DO_NOT_ACQUIRE;
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2012-01-21 15:21:16 +01:00
|
|
|
OString( rtl_String * value, SAL_UNUSED_PARAMETER DO_NOT_ACQUIRE * )
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
pData = value;
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
public:
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
New string containing no characters.
|
|
|
|
*/
|
|
|
|
OString() SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
pData = 0;
|
|
|
|
rtl_string_new( &pData );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
New string from OString.
|
|
|
|
|
|
|
|
@param str a OString.
|
|
|
|
*/
|
|
|
|
OString( const OString & str ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
pData = str.pData;
|
2000-09-18 14:18:43 +00:00
|
|
|
rtl_string_acquire( pData );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
New string from OString data.
|
|
|
|
|
|
|
|
@param str a OString data.
|
|
|
|
*/
|
|
|
|
OString( rtl_String * str ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
pData = str;
|
2000-09-18 14:18:43 +00:00
|
|
|
rtl_string_acquire( pData );
|
|
|
|
}
|
|
|
|
|
2011-09-01 23:44:10 +01:00
|
|
|
/** New string from OString data without acquiring it. Takeover of ownership.
|
|
|
|
|
|
|
|
@param str a OString data.
|
2012-01-19 20:18:48 -06:00
|
|
|
@param __sal_NoAcquire SAL_NO_ACQUIRE to distinguish from other ctors
|
2011-09-01 23:44:10 +01:00
|
|
|
*/
|
|
|
|
inline OString( rtl_String * str, __sal_NoAcquire ) SAL_THROW(())
|
|
|
|
{
|
|
|
|
pData = str;
|
|
|
|
}
|
|
|
|
|
2005-04-13 07:42:42 +00:00
|
|
|
/**
|
|
|
|
New string from a single character.
|
|
|
|
|
|
|
|
@param value a character.
|
|
|
|
*/
|
|
|
|
explicit OString( sal_Char value ) SAL_THROW(())
|
|
|
|
: pData (0)
|
|
|
|
{
|
|
|
|
rtl_string_newFromStr_WithLength( &pData, &value, 1 );
|
|
|
|
}
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
New string from a character buffer array.
|
|
|
|
|
|
|
|
@param value a NULL-terminated character array.
|
|
|
|
*/
|
|
|
|
OString( const sal_Char * value ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
pData = 0;
|
2000-09-18 14:18:43 +00:00
|
|
|
rtl_string_newFromStr( &pData, value );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
New string from a character buffer array.
|
|
|
|
|
|
|
|
@param value a character array.
|
|
|
|
@param length the number of character which should be copied.
|
|
|
|
The character array length must be greater or
|
|
|
|
equal than this value.
|
|
|
|
*/
|
|
|
|
OString( const sal_Char * value, sal_Int32 length ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
pData = 0;
|
2000-09-18 14:18:43 +00:00
|
|
|
rtl_string_newFromStr_WithLength( &pData, value, length );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
New string from a Unicode character buffer array.
|
2000-09-18 14:18:43 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
@param value a Unicode character array.
|
|
|
|
@param length the number of character which should be converted.
|
|
|
|
The Unicode character array length must be
|
|
|
|
greater or equal than this value.
|
|
|
|
@param encoding the text encoding in which the Unicode character
|
|
|
|
sequence should be converted.
|
|
|
|
@param convertFlags flags which controls the conversion.
|
|
|
|
see RTL_UNICODETOTEXT_FLAGS_...
|
2004-03-30 15:28:07 +00:00
|
|
|
|
|
|
|
@exception std::bad_alloc is thrown if an out-of-memory condition occurs
|
2001-03-16 14:17:03 +00:00
|
|
|
*/
|
|
|
|
OString( const sal_Unicode * value, sal_Int32 length,
|
|
|
|
rtl_TextEncoding encoding,
|
2004-03-30 15:28:07 +00:00
|
|
|
sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
|
2001-03-16 14:17:03 +00:00
|
|
|
{
|
|
|
|
pData = 0;
|
|
|
|
rtl_uString2String( &pData, value, length, encoding, convertFlags );
|
2011-11-22 09:34:46 +01:00
|
|
|
if (pData == 0) {
|
2004-03-30 15:28:07 +00:00
|
|
|
#if defined EXCEPTIONS_OFF
|
2011-11-22 09:34:46 +01:00
|
|
|
SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
|
2004-03-30 15:28:07 +00:00
|
|
|
#else
|
|
|
|
throw std::bad_alloc();
|
|
|
|
#endif
|
2011-11-22 09:34:46 +01:00
|
|
|
}
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Release the string data.
|
|
|
|
*/
|
|
|
|
~OString() SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
rtl_string_release( pData );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Assign a new string.
|
|
|
|
|
|
|
|
@param str a OString.
|
|
|
|
*/
|
|
|
|
OString & operator=( const OString & str ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
rtl_string_assign( &pData, str.pData );
|
2000-09-18 14:18:43 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Append a string to this string.
|
|
|
|
|
|
|
|
@param str a OString.
|
|
|
|
*/
|
|
|
|
OString & operator+=( const OString & str ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
rtl_string_newConcat( &pData, pData, str.pData );
|
|
|
|
return *this;
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Returns the length of this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
The length is equal to the number of characters in this string.
|
2000-09-18 14:18:43 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
@return the length of the sequence of characters represented by this
|
|
|
|
object.
|
|
|
|
*/
|
|
|
|
sal_Int32 getLength() const SAL_THROW(()) { return pData->length; }
|
2000-09-18 14:18:43 +00:00
|
|
|
|
2011-02-03 22:40:17 +01:00
|
|
|
/**
|
|
|
|
Checks if a string is empty.
|
|
|
|
|
|
|
|
@return sal_True if the string is empty;
|
|
|
|
sal_False, otherwise.
|
|
|
|
|
|
|
|
@since LibreOffice 3.4
|
|
|
|
*/
|
|
|
|
sal_Bool isEmpty() const SAL_THROW(())
|
|
|
|
{
|
|
|
|
if ( pData->length )
|
|
|
|
return sal_False;
|
|
|
|
else
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2004-03-19 12:23:26 +00:00
|
|
|
Returns a pointer to the characters of this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2004-03-19 12:23:26 +00:00
|
|
|
<p>The returned pointer is guaranteed to point to a null-terminated byte
|
|
|
|
string. But note that this string object may contain embedded null
|
|
|
|
characters, which will thus also be embedded in the returned
|
|
|
|
null-terminated byte string.</p>
|
2001-03-16 14:17:03 +00:00
|
|
|
|
2004-03-19 12:23:26 +00:00
|
|
|
@return a pointer to a null-terminated byte string representing the
|
|
|
|
characters of this string object.
|
2001-03-16 14:17:03 +00:00
|
|
|
*/
|
|
|
|
const sal_Char * getStr() const SAL_THROW(()) { return pData->buffer; }
|
|
|
|
|
2011-10-05 09:20:59 +02:00
|
|
|
/**
|
|
|
|
Access to individual characters.
|
|
|
|
|
|
|
|
@param index must be non-negative and less than length.
|
|
|
|
|
|
|
|
@return the character at the given index.
|
|
|
|
|
|
|
|
@since LibreOffice 3.5
|
|
|
|
*/
|
|
|
|
sal_Char operator [](sal_Int32 index) const { return getStr()[index]; }
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Compares two strings.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
The comparison is based on the numeric value of each character in
|
|
|
|
the strings and return a value indicating their relationship.
|
|
|
|
This function can't be used for language specific sorting.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the object to be compared.
|
2001-10-30 12:41:07 +00:00
|
|
|
@return 0 - if both strings are equal
|
|
|
|
< 0 - if this string is less than the string argument
|
|
|
|
> 0 - if this string is greater than the string argument
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
|
|
|
sal_Int32 compareTo( const OString & str ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
return rtl_str_compare_WithLength( pData->buffer, pData->length,
|
|
|
|
str.pData->buffer, str.pData->length );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Compares two strings with an maximum count of characters.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
The comparison is based on the numeric value of each character in
|
|
|
|
the strings and return a value indicating their relationship.
|
|
|
|
This function can't be used for language specific sorting.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the object to be compared.
|
2001-07-27 12:26:37 +00:00
|
|
|
@param maxLength the maximum count of characters to be compared.
|
2001-10-30 12:41:07 +00:00
|
|
|
@return 0 - if both strings are equal
|
|
|
|
< 0 - if this string is less than the string argument
|
|
|
|
> 0 - if this string is greater than the string argument
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
2001-07-27 12:26:37 +00:00
|
|
|
sal_Int32 compareTo( const OString & rObj, sal_Int32 maxLength ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-07-27 12:26:37 +00:00
|
|
|
return rtl_str_shortenedCompare_WithLength( pData->buffer, pData->length,
|
|
|
|
rObj.pData->buffer, rObj.pData->length, maxLength );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Compares two strings in reverse order.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-07-27 12:26:37 +00:00
|
|
|
The comparison is based on the numeric value of each character in
|
|
|
|
the strings and return a value indicating their relationship.
|
|
|
|
This function can't be used for language specific sorting.
|
|
|
|
|
|
|
|
@param str the object to be compared.
|
2001-10-30 12:41:07 +00:00
|
|
|
@return 0 - if both strings are equal
|
|
|
|
< 0 - if this string is less than the string argument
|
|
|
|
> 0 - if this string is greater than the string argument
|
2001-07-27 12:26:37 +00:00
|
|
|
*/
|
|
|
|
sal_Int32 reverseCompareTo( const OString & str ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
|
|
|
|
str.pData->buffer, str.pData->length );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Perform a comparison of two strings.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
The result is true if and only if second string
|
|
|
|
represents the same sequence of characters as the first string.
|
|
|
|
This function can't be used for language specific comparison.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the object to be compared.
|
|
|
|
@return sal_True if the strings are equal;
|
|
|
|
sal_False, otherwise.
|
|
|
|
*/
|
|
|
|
sal_Bool equals( const OString & str ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
if ( pData->length != str.pData->length )
|
|
|
|
return sal_False;
|
|
|
|
if ( pData == str.pData )
|
|
|
|
return sal_True;
|
2001-07-27 12:26:37 +00:00
|
|
|
return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
|
|
|
|
str.pData->buffer, str.pData->length ) == 0;
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
2011-06-22 22:36:47 +01:00
|
|
|
/**
|
|
|
|
Perform a comparison of two strings.
|
|
|
|
|
|
|
|
The result is true if and only if second string
|
|
|
|
represents the same sequence of characters as the first string.
|
|
|
|
The ASCII string must be NULL-terminated and must be greater or
|
|
|
|
equal as length.
|
|
|
|
This function can't be used for language specific comparison.
|
|
|
|
|
|
|
|
|
|
|
|
@param value a character array.
|
|
|
|
@param length the length of the character array.
|
|
|
|
@return sal_True if the strings are equal;
|
|
|
|
sal_False, otherwise.
|
|
|
|
*/
|
|
|
|
sal_Bool equalsL( const sal_Char* value, sal_Int32 length ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
if ( pData->length != length )
|
|
|
|
return sal_False;
|
|
|
|
|
|
|
|
return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
|
|
|
|
value, length ) == 0;
|
|
|
|
}
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Perform a ASCII lowercase comparison of two strings.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
The result is true if and only if second string
|
|
|
|
represents the same sequence of characters as the first string,
|
|
|
|
ignoring the case.
|
|
|
|
Character values between 65 and 90 (ASCII A-Z) are interpreted as
|
|
|
|
values between 97 and 122 (ASCII a-z).
|
|
|
|
This function can't be used for language specific comparison.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the object to be compared.
|
|
|
|
@return sal_True if the strings are equal;
|
|
|
|
sal_False, otherwise.
|
|
|
|
*/
|
|
|
|
sal_Bool equalsIgnoreAsciiCase( const OString & str ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
if ( pData->length != str.pData->length )
|
|
|
|
return sal_False;
|
|
|
|
if ( pData == str.pData )
|
|
|
|
return sal_True;
|
|
|
|
return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
|
|
|
|
str.pData->buffer, str.pData->length ) == 0;
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
2011-10-28 23:07:15 +01:00
|
|
|
/**
|
|
|
|
Perform a ASCII lowercase comparison of two strings.
|
|
|
|
|
|
|
|
The result is true if and only if second string
|
|
|
|
represents the same sequence of characters as the first string,
|
|
|
|
ignoring the case.
|
|
|
|
Character values between 65 and 90 (ASCII A-Z) are interpreted as
|
|
|
|
values between 97 and 122 (ASCII a-z).
|
|
|
|
Since this method is optimized for performance, the ASCII character
|
|
|
|
values are not converted in any way. The caller has to make sure that
|
|
|
|
all ASCII characters are in the allowed range between 0 and
|
|
|
|
127. The ASCII string must be NULL-terminated.
|
|
|
|
This function can't be used for language specific comparison.
|
|
|
|
|
|
|
|
@param asciiStr the 8-Bit ASCII character string to be compared.
|
|
|
|
@return sal_True if the strings are equal;
|
|
|
|
sal_False, otherwise.
|
|
|
|
*/
|
2011-10-30 21:20:45 +00:00
|
|
|
sal_Bool equalsIgnoreAsciiCase( const sal_Char * asciiStr ) const SAL_THROW(())
|
2011-10-28 23:07:15 +01:00
|
|
|
{
|
2011-10-30 21:20:45 +00:00
|
|
|
return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
|
2011-10-28 23:07:15 +01:00
|
|
|
}
|
|
|
|
|
2011-10-28 22:37:01 +01:00
|
|
|
/**
|
|
|
|
Perform a ASCII lowercase comparison of two strings.
|
|
|
|
|
|
|
|
The result is true if and only if second string
|
|
|
|
represents the same sequence of characters as the first string,
|
|
|
|
ignoring the case.
|
|
|
|
Character values between 65 and 90 (ASCII A-Z) are interpreted as
|
|
|
|
values between 97 and 122 (ASCII a-z).
|
|
|
|
Since this method is optimized for performance, the ASCII character
|
|
|
|
values are not converted in any way. The caller has to make sure that
|
|
|
|
all ASCII characters are in the allowed range between 0 and
|
|
|
|
127. The ASCII string must be greater or equal in length as asciiStrLength.
|
|
|
|
This function can't be used for language specific comparison.
|
|
|
|
|
|
|
|
@param asciiStr the 8-Bit ASCII character string to be compared.
|
|
|
|
@param asciiStrLength the length of the ascii string
|
|
|
|
@return sal_True if the strings are equal;
|
|
|
|
sal_False, otherwise.
|
|
|
|
*/
|
2011-10-30 21:20:45 +00:00
|
|
|
sal_Bool equalsIgnoreAsciiCaseL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const SAL_THROW(())
|
2011-10-28 22:37:01 +01:00
|
|
|
{
|
|
|
|
if ( pData->length != asciiStrLength )
|
|
|
|
return sal_False;
|
|
|
|
|
|
|
|
return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
|
|
|
|
asciiStr, asciiStrLength ) == 0;
|
|
|
|
}
|
|
|
|
|
2001-07-27 12:26:37 +00:00
|
|
|
/**
|
2003-08-07 13:56:13 +00:00
|
|
|
Match against a substring appearing in this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2003-08-07 13:56:13 +00:00
|
|
|
The result is true if and only if the second string appears as a substring
|
|
|
|
of this string, at the given position.
|
2001-07-27 12:26:37 +00:00
|
|
|
This function can't be used for language specific comparison.
|
|
|
|
|
|
|
|
@param str the object (substring) to be compared.
|
|
|
|
@param fromIndex the index to start the comparion from.
|
|
|
|
The index must be greater or equal than 0
|
|
|
|
and less or equal as the string length.
|
|
|
|
@return sal_True if str match with the characters in the string
|
|
|
|
at the given position;
|
|
|
|
sal_False, otherwise.
|
|
|
|
*/
|
|
|
|
sal_Bool match( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return rtl_str_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
|
|
|
|
str.pData->buffer, str.pData->length, str.pData->length ) == 0;
|
|
|
|
}
|
|
|
|
|
2012-02-15 15:26:43 +01:00
|
|
|
/**
|
|
|
|
Match against a substring appearing in this string.
|
|
|
|
|
|
|
|
@param str the substring to be compared; must not be null and must point
|
|
|
|
to memory of at least strLength bytes
|
|
|
|
|
|
|
|
@param strLength the length of the substring; must be non-negative
|
|
|
|
|
|
|
|
@param fromIndex the index into this string to start the comparison at;
|
|
|
|
must be non-negative and not greater than this string's length
|
|
|
|
|
|
|
|
@return true if and only if the given str is contained as a substring of
|
|
|
|
this string at the given fromIndex
|
|
|
|
|
|
|
|
@since LibreOffice 3.6
|
|
|
|
*/
|
|
|
|
bool matchL(
|
|
|
|
char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
|
|
|
|
const
|
|
|
|
{
|
|
|
|
return rtl_str_shortenedCompare_WithLength(
|
|
|
|
pData->buffer + fromIndex, pData->length - fromIndex,
|
|
|
|
str, strLength, strLength) == 0;
|
|
|
|
}
|
|
|
|
|
2001-07-27 12:26:37 +00:00
|
|
|
/**
|
2003-08-07 13:56:13 +00:00
|
|
|
Match against a substring appearing in this string, ignoring the case of
|
|
|
|
ASCII letters.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2003-08-07 13:56:13 +00:00
|
|
|
The result is true if and only if the second string appears as a substring
|
|
|
|
of this string, at the given position.
|
2001-07-27 12:26:37 +00:00
|
|
|
Character values between 65 and 90 (ASCII A-Z) are interpreted as
|
|
|
|
values between 97 and 122 (ASCII a-z).
|
|
|
|
This function can't be used for language specific comparison.
|
|
|
|
|
|
|
|
@param str the object (substring) to be compared.
|
|
|
|
@param fromIndex the index to start the comparion from.
|
|
|
|
The index must be greater or equal than 0
|
|
|
|
and less or equal as the string length.
|
|
|
|
@return sal_True if str match with the characters in the string
|
|
|
|
at the given position;
|
|
|
|
sal_False, otherwise.
|
|
|
|
*/
|
|
|
|
sal_Bool matchIgnoreAsciiCase( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
|
|
|
|
str.pData->buffer, str.pData->length,
|
|
|
|
str.pData->length ) == 0;
|
|
|
|
}
|
|
|
|
|
2012-02-15 15:26:43 +01:00
|
|
|
/**
|
|
|
|
Check whether this string ends with a given substring.
|
|
|
|
|
|
|
|
@param str the substring to be compared
|
|
|
|
|
|
|
|
@return true if and only if the given str appears as a substring at the
|
|
|
|
end of this string
|
|
|
|
|
|
|
|
@since LibreOffice 3.6
|
|
|
|
*/
|
|
|
|
bool endsWith(rtl::OString const & str) const {
|
|
|
|
return str.getLength() <= getLength()
|
|
|
|
&& match(str, getLength() - str.getLength());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Check whether this string ends with a given substring.
|
|
|
|
|
|
|
|
@param str the substring to be compared; must not be null and must point
|
|
|
|
to memory of at least strLength bytes
|
|
|
|
|
|
|
|
@param strLength the length of the substring; must be non-negative
|
|
|
|
|
|
|
|
@return true if and only if the given str appears as a substring at the
|
|
|
|
end of this string
|
|
|
|
|
|
|
|
@since LibreOffice 3.6
|
|
|
|
*/
|
|
|
|
bool endsWithL(char const * str, sal_Int32 strLength) const {
|
|
|
|
return strLength <= getLength()
|
|
|
|
&& matchL(str, strLength, getLength() - strLength);
|
|
|
|
}
|
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator == ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return rStr1.getLength() == rStr2.getLength() && rStr1.compareTo( rStr2 ) == 0; }
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator == ( const OString& rStr1, const sal_Char * pStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return rStr1.compareTo( pStr2 ) == 0; }
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator == ( const sal_Char * pStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return OString( pStr1 ).compareTo( rStr2 ) == 0; }
|
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator != ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return !(operator == ( rStr1, rStr2 )); }
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator != ( const OString& rStr1, const sal_Char * pStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return !(operator == ( rStr1, pStr2 )); }
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator != ( const sal_Char * pStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return !(operator == ( pStr1, rStr2 )); }
|
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator < ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return rStr1.compareTo( rStr2 ) < 0; }
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator > ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return rStr1.compareTo( rStr2 ) > 0; }
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator <= ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return rStr1.compareTo( rStr2 ) <= 0; }
|
2001-05-09 11:56:53 +00:00
|
|
|
friend sal_Bool operator >= ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{ return rStr1.compareTo( rStr2 ) >= 0; }
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns a hashcode for this string.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@return a hash code value for this object.
|
2006-04-19 12:47:28 +00:00
|
|
|
|
2011-02-03 16:24:08 -07:00
|
|
|
@see rtl::OStringHash for convenient use of boost::unordered_map
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
|
|
|
sal_Int32 hashCode() const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
|
|
|
return rtl_str_hashCode_WithLength( pData->buffer, pData->length );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns the index within this string of the first occurrence of the
|
|
|
|
specified character, starting the search at the specified index.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param ch character to be located.
|
|
|
|
@param fromIndex the index to start the search from.
|
|
|
|
The index must be greater or equal than 0
|
|
|
|
and less or equal as the string length.
|
|
|
|
@return the index of the first occurrence of the character in the
|
|
|
|
character sequence represented by this string that is
|
|
|
|
greater than or equal to fromIndex, or
|
2001-10-30 12:41:07 +00:00
|
|
|
-1 if the character does not occur.
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
|
|
|
sal_Int32 indexOf( sal_Char ch, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
sal_Int32 ret = rtl_str_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
|
|
|
|
return (ret < 0 ? ret : ret+fromIndex);
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns the index within this string of the last occurrence of the
|
|
|
|
specified character, searching backward starting at the end.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param ch character to be located.
|
|
|
|
@return the index of the last occurrence of the character in the
|
|
|
|
character sequence represented by this string, or
|
2001-10-30 12:41:07 +00:00
|
|
|
-1 if the character does not occur.
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
|
|
|
sal_Int32 lastIndexOf( sal_Char ch ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
return rtl_str_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns the index within this string of the last occurrence of the
|
2007-11-23 12:16:14 +00:00
|
|
|
specified character, searching backward starting before the specified
|
|
|
|
index.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param ch character to be located.
|
2007-11-23 12:16:14 +00:00
|
|
|
@param fromIndex the index before which to start the search.
|
2001-05-09 11:56:53 +00:00
|
|
|
@return the index of the last occurrence of the character in the
|
|
|
|
character sequence represented by this string that
|
2007-11-23 12:16:14 +00:00
|
|
|
is less than fromIndex, or -1
|
2001-04-26 12:34:01 +00:00
|
|
|
if the character does not occur before that point.
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
2001-05-17 09:06:58 +00:00
|
|
|
sal_Int32 lastIndexOf( sal_Char ch, sal_Int32 fromIndex ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
|
|
|
return rtl_str_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns the index within this string of the first occurrence of the
|
|
|
|
specified substring, starting at the specified index.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
|
|
|
If str doesn't include any character, always -1 is
|
2001-05-09 11:56:53 +00:00
|
|
|
returned. This is also the case, if both strings are empty.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the substring to search for.
|
|
|
|
@param fromIndex the index to start the search from.
|
|
|
|
@return If the string argument occurs one or more times as a substring
|
|
|
|
within this string at the starting index, then the index
|
|
|
|
of the first character of the first such substring is
|
|
|
|
returned. If it does not occur as a substring starting
|
2001-10-30 12:41:07 +00:00
|
|
|
at fromIndex or beyond, -1 is returned.
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
2001-05-17 09:06:58 +00:00
|
|
|
sal_Int32 indexOf( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
|
|
|
|
str.pData->buffer, str.pData->length );
|
|
|
|
return (ret < 0 ? ret : ret+fromIndex);
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
2012-02-15 15:26:43 +01:00
|
|
|
/**
|
|
|
|
Returns the index within this string of the first occurrence of the
|
|
|
|
specified substring, starting at the specified index.
|
|
|
|
|
|
|
|
If str doesn't include any character, always -1 is
|
|
|
|
returned. This is also the case, if both strings are empty.
|
|
|
|
|
|
|
|
@param str the substring to search for.
|
|
|
|
@param len the length of the substring.
|
|
|
|
@param fromIndex the index to start the search from.
|
|
|
|
@return If the string argument occurs one or more times as a substring
|
|
|
|
within this string at the starting index, then the index
|
|
|
|
of the first character of the first such substring is
|
|
|
|
returned. If it does not occur as a substring starting
|
|
|
|
at fromIndex or beyond, -1 is returned.
|
|
|
|
|
|
|
|
@since LibreOffice 3.6
|
|
|
|
*/
|
|
|
|
sal_Int32 indexOfL(char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
|
|
|
|
const SAL_THROW(())
|
|
|
|
{
|
|
|
|
sal_Int32 n = rtl_str_indexOfStr_WithLength(
|
|
|
|
pData->buffer + fromIndex, pData->length - fromIndex, str, len);
|
|
|
|
return n < 0 ? n : n + fromIndex;
|
|
|
|
}
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns the index within this string of the last occurrence of
|
|
|
|
the specified substring, searching backward starting at the end.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
The returned index indicates the starting index of the substring
|
|
|
|
in this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
If str doesn't include any character, always -1 is
|
2001-05-09 11:56:53 +00:00
|
|
|
returned. This is also the case, if both strings are empty.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the substring to search for.
|
|
|
|
@return If the string argument occurs one or more times as a substring
|
|
|
|
within this string, then the index of the first character of
|
|
|
|
the last such substring is returned. If it does not occur as
|
2001-10-30 12:41:07 +00:00
|
|
|
a substring, -1 is returned.
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
|
|
|
sal_Int32 lastIndexOf( const OString & str ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
|
|
|
|
str.pData->buffer, str.pData->length );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns the index within this string of the last occurrence of
|
2007-11-23 12:16:14 +00:00
|
|
|
the specified substring, searching backward starting before the specified
|
|
|
|
index.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
The returned index indicates the starting index of the substring
|
|
|
|
in this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
If str doesn't include any character, always -1 is
|
2001-05-09 11:56:53 +00:00
|
|
|
returned. This is also the case, if both strings are empty.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the substring to search for.
|
2007-11-23 12:16:14 +00:00
|
|
|
@param fromIndex the index before which to start the search.
|
2001-05-09 11:56:53 +00:00
|
|
|
@return If the string argument occurs one or more times as a substring
|
2007-11-23 12:16:14 +00:00
|
|
|
within this string before the starting index, then the index
|
2001-05-09 11:56:53 +00:00
|
|
|
of the first character of the last such substring is
|
2007-11-23 12:16:14 +00:00
|
|
|
returned. Otherwise, -1 is returned.
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
2001-05-17 09:06:58 +00:00
|
|
|
sal_Int32 lastIndexOf( const OString & str, sal_Int32 fromIndex ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
|
|
|
|
str.pData->buffer, str.pData->length );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2002-10-16 11:08:09 +00:00
|
|
|
Returns a new string that is a substring of this string.
|
|
|
|
|
|
|
|
The substring begins at the specified beginIndex. It is an error for
|
|
|
|
beginIndex to be negative or to be greater than the length of this string.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param beginIndex the beginning index, inclusive.
|
|
|
|
@return the specified substring.
|
|
|
|
*/
|
|
|
|
OString copy( sal_Int32 beginIndex ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2011-11-22 09:34:46 +01:00
|
|
|
assert(beginIndex >= 0 && beginIndex <= getLength());
|
2001-05-09 11:56:53 +00:00
|
|
|
if ( beginIndex == 0 )
|
|
|
|
return *this;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rtl_String* pNew = 0;
|
2001-05-09 14:25:04 +00:00
|
|
|
rtl_string_newFromStr_WithLength( &pNew, pData->buffer+beginIndex, getLength()-beginIndex );
|
2001-05-09 11:56:53 +00:00
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
|
|
|
}
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-10-30 12:41:07 +00:00
|
|
|
Returns a new string that is a substring of this string.
|
|
|
|
|
2002-10-16 11:08:09 +00:00
|
|
|
The substring begins at the specified beginIndex and contains count
|
|
|
|
characters. It is an error for either beginIndex or count to be negative,
|
|
|
|
or for beginIndex + count to be greater than the length of this string.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param beginIndex the beginning index, inclusive.
|
|
|
|
@param count the number of characters.
|
|
|
|
@return the specified substring.
|
|
|
|
*/
|
|
|
|
OString copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2011-11-22 09:34:46 +01:00
|
|
|
assert(beginIndex >= 0 && beginIndex <= getLength()
|
|
|
|
&& count >= 0 && count <= getLength() - beginIndex);
|
2001-05-09 11:56:53 +00:00
|
|
|
if ( (beginIndex == 0) && (count == getLength()) )
|
2000-09-18 14:18:43 +00:00
|
|
|
return *this;
|
|
|
|
else
|
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
rtl_String* pNew = 0;
|
2001-05-09 14:25:04 +00:00
|
|
|
rtl_string_newFromStr_WithLength( &pNew, pData->buffer+beginIndex, count );
|
2001-05-09 11:56:53 +00:00
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Concatenates the specified string to the end of this string.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param str the string that is concatenated to the end
|
|
|
|
of this string.
|
|
|
|
@return a string that represents the concatenation of this string
|
|
|
|
followed by the string argument.
|
|
|
|
*/
|
|
|
|
OString concat( const OString & str ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
rtl_String* pNew = 0;
|
|
|
|
rtl_string_newConcat( &pNew, pData, str.pData );
|
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
friend OString operator+( const OString & str1, const OString & str2 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
return str1.concat( str2 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns a new string resulting from replacing n = count characters
|
|
|
|
from position index in this string with newStr.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param index the replacing index in str.
|
|
|
|
The index must be greater or equal as 0 and
|
|
|
|
less or equal as the length of the string.
|
|
|
|
@param count the count of charcters that will replaced
|
|
|
|
The count must be greater or equal as 0 and
|
|
|
|
less or equal as the length of the string minus index.
|
|
|
|
@param newStr the new substring.
|
|
|
|
@return the new string.
|
|
|
|
*/
|
|
|
|
OString replaceAt( sal_Int32 index, sal_Int32 count, const OString& newStr ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
rtl_String* pNew = 0;
|
|
|
|
rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
|
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns a new string resulting from replacing all occurrences of
|
|
|
|
oldChar in this string with newChar.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
If the character oldChar does not occur in the character sequence
|
|
|
|
represented by this object, then the string is assigned with
|
|
|
|
str.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@param oldChar the old character.
|
|
|
|
@param newChar the new character.
|
|
|
|
@return a string derived from this string by replacing every
|
|
|
|
occurrence of oldChar with newChar.
|
|
|
|
*/
|
|
|
|
OString replace( sal_Char oldChar, sal_Char newChar ) const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
rtl_String* pNew = 0;
|
|
|
|
rtl_string_newReplace( &pNew, pData, oldChar, newChar );
|
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
2012-02-15 15:26:43 +01:00
|
|
|
/**
|
|
|
|
Returns a new string resulting from replacing the first occurrence of a
|
|
|
|
given substring with another substring.
|
|
|
|
|
|
|
|
@param from the substring to be replaced
|
|
|
|
|
|
|
|
@param to the replacing substring
|
|
|
|
|
|
|
|
@param[in,out] index pointer to a start index; if the pointer is
|
|
|
|
non-null: upon entry to the function, its value is the index into the this
|
|
|
|
string at which to start searching for the \p from substring, the value
|
|
|
|
must be non-negative and not greater than this string's length; upon exit
|
|
|
|
from the function its value is the index into this string at which the
|
|
|
|
replacement took place or -1 if no replacement took place; if the pointer
|
|
|
|
is null, searching always starts at index 0
|
|
|
|
|
|
|
|
@since LibreOffice 3.6
|
|
|
|
*/
|
|
|
|
OString replaceFirst(
|
|
|
|
OString const & from, OString const & to, sal_Int32 * index = 0) const
|
|
|
|
{
|
|
|
|
rtl_String * s = 0;
|
|
|
|
sal_Int32 i = 0;
|
|
|
|
rtl_string_newReplaceFirst(
|
|
|
|
&s, pData, from.pData->buffer, from.pData->length,
|
|
|
|
to.pData->buffer, to.pData->length, index == 0 ? &i : index);
|
|
|
|
return OString(s, SAL_NO_ACQUIRE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a new string resulting from replacing all occurrences of a given
|
|
|
|
substring with another substring.
|
|
|
|
|
|
|
|
Replacing subsequent occurrences picks up only after a given replacement.
|
|
|
|
That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
|
|
|
|
|
|
|
|
@param from the substring to be replaced
|
|
|
|
|
|
|
|
@param to the replacing substring
|
|
|
|
|
|
|
|
@since LibreOffice 3.6
|
|
|
|
*/
|
|
|
|
OString replaceAll(OString const & from, OString const & to) const {
|
|
|
|
rtl_String * s = 0;
|
|
|
|
rtl_string_newReplaceAll(
|
|
|
|
&s, pData, from.pData->buffer, from.pData->length,
|
|
|
|
to.pData->buffer, to.pData->length);
|
|
|
|
return OString(s, SAL_NO_ACQUIRE);
|
|
|
|
}
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Converts from this string all ASCII uppercase characters (65-90)
|
|
|
|
to ASCII lowercase characters (97-122).
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
If the string doesn't contain characters which must be converted,
|
|
|
|
then the new string is assigned with str.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@return the string, converted to ASCII lowercase.
|
|
|
|
*/
|
|
|
|
OString toAsciiLowerCase() const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
rtl_String* pNew = 0;
|
|
|
|
rtl_string_newToAsciiLowerCase( &pNew, pData );
|
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Converts from this string all ASCII lowercase characters (97-122)
|
|
|
|
to ASCII uppercase characters (65-90).
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
If the string doesn't contain characters which must be converted,
|
|
|
|
then the new string is assigned with str.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@return the string, converted to ASCII uppercase.
|
|
|
|
*/
|
|
|
|
OString toAsciiUpperCase() const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
rtl_String* pNew = 0;
|
|
|
|
rtl_string_newToAsciiUpperCase( &pNew, pData );
|
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-09 11:56:53 +00:00
|
|
|
Returns a new string resulting from removing white space from both ends
|
2001-10-30 12:41:07 +00:00
|
|
|
of the string.
|
|
|
|
|
|
|
|
All characters that have codes less than or equal to
|
2001-05-09 11:56:53 +00:00
|
|
|
32 (the space character) are considered to be white space.
|
|
|
|
If the string doesn't contain white spaces at both ends,
|
|
|
|
then the new string is assigned with str.
|
2001-04-26 12:34:01 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
@return the string, with white space removed from the front and end.
|
|
|
|
*/
|
|
|
|
OString trim() const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-05-09 11:56:53 +00:00
|
|
|
rtl_String* pNew = 0;
|
2000-09-18 14:18:43 +00:00
|
|
|
rtl_string_newTrim( &pNew, pData );
|
2001-05-09 11:56:53 +00:00
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
/**
|
|
|
|
Returns a token in the string.
|
2001-03-16 14:17:03 +00:00
|
|
|
|
2001-05-09 11:56:53 +00:00
|
|
|
Example:
|
|
|
|
sal_Int32 nIndex = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
...
|
|
|
|
OString aToken = aStr.getToken( 0, ';', nIndex );
|
|
|
|
...
|
|
|
|
}
|
|
|
|
while ( nIndex >= 0 );
|
|
|
|
|
2004-09-20 07:42:33 +00:00
|
|
|
@param token the number of the token to return.
|
2001-05-09 11:56:53 +00:00
|
|
|
@param cTok the character which seperate the tokens.
|
|
|
|
@param index the position at which the token is searched in the
|
|
|
|
string.
|
2004-09-20 07:42:33 +00:00
|
|
|
The index must not be greater thanthe length of the
|
|
|
|
string.
|
2001-05-09 11:56:53 +00:00
|
|
|
This param is set to the position of the
|
|
|
|
next token or to -1, if it is the last token.
|
2004-09-20 07:42:33 +00:00
|
|
|
@return the token; if either token or index is negative, an empty token
|
|
|
|
is returned (and index is set to -1)
|
2001-05-09 11:56:53 +00:00
|
|
|
*/
|
|
|
|
OString getToken( sal_Int32 token, sal_Char cTok, sal_Int32& index ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
rtl_String * pNew = 0;
|
|
|
|
index = rtl_string_getToken( &pNew, pData, token, cTok, index );
|
|
|
|
return OString( pNew, (DO_NOT_ACQUIRE *)0 );
|
|
|
|
}
|
2001-03-16 14:17:03 +00:00
|
|
|
|
2012-02-15 15:26:43 +01:00
|
|
|
/**
|
|
|
|
Returns a token from the string.
|
|
|
|
|
|
|
|
The same as getToken(sal_Int32, sal_Char, sal_Int32 &), but always passing
|
|
|
|
in 0 as the start index in the third argument.
|
|
|
|
|
|
|
|
@param count the number of the token to return, starting with 0
|
|
|
|
@param separator the character which separates the tokens
|
|
|
|
|
|
|
|
@return the given token, or an empty string
|
|
|
|
|
|
|
|
@since LibreOffice 3.6
|
|
|
|
*/
|
|
|
|
OString getToken(sal_Int32 count, char separator) const {
|
|
|
|
sal_Int32 n = 0;
|
|
|
|
return getToken(count, separator, n);
|
|
|
|
}
|
|
|
|
|
2000-09-18 14:18:43 +00:00
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Returns the Boolean value from this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@return sal_True, if the string is 1 or "True" in any ASCII case.
|
|
|
|
sal_False in any other case.
|
|
|
|
*/
|
|
|
|
sal_Bool toBoolean() const SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
return rtl_str_toBoolean( pData->buffer );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Returns the first character from this string.
|
|
|
|
|
|
|
|
@return the first character from this string or 0, if this string
|
|
|
|
is emptry.
|
|
|
|
*/
|
|
|
|
sal_Char toChar() const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return pData->buffer[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the int32 value from this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@param radix the radix (between 2 and 36)
|
|
|
|
@return the int32 represented from this string.
|
|
|
|
0 if this string represents no number.
|
|
|
|
*/
|
|
|
|
sal_Int32 toInt32( sal_Int16 radix = 10 ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return rtl_str_toInt32( pData->buffer, radix );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the int64 value from this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@param radix the radix (between 2 and 36)
|
|
|
|
@return the int64 represented from this string.
|
|
|
|
0 if this string represents no number.
|
|
|
|
*/
|
|
|
|
sal_Int64 toInt64( sal_Int16 radix = 10 ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return rtl_str_toInt64( pData->buffer, radix );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the float value from this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@return the float represented from this string.
|
|
|
|
0.0 if this string represents no number.
|
|
|
|
*/
|
|
|
|
float toFloat() const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return rtl_str_toFloat( pData->buffer );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the double value from this string.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@return the double represented from this string.
|
|
|
|
0.0 if this string represents no number.
|
|
|
|
*/
|
|
|
|
double toDouble() const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return rtl_str_toDouble( pData->buffer );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the string representation of the sal_Bool argument.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
If the sal_Bool is true, the string "true" is returned.
|
|
|
|
If the sal_Bool is false, the string "false" is returned.
|
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@param b a sal_Bool.
|
|
|
|
@return a string with the string representation of the argument.
|
|
|
|
*/
|
|
|
|
static OString valueOf( sal_Bool b ) SAL_THROW(())
|
|
|
|
{
|
|
|
|
sal_Char aBuf[RTL_STR_MAX_VALUEOFBOOLEAN];
|
|
|
|
rtl_String* pNewData = 0;
|
|
|
|
rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfBoolean( aBuf, b ) );
|
|
|
|
return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the string representation of the char argument.
|
|
|
|
|
|
|
|
@param c a character.
|
|
|
|
@return a string with the string representation of the argument.
|
|
|
|
*/
|
|
|
|
static OString valueOf( sal_Char c ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
|
|
|
return OString( &c, 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Returns the string representation of the int argument.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@param i a int32.
|
|
|
|
@param radix the radix (between 2 and 36)
|
|
|
|
@return a string with the string representation of the argument.
|
|
|
|
*/
|
|
|
|
static OString valueOf( sal_Int32 i, sal_Int16 radix = 10 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
sal_Char aBuf[RTL_STR_MAX_VALUEOFINT32];
|
|
|
|
rtl_String* pNewData = 0;
|
|
|
|
rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfInt32( aBuf, i, radix ) );
|
|
|
|
return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Returns the string representation of the long argument.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
2006-06-20 03:14:41 +00:00
|
|
|
@param ll a int64.
|
2001-03-16 14:17:03 +00:00
|
|
|
@param radix the radix (between 2 and 36)
|
|
|
|
@return a string with the string representation of the argument.
|
|
|
|
*/
|
2006-06-20 03:14:41 +00:00
|
|
|
static OString valueOf( sal_Int64 ll, sal_Int16 radix = 10 ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
sal_Char aBuf[RTL_STR_MAX_VALUEOFINT64];
|
|
|
|
rtl_String* pNewData = 0;
|
2006-06-20 03:14:41 +00:00
|
|
|
rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfInt64( aBuf, ll, radix ) );
|
2001-03-16 14:17:03 +00:00
|
|
|
return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Returns the string representation of the float argument.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@param f a float.
|
|
|
|
@return a string with the string representation of the argument.
|
|
|
|
*/
|
|
|
|
static OString valueOf( float f ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
sal_Char aBuf[RTL_STR_MAX_VALUEOFFLOAT];
|
|
|
|
rtl_String* pNewData = 0;
|
|
|
|
rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfFloat( aBuf, f ) );
|
|
|
|
return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-03-16 14:17:03 +00:00
|
|
|
Returns the string representation of the double argument.
|
2001-10-30 12:41:07 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
This function can't be used for language specific conversion.
|
|
|
|
|
|
|
|
@param d a double.
|
|
|
|
@return a string with the string representation of the argument.
|
|
|
|
*/
|
|
|
|
static OString valueOf( double d ) SAL_THROW(())
|
2000-09-18 14:18:43 +00:00
|
|
|
{
|
2001-03-16 14:17:03 +00:00
|
|
|
sal_Char aBuf[RTL_STR_MAX_VALUEOFDOUBLE];
|
|
|
|
rtl_String* pNewData = 0;
|
|
|
|
rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfDouble( aBuf, d ) );
|
|
|
|
return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
|
2000-09-18 14:18:43 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
/* ======================================================================= */
|
|
|
|
|
2001-10-30 12:41:07 +00:00
|
|
|
/** A helper to use OStrings with hash maps.
|
|
|
|
|
|
|
|
Instances of this class are unary function objects that can be used as
|
2011-02-03 16:24:08 -07:00
|
|
|
hash function arguments to boost::unordered_map and similar constructs.
|
2001-10-30 12:41:07 +00:00
|
|
|
*/
|
2000-11-14 10:12:38 +00:00
|
|
|
struct OStringHash
|
|
|
|
{
|
2001-10-30 12:41:07 +00:00
|
|
|
/** Compute a hash code for a string.
|
|
|
|
|
|
|
|
@param rString
|
|
|
|
a string.
|
|
|
|
|
|
|
|
@return
|
|
|
|
a hash code for the string. This hash code should not be stored
|
|
|
|
persistently, as its computation may change in later revisions.
|
|
|
|
*/
|
2001-03-16 14:17:03 +00:00
|
|
|
size_t operator()( const rtl::OString& rString ) const
|
|
|
|
{ return (size_t)rString.hashCode(); }
|
2000-11-14 10:12:38 +00:00
|
|
|
};
|
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
/* ======================================================================= */
|
2000-09-18 14:18:43 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
} /* Namespace */
|
2000-09-18 14:18:43 +00:00
|
|
|
|
2001-03-16 14:17:03 +00:00
|
|
|
#endif /* _RTL_STRING_HXX_ */
|
2010-10-14 08:30:07 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|