diff options
author | Andreas Bille <abi@openoffice.org> | 2001-10-31 12:53:36 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2001-10-31 12:53:36 +0000 |
commit | 3885a522ca616a8546409304f518deec81cae86a (patch) | |
tree | a31fe0afd1943ba6c0c21cea3cc0c0533fd19d17 /xmlhelp | |
parent | c5718b941491ffaa937767c579627444c0957b86 (diff) |
#83054#
Performance
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 114 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 51 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.hxx | 5 |
3 files changed, 108 insertions, 62 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index a97cc4ccc743..22c0368d83b3 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -2,9 +2,9 @@ * * $RCSfile: databases.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: abi $ $Date: 2001-10-31 13:08:14 $ + * last change: $Author: abi $ $Date: 2001-10-31 13:53:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,8 +109,19 @@ Databases::Databases( const rtl::OUString& instPath, m_nErrorDocLength( 0 ), m_pErrorDoc( 0 ), m_nCustomCSSDocLength( 0 ), - m_pCustomCSSDoc( 0 ) + m_pCustomCSSDoc( 0 ), + prodName( rtl::OUString::createFromAscii( "%PRODUCTNAME" ) ), + prodVersion( rtl::OUString::createFromAscii( "%PRODUCTVERSION" ) ), + vendName( rtl::OUString::createFromAscii( "%VENDORNAME" ) ), + vendVersion( rtl::OUString::createFromAscii( "%VENDORVERSION" ) ), + vendShort( rtl::OUString::createFromAscii( "%VENDORSHORT" ) ) { + m_vAdd[0] = 12; + m_vAdd[1] = 15; + m_vAdd[2] = 11; + m_vAdd[3] = 14; + m_vAdd[4] = 12; + m_vReplacement[0] = productName; m_vReplacement[1] = productVersion; m_vReplacement[2] = vendorName; @@ -173,46 +184,26 @@ Databases::~Databases() void Databases::replaceName( rtl::OUString& oustring ) const { - sal_Int32 idx = -1,k = 0,add,off; + sal_Int32 idx = -1,k = 0,off; bool cap = false; rtl::OUStringBuffer aStrBuf( 0 ); while( ( idx = oustring.indexOf( sal_Unicode('%'),++idx ) ) != -1 ) { - if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTNAME" ), - idx ) == idx ) - { - add = 12; + if( oustring.indexOf( prodName,idx ) == idx ) off = PRODUCTNAME; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTVERSION" ), - idx ) == idx ) - { - add = 15; + else if( oustring.indexOf( prodVersion,idx ) == idx ) off = PRODUCTVERSION; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORNAME" ), - idx ) == idx ) - { - add = 11; + else if( oustring.indexOf( vendName,idx ) == idx ) off = VENDORNAME; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORVERSION" ), - idx ) == idx ) - { - add = 14; + else if( oustring.indexOf( vendVersion,idx ) == idx ) off = VENDORVERSION; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORSHORT" ), - idx ) == idx ) - { - add = 12; + else if( oustring.indexOf( vendShort,idx ) == idx ) off = VENDORSHORT; - } else - add = 0; + off = -1; - if( add ) + if( off != -1 ) { if( ! cap ) { @@ -222,7 +213,7 @@ void Databases::replaceName( rtl::OUString& oustring ) const aStrBuf.append( &oustring.getStr()[k],idx - k ); aStrBuf.append( m_vReplacement[off] ); - k = idx + add; + k = idx + m_vAdd[off]; } } @@ -232,6 +223,65 @@ void Databases::replaceName( rtl::OUString& oustring ) const aStrBuf.append( &oustring.getStr()[k],oustring.getLength()-k ); oustring = aStrBuf.makeStringAndClear(); } +// sal_Int32 idx = -1,k = 0,add,off; +// bool cap = false; +// rtl::OUStringBuffer aStrBuf( 0 ); + +// while( ( idx = oustring.indexOf( sal_Unicode('%'),++idx ) ) != -1 ) +// { +// if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTNAME" ), +// idx ) == idx ) +// { +// add = 12; +// off = PRODUCTNAME; +// } +// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTVERSION" ), +// idx ) == idx ) +// { +// add = 15; +// off = PRODUCTVERSION; +// } +// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORNAME" ), +// idx ) == idx ) +// { +// add = 11; +// off = VENDORNAME; +// } +// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORVERSION" ), +// idx ) == idx ) +// { +// add = 14; +// off = VENDORVERSION; +// } +// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORSHORT" ), +// idx ) == idx ) +// { +// add = 12; +// off = VENDORSHORT; +// } +// else +// add = 0; + +// if( add ) +// { +// if( ! cap ) +// { +// cap = true; +// aStrBuf.ensureCapacity( 256 ); +// } + +// aStrBuf.append( &oustring.getStr()[k],idx - k ); +// aStrBuf.append( m_vReplacement[off] ); +// k = idx + add; +// } +// } + +// if( cap ) +// { +// if( k < oustring.getLength() ) +// aStrBuf.append( &oustring.getStr()[k],oustring.getLength()-k ); +// oustring = aStrBuf.makeStringAndClear(); +// } } diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index bc426cb2f8f1..3bc3a570d4b9 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -163,49 +163,37 @@ using namespace com::sun::star::frame; using namespace com::sun::star::container; +ConfigData::ConfigData() + : prodName( rtl::OUString::createFromAscii( "%PRODUCTNAME" ) ), + prodVersion( rtl::OUString::createFromAscii( "%PRODUCTVERSION" ) ), + vendName( rtl::OUString::createFromAscii( "%VENDORNAME" ) ), + vendVersion( rtl::OUString::createFromAscii( "%VENDORVERSION" ) ), + vendShort( rtl::OUString::createFromAscii( "%VENDORSHORT" ) ) +{ +} void SAL_CALL ConfigData::replaceName( rtl::OUString& oustring ) const { - sal_Int32 idx = -1,k = 0,add,off; + sal_Int32 idx = -1,k = 0,off; bool cap = false; rtl::OUStringBuffer aStrBuf( 0 ); while( ( idx = oustring.indexOf( sal_Unicode('%'),++idx ) ) != -1 ) { - if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTNAME" ), - idx ) == idx ) - { - add = 12; + if( oustring.indexOf( prodName,idx ) == idx ) off = PRODUCTNAME; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTVERSION" ), - idx ) == idx ) - { - add = 15; + else if( oustring.indexOf( prodVersion,idx ) == idx ) off = PRODUCTVERSION; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORNAME" ), - idx ) == idx ) - { - add = 11; + else if( oustring.indexOf( vendName,idx ) == idx ) off = VENDORNAME; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORVERSION" ), - idx ) == idx ) - { - add = 14; + else if( oustring.indexOf( vendVersion,idx ) == idx ) off = VENDORVERSION; - } - else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORSHORT" ), - idx ) == idx ) - { - add = 12; + else if( oustring.indexOf( vendShort,idx ) == idx ) off = VENDORSHORT; - } else - add = 0; + off = -1; - if( add ) + if( off != -1 ) { if( ! cap ) { @@ -215,7 +203,7 @@ void SAL_CALL ConfigData::replaceName( rtl::OUString& oustring ) const aStrBuf.append( &oustring.getStr()[k],idx - k ); aStrBuf.append( m_vReplacement[off] ); - k = idx + add; + k = idx + m_vAdd[off]; } } @@ -752,6 +740,11 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) aDirectory.close(); } + configData.m_vAdd[0] = 12; + configData.m_vAdd[1] = 15; + configData.m_vAdd[2] = 11; + configData.m_vAdd[3] = 14; + configData.m_vAdd[4] = 12; configData.m_vReplacement[0] = productName; configData.m_vReplacement[1] = productVersion; configData.m_vReplacement[2] = vendorName; diff --git a/xmlhelp/source/treeview/tvread.hxx b/xmlhelp/source/treeview/tvread.hxx index f2da2e996c87..5840a8a15fcb 100644 --- a/xmlhelp/source/treeview/tvread.hxx +++ b/xmlhelp/source/treeview/tvread.hxx @@ -55,8 +55,11 @@ namespace treeview { #define VENDORVERSION 3 #define VENDORSHORT 4 #define MAX_MODULE_COUNT 16 - + ConfigData(); + int m_vAdd[5]; rtl::OUString m_vReplacement[5]; + rtl::OUString prodName,prodVersion,vendName,vendVersion,vendShort; + sal_uInt64 filelen[MAX_MODULE_COUNT]; rtl::OUString fileurl[MAX_MODULE_COUNT]; rtl::OUString locale,system; |