Kaydet (Commit) f51877b1 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Combine comphelper::UStringMixEqual, comphelper::TStringMixEqualFunctor

Change-Id: I3ab3777a65fd68f8cbaf17a8e2a989dc4ad7b1cc
üst 02f9f422
......@@ -214,7 +214,7 @@ void OAdoColumn::fillPropertyValues()
m_TypeName = pTypeInfo->aSimpleType.aTypeName;
else if ( eType == adVarBinary && ADOS::isJetEngine(m_pConnection->getEngineType()) )
{
::comphelper::TStringMixEqualFunctor aCase(sal_False);
::comphelper::UStringMixEqual aCase(sal_False);
OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(),
pTypeInfoMap->end(),
::o3tl::compose1(
......
......@@ -86,7 +86,7 @@ sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPro
pColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)) >>= sTypeName;
const OTypeInfoMap* pTypeInfoMap = m_pConnection->getTypeInfo();
::comphelper::TStringMixEqualFunctor aCase(sal_False);
::comphelper::UStringMixEqual aCase(sal_False);
// search for typeinfo where the typename is equal sTypeName
OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(),
pTypeInfoMap->end(),
......
......@@ -596,7 +596,7 @@ const OExtendedTypeInfo* OConnection::getTypeInfoFromType(const OTypeInfoMap& _r
}
else if ( _sTypeName.getLength() )
{
::comphelper::TStringMixEqualFunctor aCase(sal_False);
::comphelper::UStringMixEqual aCase(sal_False);
// search for typeinfo where the typename is equal _sTypeName
OTypeInfoMap::const_iterator aFind = ::std::find_if(_rTypeInfo.begin(),
_rTypeInfo.end(),
......
......@@ -871,7 +871,6 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
}
const ::comphelper::UStringMixEqual aCaseCompare( bCase );
const ::comphelper::TStringMixEqualFunctor aCaseCompareFunctor( bCase );
typedef ::std::set< size_t > SizeTSet;
SizeTSet aUsedSelectColumns;
::connectivity::parse::OParseColumn::StringMap aColumnNames;
......@@ -947,12 +946,12 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
if ( sColumnName.isEmpty() )
xProp->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName));
aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompare,sColumnName));
sal_Int32 j = 0;
while ( aFindName != aNames.end() )
{
sColumnName += OUString::number(++j);
aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName));
aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompare,sColumnName));
}
pColumn->setName(sColumnName);
......
......@@ -193,7 +193,7 @@ namespace
struct OViewSetter : public ::std::unary_function< OTableTreeListBox::TNames::value_type, bool>
{
const Sequence< OUString> m_aViews;
::comphelper::TStringMixEqualFunctor m_aEqualFunctor;
::comphelper::UStringMixEqual m_aEqualFunctor;
OViewSetter(const Sequence< OUString>& _rViews,sal_Bool _bCase) : m_aViews(_rViews),m_aEqualFunctor(_bCase){}
OTableTreeListBox::TNames::value_type operator() (const OUString& lhs)
......
......@@ -189,7 +189,7 @@ void TableListFacade::updateTableObjectList( bool _bAllowViews )
const OUString* pViewBegin = sViews.getConstArray();
const OUString* pViewEnd = pViewBegin + sViews.getLength();
::comphelper::TStringMixEqualFunctor aEqualFunctor;
::comphelper::UStringMixEqual aEqualFunctor;
for(;pViewBegin != pViewEnd;++pViewBegin)
aTables.erase(::std::remove_if(aTables.begin(),aTables.end(),::std::bind2nd(aEqualFunctor,*pViewBegin)),aTables.end());
OUString* pTables = aTables.empty() ? 0 : &aTables[0];
......
......@@ -57,7 +57,7 @@ namespace dbaui
const OUString& _sColumnName,
const OUString& _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::TStringMixEqualFunctor& _aCase);
const ::comphelper::UStringMixEqual& _aCase);
void moveColumn( ListBox* _pRight,
ListBox* _pLeft,
......@@ -65,14 +65,14 @@ namespace dbaui
const OUString& _sColumnName,
const OUString& _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::TStringMixEqualFunctor& _aCase);
const ::comphelper::UStringMixEqual& _aCase);
void enableButtons();
sal_uInt16 adjustColumnPosition(ListBox* _pLeft,
const OUString& _sColumnName,
ODatabaseExport::TColumnVector::size_type nCurrentPos,
const ::comphelper::TStringMixEqualFunctor& _aCase);
const ::comphelper::UStringMixEqual& _aCase);
public:
virtual void Reset ( );
......
......@@ -73,11 +73,11 @@ namespace dbaui
class TMultiListBoxEntryFindFunctor : public TColumnFindFunctor
{
::comphelper::TStringMixEqualFunctor m_aCase;
::comphelper::UStringMixEqual m_aCase;
::std::vector< OUString>* m_pVector;
public:
TMultiListBoxEntryFindFunctor(::std::vector< OUString>* _pVector,
const ::comphelper::TStringMixEqualFunctor& _aCase)
const ::comphelper::UStringMixEqual& _aCase)
:m_aCase(_aCase)
,m_pVector(_pVector)
{
......
......@@ -407,7 +407,7 @@ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
}
else
{
::comphelper::TStringMixEqualFunctor aCase(sal_False);
::comphelper::UStringMixEqual aCase(sal_False);
// search for typeinfo where the typename is equal _sTypeName
OTypeInfoMap::const_iterator typeInfoLoop = _rTypeInfo.begin();
OTypeInfoMap::const_iterator typeInfoEnd = _rTypeInfo.end();
......
......@@ -198,7 +198,7 @@ IMPL_LINK( OWizColumnSelect, ButtonClickHdl, Button *, pButton )
OUString sExtraChars = xMetaData->getExtraNameCharacters();
sal_Int32 nMaxNameLen = m_pParent->getMaxColumnNameLength();
::comphelper::TStringMixEqualFunctor aCase(xMetaData->supportsMixedCaseQuotedIdentifiers());
::comphelper::UStringMixEqual aCase(xMetaData->supportsMixedCaseQuotedIdentifiers());
::std::vector< OUString> aRightColumns;
fillColumns(pRight,aRightColumns);
......@@ -246,7 +246,7 @@ IMPL_LINK( OWizColumnSelect, ListDoubleClickHdl, MultiListBox *, pListBox )
OUString sExtraChars = xMetaData->getExtraNameCharacters();
sal_Int32 nMaxNameLen = m_pParent->getMaxColumnNameLength();
::comphelper::TStringMixEqualFunctor aCase(xMetaData->supportsMixedCaseQuotedIdentifiers());
::comphelper::UStringMixEqual aCase(xMetaData->supportsMixedCaseQuotedIdentifiers());
::std::vector< OUString> aRightColumns;
fillColumns(pRight,aRightColumns);
......@@ -280,7 +280,7 @@ void OWizColumnSelect::createNewColumn( ListBox* _pListbox,
const OUString& _sColumnName,
const OUString& _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::TStringMixEqualFunctor& _aCase)
const ::comphelper::UStringMixEqual& _aCase)
{
OUString sConvertedName = m_pParent->convertColumnName(TMultiListBoxEntryFindFunctor(&_rRightColumns,_aCase),
_sColumnName,
......@@ -306,7 +306,7 @@ void OWizColumnSelect::moveColumn( ListBox* _pRight,
const OUString& _sColumnName,
const OUString& _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::TStringMixEqualFunctor& _aCase)
const ::comphelper::UStringMixEqual& _aCase)
{
if(_pRight == &m_lbNewColumnNames)
{
......@@ -350,7 +350,7 @@ void OWizColumnSelect::moveColumn( ListBox* _pRight,
sal_uInt16 OWizColumnSelect::adjustColumnPosition( ListBox* _pLeft,
const OUString& _sColumnName,
ODatabaseExport::TColumnVector::size_type nCurrentPos,
const ::comphelper::TStringMixEqualFunctor& _aCase)
const ::comphelper::UStringMixEqual& _aCase)
{
sal_uInt16 nAdjustedPos = 0;
......
......@@ -58,30 +58,15 @@ public:
};
//------------------------------------------------------------------------
class UStringMixEqual
class UStringMixEqual: public std::binary_function<OUString, OUString, bool>
{
sal_Bool m_bCaseSensitive;
public:
UStringMixEqual(sal_Bool bCaseSensitive = sal_True):m_bCaseSensitive(bCaseSensitive){}
sal_Bool operator() (const OUString& lhs, const OUString& rhs) const
{
return m_bCaseSensitive ? lhs.equals( rhs ) : lhs.equalsIgnoreAsciiCase( rhs );
}
sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
};
//------------------------------------------------------------------------
class TStringMixEqualFunctor : public ::std::binary_function< OUString,OUString,bool>
{
sal_Bool m_bCaseSensitive;
public:
TStringMixEqualFunctor(sal_Bool bCaseSensitive = sal_True)
:m_bCaseSensitive(bCaseSensitive)
{}
bool operator() (const OUString& lhs, const OUString& rhs) const
{
return !!(m_bCaseSensitive ? lhs.equals( rhs ) : lhs.equalsIgnoreAsciiCase( rhs ));
return m_bCaseSensitive ? lhs.equals( rhs ) : lhs.equalsIgnoreAsciiCase( rhs );
}
sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
};
......
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