loplugin:unuseddefaultparam in ucb

Change-Id: Ie0ea0b4dc13271a2bde5e3843bb3f8042ab880b4
This commit is contained in:
Noel Grandin
2016-02-26 14:48:09 +02:00
parent 1110346b3b
commit 83911dd753
5 changed files with 18 additions and 37 deletions

View File

@@ -378,10 +378,9 @@ public:
RegexpMap & operator =(RegexpMap const & rOther); RegexpMap & operator =(RegexpMap const & rOther);
void add(OUString const & rKey, Val const & rValue, bool bOverwrite, void add(OUString const & rKey, Val const & rValue, bool bOverwrite);
OUString * pReverse = nullptr);
iterator find(OUString const & rKey, OUString * pReverse = nullptr); iterator find(OUString const & rKey);
void erase(iterator const & rPos); void erase(iterator const & rPos);
@@ -396,7 +395,7 @@ public:
size_type size() const; size_type size() const;
Val const * map(OUString const & rString, Val const * map(OUString const & rString,
OUString * pTranslation = nullptr, bool * pTranslated = nullptr) OUString * pTranslation = nullptr)
const; const;
private: private:
@@ -428,7 +427,7 @@ RegexpMap< Val > & RegexpMap< Val >::operator =(RegexpMap const & rOther)
template< typename Val > template< typename Val >
void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue, void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue,
bool bOverwrite, rtl::OUString * pReverse) bool bOverwrite)
{ {
Regexp aRegexp(Regexp::parse(rKey)); Regexp aRegexp(Regexp::parse(rKey));
@@ -463,20 +462,13 @@ void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue,
rTheList.push_back(Entry< Val >(aRegexp, rValue)); rTheList.push_back(Entry< Val >(aRegexp, rValue));
} }
if (pReverse)
*pReverse = aRegexp.getRegexp(true);
} }
template< typename Val > template< typename Val >
typename RegexpMap< Val >::iterator RegexpMap< Val >::find(rtl::OUString const & rKey, typename RegexpMap< Val >::iterator RegexpMap< Val >::find(rtl::OUString const & rKey)
rtl::OUString * pReverse)
{ {
Regexp aRegexp(Regexp::parse(rKey)); Regexp aRegexp(Regexp::parse(rKey));
if (pReverse)
*pReverse = aRegexp.getRegexp(true);
if (aRegexp.isDefault()) if (aRegexp.isDefault())
{ {
if (m_pImpl->m_pDefault) if (m_pImpl->m_pDefault)
@@ -554,8 +546,7 @@ typename RegexpMap< Val >::size_type RegexpMap< Val >::size() const
template< typename Val > template< typename Val >
Val const * RegexpMap< Val >::map(rtl::OUString const & rString, Val const * RegexpMap< Val >::map(rtl::OUString const & rString,
rtl::OUString * pTranslation, rtl::OUString * pTranslation) const
bool * pTranslated) const
{ {
for (int n = Regexp::KIND_DOMAIN; n >= Regexp::KIND_PREFIX; --n) for (int n = Regexp::KIND_DOMAIN; n >= Regexp::KIND_PREFIX; --n)
{ {
@@ -564,12 +555,12 @@ Val const * RegexpMap< Val >::map(rtl::OUString const & rString,
typename List< Val >::const_iterator aEnd(rTheList.end()); typename List< Val >::const_iterator aEnd(rTheList.end());
for (typename List< Val >::const_iterator aIt(rTheList.begin()); aIt != aEnd; for (typename List< Val >::const_iterator aIt(rTheList.begin()); aIt != aEnd;
++aIt) ++aIt)
if (aIt->m_aRegexp.matches(rString, pTranslation, pTranslated)) if (aIt->m_aRegexp.matches(rString, pTranslation, nullptr))
return &aIt->m_aValue; return &aIt->m_aValue;
} }
if (m_pImpl->m_pDefault if (m_pImpl->m_pDefault
&& m_pImpl->m_pDefault->m_aRegexp.matches(rString, pTranslation, && m_pImpl->m_pDefault->m_aRegexp.matches(rString, pTranslation,
pTranslated)) nullptr))
return &m_pImpl->m_pDefault->m_aValue; return &m_pImpl->m_pDefault->m_aValue;
return 0; return 0;
} }

View File

@@ -214,8 +214,7 @@ const PropertyValue * ContentProperties::get(
// static // static
void ContentProperties::UCBNamesToDAVNames( void ContentProperties::UCBNamesToDAVNames(
const uno::Sequence< beans::Property > & rProps, const uno::Sequence< beans::Property > & rProps,
std::vector< OUString > & propertyNames, std::vector< OUString > & propertyNames )
bool bIncludeUnmatched /* = true */ )
{ {
// Assemble list of DAV properties to obtain from server. // Assemble list of DAV properties to obtain from server.
@@ -291,8 +290,7 @@ void ContentProperties::UCBNamesToDAVNames(
} }
else else
{ {
if ( bIncludeUnmatched ) propertyNames.push_back( rProp.Name );
propertyNames.push_back( rProp.Name );
} }
} }
} }
@@ -301,8 +299,7 @@ void ContentProperties::UCBNamesToDAVNames(
// static // static
void ContentProperties::UCBNamesToHTTPNames( void ContentProperties::UCBNamesToHTTPNames(
const uno::Sequence< beans::Property > & rProps, const uno::Sequence< beans::Property > & rProps,
std::vector< OUString > & propertyNames, std::vector< OUString > & propertyNames )
bool bIncludeUnmatched /* = true */ )
{ {
// Assemble list of HTTP header names to obtain from server. // Assemble list of HTTP header names to obtain from server.
@@ -336,8 +333,7 @@ void ContentProperties::UCBNamesToHTTPNames(
} }
else else
{ {
if ( bIncludeUnmatched ) propertyNames.push_back( rProp.Name );
propertyNames.push_back( rProp.Name );
} }
} }
} }

View File

@@ -99,25 +99,23 @@ public:
// Maps the UCB property names contained in rProps with their DAV property // Maps the UCB property names contained in rProps with their DAV property
// counterparts, if possible. All unmappable properties will be included // counterparts, if possible. All unmappable properties will be included
// unchanged in resulting vector unless bIncludeUnmatched is set to false. // unchanged in resulting vector.
// The vector filles by this method can directly be handed over to // The vector filles by this method can directly be handed over to
// DAVResourceAccess::PROPFIND. The result from PROPFIND // DAVResourceAccess::PROPFIND. The result from PROPFIND
// (vector< DAVResource >) can be used to create a ContentProperties // (vector< DAVResource >) can be used to create a ContentProperties
// instance which can map DAV properties back to UCB properties. // instance which can map DAV properties back to UCB properties.
static void UCBNamesToDAVNames( const css::uno::Sequence< css::beans::Property > & rProps, static void UCBNamesToDAVNames( const css::uno::Sequence< css::beans::Property > & rProps,
std::vector< OUString > & resources, std::vector< OUString > & resources );
bool bIncludeUnmatched = true );
// Maps the UCB property names contained in rProps with their HTTP header // Maps the UCB property names contained in rProps with their HTTP header
// counterparts, if possible. All unmappable properties will be included // counterparts, if possible. All unmappable properties will be included
// unchanged in resulting vector unless bIncludeUnmatched is set to false. // unchanged in resulting vector.
// The vector filles by this method can directly be handed over to // The vector filles by this method can directly be handed over to
// DAVResourceAccess::HEAD. The result from HEAD (vector< DAVResource >) // DAVResourceAccess::HEAD. The result from HEAD (vector< DAVResource >)
// can be used to create a ContentProperties instance which can map header // can be used to create a ContentProperties instance which can map header
// names back to UCB properties. // names back to UCB properties.
static void UCBNamesToHTTPNames( const css::uno::Sequence< css::beans::Property > & rProps, static void UCBNamesToHTTPNames( const css::uno::Sequence< css::beans::Property > & rProps,
std::vector< OUString > & resources, std::vector< OUString > & resources );
bool bIncludeUnmatched = true );
// return true, if all properties contained in rProps are contained in // return true, if all properties contained in rProps are contained in
// this ContentProperties instance. Otherwiese, false will be returned. // this ContentProperties instance. Otherwiese, false will be returned.

View File

@@ -61,7 +61,7 @@ using namespace webdav_ucp;
bool ContentProvider::getProperty( bool ContentProvider::getProperty(
const OUString & rPropName, beans::Property & rProp, bool bStrict ) const OUString & rPropName, beans::Property & rProp )
{ {
if ( !m_pProps ) if ( !m_pProps )
{ {
@@ -269,9 +269,6 @@ bool ContentProvider::getProperty(
} }
else else
{ {
if ( bStrict )
return false;
// All unknown props are treated as: // All unknown props are treated as:
rProp = beans::Property( rProp = beans::Property(
rPropName, rPropName,

View File

@@ -118,8 +118,7 @@ public:
// Non-interface methods. // Non-interface methods.
bool getProperty( const OUString & rPropName, bool getProperty( const OUString & rPropName,
css::beans::Property & rProp, css::beans::Property & rProp );
bool bStrict = false );
}; };
} }