UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 #ifndef _RTL_STRING_H_ 00030 #define _RTL_STRING_H_ 00031 00032 #include <sal/types.h> 00033 #include <osl/interlck.h> 00034 #include <rtl/textcvt.h> 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 /* ======================================================================= */ 00041 00054 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_getLength( 00055 const sal_Char * str ) SAL_THROW_EXTERN_C(); 00056 00075 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compare( 00076 const sal_Char * first, const sal_Char * second ) SAL_THROW_EXTERN_C(); 00077 00103 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compare_WithLength( 00104 const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C(); 00105 00135 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_shortenedCompare_WithLength( 00136 const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C(); 00137 00163 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_reverseCompare_WithLength( 00164 const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C(); 00165 00185 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase( 00186 const sal_Char * first, const sal_Char * second ) SAL_THROW_EXTERN_C(); 00187 00215 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase_WithLength( 00216 const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen ) SAL_THROW_EXTERN_C(); 00217 00250 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 00251 const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen, sal_Int32 shortenedLen ) SAL_THROW_EXTERN_C(); 00252 00265 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_hashCode( 00266 const sal_Char * str ) SAL_THROW_EXTERN_C(); 00267 00283 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_hashCode_WithLength( 00284 const sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 00285 00300 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfChar( 00301 const sal_Char * str, sal_Char ch ) SAL_THROW_EXTERN_C(); 00302 00319 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfChar_WithLength( 00320 const sal_Char * str, sal_Int32 len, sal_Char ch ) SAL_THROW_EXTERN_C(); 00321 00337 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfChar( 00338 const sal_Char * str, sal_Char ch ) SAL_THROW_EXTERN_C(); 00339 00357 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfChar_WithLength( 00358 const sal_Char * str, sal_Int32 len, sal_Char ch ) SAL_THROW_EXTERN_C(); 00359 00375 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfStr( 00376 const sal_Char * str, const sal_Char * subStr ) SAL_THROW_EXTERN_C(); 00377 00400 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_indexOfStr_WithLength( 00401 const sal_Char * str, sal_Int32 len, const sal_Char * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C(); 00402 00418 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfStr( 00419 const sal_Char * str, const sal_Char * subStr ) SAL_THROW_EXTERN_C(); 00420 00443 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_lastIndexOfStr_WithLength( 00444 const sal_Char * str, sal_Int32 len, const sal_Char * subStr, sal_Int32 subLen ) SAL_THROW_EXTERN_C(); 00445 00460 SAL_DLLPUBLIC void SAL_CALL rtl_str_replaceChar( 00461 sal_Char * str, sal_Char oldChar, sal_Char newChar ) SAL_THROW_EXTERN_C(); 00462 00480 SAL_DLLPUBLIC void SAL_CALL rtl_str_replaceChar_WithLength( 00481 sal_Char * str, sal_Int32 len, sal_Char oldChar, sal_Char newChar ) SAL_THROW_EXTERN_C(); 00482 00492 SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiLowerCase( 00493 sal_Char * str ) SAL_THROW_EXTERN_C(); 00494 00507 SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiLowerCase_WithLength( 00508 sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 00509 00519 SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiUpperCase( 00520 sal_Char * str ) SAL_THROW_EXTERN_C(); 00521 00534 SAL_DLLPUBLIC void SAL_CALL rtl_str_toAsciiUpperCase_WithLength( 00535 sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 00536 00549 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_trim( 00550 sal_Char * str ) SAL_THROW_EXTERN_C(); 00551 00568 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_trim_WithLength( 00569 sal_Char * str, sal_Int32 len ) SAL_THROW_EXTERN_C(); 00570 00589 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfBoolean( 00590 sal_Char * str, sal_Bool b ) SAL_THROW_EXTERN_C(); 00591 #define RTL_STR_MAX_VALUEOFBOOLEAN 6 00592 00606 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfChar( 00607 sal_Char * str, sal_Char ch ) SAL_THROW_EXTERN_C(); 00608 #define RTL_STR_MAX_VALUEOFCHAR 2 00609 00629 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfInt32( 00630 sal_Char * str, sal_Int32 i, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 00631 #define RTL_STR_MIN_RADIX 2 00632 #define RTL_STR_MAX_RADIX 36 00633 #define RTL_STR_MAX_VALUEOFINT32 33 00634 00654 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfInt64( 00655 sal_Char * str, sal_Int64 l, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 00656 #define RTL_STR_MAX_VALUEOFINT64 65 00657 00673 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfFloat( 00674 sal_Char * str, float f ) SAL_THROW_EXTERN_C(); 00675 #define RTL_STR_MAX_VALUEOFFLOAT 15 00676 00692 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfDouble( 00693 sal_Char * str, double d ) SAL_THROW_EXTERN_C(); 00694 #define RTL_STR_MAX_VALUEOFDOUBLE 25 00695 00707 SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_str_toBoolean( 00708 const sal_Char * str ) SAL_THROW_EXTERN_C(); 00709 00726 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_toInt32( 00727 const sal_Char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 00728 00745 SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_str_toInt64( 00746 const sal_Char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C(); 00747 00760 SAL_DLLPUBLIC float SAL_CALL rtl_str_toFloat( 00761 const sal_Char * str ) SAL_THROW_EXTERN_C(); 00762 00775 SAL_DLLPUBLIC double SAL_CALL rtl_str_toDouble( 00776 const sal_Char * str ) SAL_THROW_EXTERN_C(); 00777 00778 /* ======================================================================= */ 00779 00780 #ifdef SAL_W32 00781 # pragma pack(push, 8) 00782 #endif 00783 00787 typedef struct _rtl_String 00788 { 00789 oslInterlockedCount refCount; /* opaque */ 00790 sal_Int32 length; 00791 sal_Char buffer[1]; 00792 } rtl_String; 00795 #if defined(SAL_W32) 00796 #pragma pack(pop) 00797 #endif 00798 00799 /* ----------------------------------------------------------------------- */ 00800 00806 SAL_DLLPUBLIC void SAL_CALL rtl_string_acquire( rtl_String * str ) SAL_THROW_EXTERN_C(); 00807 00815 SAL_DLLPUBLIC void SAL_CALL rtl_string_release( rtl_String * str ) SAL_THROW_EXTERN_C(); 00816 00823 SAL_DLLPUBLIC void SAL_CALL rtl_string_new( rtl_String ** newStr ) SAL_THROW_EXTERN_C(); 00824 00838 SAL_DLLPUBLIC void SAL_CALL rtl_string_new_WithLength( rtl_String ** newStr, sal_Int32 len ) SAL_THROW_EXTERN_C(); 00839 00853 SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromString( rtl_String ** newStr, const rtl_String * value ) SAL_THROW_EXTERN_C(); 00854 00868 SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromStr( rtl_String ** newStr, const sal_Char * value ) SAL_THROW_EXTERN_C(); 00869 00887 SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromStr_WithLength( rtl_String ** newStr, const sal_Char * value, sal_Int32 len ) SAL_THROW_EXTERN_C(); 00888 00893 SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromLiteral( rtl_String ** newStr, const sal_Char * value, sal_Int32 len, sal_Int32 allocExtra ) SAL_THROW_EXTERN_C(); 00894 00907 SAL_DLLPUBLIC void SAL_CALL rtl_string_assign( rtl_String ** str, rtl_String * rightValue ) SAL_THROW_EXTERN_C(); 00908 00919 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_string_getLength( const rtl_String * str ) SAL_THROW_EXTERN_C(); 00920 00929 SAL_DLLPUBLIC sal_Char * SAL_CALL rtl_string_getStr( rtl_String * str ) SAL_THROW_EXTERN_C(); 00930 00948 SAL_DLLPUBLIC void SAL_CALL rtl_string_newConcat( rtl_String ** newStr, rtl_String * left, rtl_String * right ) SAL_THROW_EXTERN_C(); 00949 00979 SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceStrAt( 00980 rtl_String ** newStr, rtl_String * str, sal_Int32 idx, sal_Int32 count, rtl_String * subStr ) SAL_THROW_EXTERN_C(); 00981 01006 SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplace( 01007 rtl_String ** newStr, rtl_String * str, sal_Char oldChar, sal_Char newChar ) SAL_THROW_EXTERN_C(); 01008 01036 SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceFirst( 01037 rtl_String ** newStr, rtl_String * str, char const * from, 01038 sal_Int32 fromLength, char const * to, sal_Int32 toLength, 01039 sal_Int32 * index) SAL_THROW_EXTERN_C(); 01040 01064 SAL_DLLPUBLIC void SAL_CALL rtl_string_newReplaceAll( 01065 rtl_String ** newStr, rtl_String * str, char const * from, 01066 sal_Int32 fromLength, char const * to, sal_Int32 toLength) 01067 SAL_THROW_EXTERN_C(); 01068 01088 SAL_DLLPUBLIC void SAL_CALL rtl_string_newToAsciiLowerCase( 01089 rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C(); 01090 01110 SAL_DLLPUBLIC void SAL_CALL rtl_string_newToAsciiUpperCase( 01111 rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C(); 01112 01132 SAL_DLLPUBLIC void SAL_CALL rtl_string_newTrim( 01133 rtl_String ** newStr, rtl_String * str ) SAL_THROW_EXTERN_C(); 01134 01179 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_string_getToken( 01180 rtl_String ** newStr , rtl_String * str, sal_Int32 token, sal_Char cTok, sal_Int32 idx ) SAL_THROW_EXTERN_C(); 01181 01182 /* ======================================================================= */ 01183 01198 // The &foo[0] trick is intentional, it makes sure the type is char* or const char* 01199 // (plain cast to const char* would not work with non-const char foo[]="a", which seems to be allowed). 01200 // This is to avoid mistaken use with functions that accept string literals 01201 // (i.e. const char (&)[N]) where usage of this macro otherwise could match 01202 // the argument and a following int argument with a default value (e.g. OString::match()). 01203 #define RTL_CONSTASCII_STRINGPARAM( constAsciiStr ) (&(constAsciiStr)[0]), \ 01204 ((sal_Int32)SAL_N_ELEMENTS(constAsciiStr)-1) 01205 01219 #define RTL_CONSTASCII_LENGTH( constAsciiStr ) ((sal_Int32)(SAL_N_ELEMENTS(constAsciiStr)-1)) 01220 01221 /* ======================================================================= */ 01222 01223 /* predefined constants for String-Conversion */ 01224 #define OUSTRING_TO_OSTRING_CVTFLAGS (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |\ 01225 RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |\ 01226 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |\ 01227 RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |\ 01228 RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE) 01229 01230 /* ----------------------------------------------------------------------- */ 01231 01264 SAL_DLLPUBLIC void SAL_CALL rtl_uString2String( 01265 rtl_String ** newStr, const sal_Unicode * str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags ) SAL_THROW_EXTERN_C(); 01266 01297 SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_convertUStringToString( 01298 rtl_String ** pTarget, 01299 sal_Unicode const * pSource, 01300 sal_Int32 nLength, 01301 rtl_TextEncoding nEncoding, 01302 sal_uInt32 nFlags) 01303 SAL_THROW_EXTERN_C(); 01304 01305 #ifdef __cplusplus 01306 } 01307 #endif 01308 01309 #endif /* _RTL_STRING_H_ */ 01310 01311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */