Kaydet (Commit) e31496c9 authored tarafından Michael Meeks's avatar Michael Meeks

misc trivial tweaks, and documentation addition

üst 034350a5
...@@ -39,6 +39,6 @@ $(eval $(call gb_Module_add_targets,basic,\ ...@@ -39,6 +39,6 @@ $(eval $(call gb_Module_add_targets,basic,\
$(eval $(call gb_Module_add_check_targets,basic,\ $(eval $(call gb_Module_add_check_targets,basic,\
CppunitTest_basic_scanner \ CppunitTest_basic_scanner \
)) ))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -36,7 +36,7 @@ namespace ...@@ -36,7 +36,7 @@ namespace
void testGoto(); void testGoto();
void testExclamation(); void testExclamation();
void testNumbers(); void testNumbers();
// Adds code needed to register the test suite // Adds code needed to register the test suite
CPPUNIT_TEST_SUITE(ScannerTest); CPPUNIT_TEST_SUITE(ScannerTest);
...@@ -51,14 +51,6 @@ namespace ...@@ -51,14 +51,6 @@ namespace
// End of test suite definition // End of test suite definition
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
public:
void setUp()
{
}
void tearDown()
{
}
}; };
const static rtl::OUString cr(RTL_CONSTASCII_USTRINGPARAM("\n")); const static rtl::OUString cr(RTL_CONSTASCII_USTRINGPARAM("\n"));
...@@ -309,7 +301,7 @@ namespace ...@@ -309,7 +301,7 @@ namespace
CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT); CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
CPPUNIT_ASSERT(symbols[2].text == cr); CPPUNIT_ASSERT(symbols[2].text == cr);
CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT); CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
symbols = getSymbols(source10); symbols = getSymbols(source10);
CPPUNIT_ASSERT(symbols.size() == 8); CPPUNIT_ASSERT(symbols.size() == 8);
CPPUNIT_ASSERT(symbols[0].text == cr); CPPUNIT_ASSERT(symbols[0].text == cr);
...@@ -405,7 +397,7 @@ namespace ...@@ -405,7 +397,7 @@ namespace
CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT); CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
CPPUNIT_ASSERT(symbols[1].text == rem); CPPUNIT_ASSERT(symbols[1].text == rem);
CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT); CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
symbols = getSymbols(source7); symbols = getSymbols(source7);
CPPUNIT_ASSERT(symbols.size() == 4); CPPUNIT_ASSERT(symbols.size() == 4);
CPPUNIT_ASSERT(symbols[0].text == rem); CPPUNIT_ASSERT(symbols[0].text == rem);
...@@ -471,7 +463,7 @@ namespace ...@@ -471,7 +463,7 @@ namespace
CPPUNIT_ASSERT(symbols[0].text == asdf); CPPUNIT_ASSERT(symbols[0].text == asdf);
CPPUNIT_ASSERT(symbols[1].text == excl); CPPUNIT_ASSERT(symbols[1].text == excl);
CPPUNIT_ASSERT(symbols[2].text == asdf); CPPUNIT_ASSERT(symbols[2].text == asdf);
CPPUNIT_ASSERT(symbols[3].text == cr); CPPUNIT_ASSERT(symbols[3].text == cr);
symbols = getSymbols(source2); symbols = getSymbols(source2);
CPPUNIT_ASSERT(symbols.size() == 3); CPPUNIT_ASSERT(symbols.size() == 3);
...@@ -497,7 +489,7 @@ namespace ...@@ -497,7 +489,7 @@ namespace
CPPUNIT_ASSERT(symbols[0].text == excl); CPPUNIT_ASSERT(symbols[0].text == excl);
CPPUNIT_ASSERT(symbols[1].text == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"))); CPPUNIT_ASSERT(symbols[1].text == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
CPPUNIT_ASSERT(symbols[2].text == cr); CPPUNIT_ASSERT(symbols[2].text == cr);
symbols = getSymbols(source6); symbols = getSymbols(source6);
CPPUNIT_ASSERT(symbols.size() == 2); CPPUNIT_ASSERT(symbols.size() == 2);
CPPUNIT_ASSERT(symbols[0].text == excl); CPPUNIT_ASSERT(symbols[0].text == excl);
...@@ -523,12 +515,12 @@ namespace ...@@ -523,12 +515,12 @@ namespace
CPPUNIT_ASSERT(symbols.size() == 2); CPPUNIT_ASSERT(symbols.size() == 2);
CPPUNIT_ASSERT(symbols[0].number == 12345); CPPUNIT_ASSERT(symbols[0].number == 12345);
CPPUNIT_ASSERT(symbols[1].text == cr); CPPUNIT_ASSERT(symbols[1].text == cr);
symbols = getSymbols(source2); symbols = getSymbols(source2);
CPPUNIT_ASSERT(symbols.size() == 2); CPPUNIT_ASSERT(symbols.size() == 2);
CPPUNIT_ASSERT(symbols[0].number == 1.23); CPPUNIT_ASSERT(symbols[0].number == 1.23);
CPPUNIT_ASSERT(symbols[1].text == cr); CPPUNIT_ASSERT(symbols[1].text == cr);
symbols = getSymbols(source3); symbols = getSymbols(source3);
CPPUNIT_ASSERT(symbols.size() == 2); CPPUNIT_ASSERT(symbols.size() == 2);
CPPUNIT_ASSERT(symbols[0].number = 123.4); CPPUNIT_ASSERT(symbols[0].number = 123.4);
......
...@@ -391,7 +391,7 @@ sal_Bool SbiScanner::NextSym() ...@@ -391,7 +391,7 @@ sal_Bool SbiScanner::NextSym()
break; break;
default : default :
// treated as an operator // treated as an operator
pLine--; nCol--; nCol1 = nCol-1; pLine--; nCol--; nCol1 = nCol-1;
aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("&")); aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("&"));
return SYMBOL; return SYMBOL;
} }
...@@ -459,14 +459,14 @@ sal_Bool SbiScanner::NextSym() ...@@ -459,14 +459,14 @@ sal_Bool SbiScanner::NextSym()
// get out duplicate string delimiters // get out duplicate string delimiters
String s( cSep ); String s( cSep );
s += cSep; s += cSep;
sal_uInt16 nIdx = 0; sal_Int32 nIdx = 0;
do do
{ {
nIdx = aSym.indexOf( s, nIdx ); nIdx = aSym.indexOf( s, nIdx );
if( nIdx == STRING_NOTFOUND ) if( nIdx < 0 )
break; break;
::rtl::OUStringBuffer aSymBuf(aSym); ::rtl::OUStringBuffer aSymBuf( aSym );
aSymBuf.remove(nIdx, 1); aSymBuf.remove( nIdx, 1 );
aSym = aSymBuf.makeStringAndClear(); aSym = aSymBuf.makeStringAndClear();
nIdx++; nIdx++;
} }
......
...@@ -291,10 +291,10 @@ const ::rtl::OUString& SbiTokenizer::Symbol( SbiToken t ) ...@@ -291,10 +291,10 @@ const ::rtl::OUString& SbiTokenizer::Symbol( SbiToken t )
} }
switch( t ) switch( t )
{ {
case NEG : case NEG :
aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-")); aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
return aSym; return aSym;
case EOS : case EOS :
aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":/CRLF")); aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":/CRLF"));
return aSym; return aSym;
case EOLN : case EOLN :
......
...@@ -343,6 +343,8 @@ public: ...@@ -343,6 +343,8 @@ public:
@return 0 - if both strings are equal @return 0 - if both strings are equal
< 0 - if this string is less than the string argument < 0 - if this string is less than the string argument
> 0 - if this string is greater than the string argument > 0 - if this string is greater than the string argument
@since UDK 3.2.7
*/ */
sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const SAL_THROW(()) sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const SAL_THROW(())
{ {
...@@ -598,6 +600,24 @@ public: ...@@ -598,6 +600,24 @@ public:
return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0; return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
} }
/**
Compares two ASCII strings ignoring case
The comparison is based on the numeric value of each character in
the strings and return a value indicating their relationship.
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 sorting.
@param asciiStr the 8-Bit ASCII character string to be compared.
@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
@since LibreOffice 3.5
*/
sal_Int32 compareToIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const SAL_THROW(()) sal_Int32 compareToIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const SAL_THROW(())
{ {
return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ); return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment