1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 #*************************************************************************/
34 #include <sal/types.h>
37 #ifndef _RTL_USTRING_H_
38 #include <rtl/ustring.h>
41 #ifndef _RTL_STRING_HXX_
42 #include <rtl/string.hxx>
45 #ifndef _RTL_STRING_UTILS_CONST_H_
46 #include <rtl_String_Utils_Const.h>
50 sal_uInt32
AStringLen( const sal_Char
*pAStr
)
52 sal_uInt32 nStrLen
= 0;
56 const sal_Char
*pTempStr
= pAStr
;
63 nStrLen
= (sal_uInt32
)( pTempStr
- pAStr
);
68 sal_Char
* cpystr( sal_Char
* dst
, const sal_Char
* src
)
70 const sal_Char
* psrc
= src
;
73 while( *pdst
++ = *psrc
++ );
77 sal_Char
* cpynstr( sal_Char
* dst
, const sal_Char
* src
, sal_uInt32 cnt
)
80 const sal_Char
* psrc
= src
;
85 if ( len
>= AStringLen(src
) )
87 return( cpystr( dst
, src
) );
90 // copy string by char
91 for( i
= 0; i
< len
; i
++ )
98 //------------------------------------------------------------------------
99 sal_Bool
cmpstr( const sal_Char
* str1
, const sal_Char
* str2
, sal_uInt32 len
)
101 const sal_Char
* pBuf1
= str1
;
102 const sal_Char
* pBuf2
= str2
;
105 while ( (*pBuf1
== *pBuf2
) && i
< len
)
113 //------------------------------------------------------------------------
114 sal_Bool
cmpustr( const sal_Unicode
* str1
, const sal_Unicode
* str2
, sal_uInt32 len
)
116 const sal_Unicode
* pBuf1
= str1
;
117 const sal_Unicode
* pBuf2
= str2
;
120 while ( (*pBuf1
== *pBuf2
) && i
< len
)
129 //-----------------------------------------------------------------------
130 sal_Bool
cmpustr( const sal_Unicode
* str1
, const sal_Unicode
* str2
)
132 const sal_Unicode
* pBuf1
= str1
;
133 const sal_Unicode
* pBuf2
= str2
;
134 sal_Bool res
= sal_True
;
136 while ( (*pBuf1
== *pBuf2
) && *pBuf1
!='\0' && *pBuf2
!= '\0')
141 if (*pBuf1
== '\0' && *pBuf2
== '\0')
148 sal_Char
* createName( sal_Char
* dst
, const sal_Char
* meth
, sal_uInt32 cnt
)
150 sal_Char
* pdst
= dst
;
152 sal_Char
* pstr
= nstr
;
153 rtl_str_valueOfInt32( pstr
, cnt
, 10 );
155 cpystr( pdst
, meth
);
156 cpystr( pdst
+ AStringLen(meth
), "_" );
160 cpystr(pdst
+ AStringLen(pdst
), "0" );
164 cpystr(pdst
+ AStringLen(pdst
), "0" );
167 cpystr( pdst
+ AStringLen(pdst
), nstr
);
171 //------------------------------------------------------------------------
173 static inline sal_Int32
ACharToUCharCompare( const sal_Unicode
*pUStr
,
174 const sal_Char
*pAStr
178 sal_Int32 nUChar
= (sal_Int32
)*pUStr
;
179 sal_Int32 nChar
= (sal_Int32
)((unsigned char)*pAStr
);
181 nCmp
= nUChar
- nChar
;
184 } // ACharToUCharCompare
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */