tdf#123936 Formatting files in module svl with clang-format

Change-Id: Iaaac34428ef0e5b8f09f6cbcad16ea5bab145321
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105714
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Philipp Hofer
2020-11-16 11:44:30 +01:00
committed by Samuel Mehrbrodt
parent 69397a13d9
commit 580b4c5f94
13 changed files with 129 additions and 213 deletions
-12
View File
@@ -12419,11 +12419,9 @@ svgio/source/svgreader/svgusenode.cxx
svgio/source/svguno/xsvgparser.cxx
svl/qa/unit/items/test_IndexedStyleSheets.cxx
svl/qa/unit/items/test_itempool.cxx
svl/qa/unit/notify/test_SfxBroadcaster.cxx
svl/qa/unit/svl.cxx
svl/qa/unit/test_INetContentType.cxx
svl/qa/unit/test_URIHelper.cxx
svl/qa/unit/test_lngmisc.cxx
svl/source/config/asiancfg.cxx
svl/source/config/cjkoptions.cxx
svl/source/config/ctloptions.cxx
@@ -12441,7 +12439,6 @@ svl/source/fsstor/ostreamcontainer.cxx
svl/source/fsstor/ostreamcontainer.hxx
svl/source/inc/fsfactory.hxx
svl/source/inc/poolio.hxx
svl/source/inc/stringio.hxx
svl/source/items/IndexedStyleSheets.cxx
svl/source/items/aeitem.cxx
svl/source/items/cenumitm.cxx
@@ -12453,7 +12450,6 @@ svl/source/items/ilstitem.cxx
svl/source/items/imageitm.cxx
svl/source/items/int64item.cxx
svl/source/items/intitem.cxx
svl/source/items/itemiter.cxx
svl/source/items/itempool.cxx
svl/source/items/itemprop.cxx
svl/source/items/itemset.cxx
@@ -12462,14 +12458,12 @@ svl/source/items/legacyitem.cxx
svl/source/items/macitem.cxx
svl/source/items/poolcach.cxx
svl/source/items/poolio.cxx
svl/source/items/poolitem.cxx
svl/source/items/ptitem.cxx
svl/source/items/rectitem.cxx
svl/source/items/rngitem.cxx
svl/source/items/sitem.cxx
svl/source/items/slstitm.cxx
svl/source/items/srchitem.cxx
svl/source/items/stringio.cxx
svl/source/items/stritem.cxx
svl/source/items/style.cxx
svl/source/items/stylepool.cxx
@@ -12480,7 +12474,6 @@ svl/source/misc/adrparse.cxx
svl/source/misc/documentlockfile.cxx
svl/source/misc/filenotation.cxx
svl/source/misc/fstathelper.cxx
svl/source/misc/getstringresource.cxx
svl/source/misc/gridprinter.cxx
svl/source/misc/inethist.cxx
svl/source/misc/inettype.cxx
@@ -12489,13 +12482,9 @@ svl/source/misc/lockfilecommon.cxx
svl/source/misc/ownlist.cxx
svl/source/misc/sharecontrolfile.cxx
svl/source/misc/sharedstring.cxx
svl/source/misc/sharedstringpool.cxx
svl/source/misc/strmadpt.cxx
svl/source/misc/urihelper.cxx
svl/source/notify/SfxBroadcaster.cxx
svl/source/notify/broadcast.cxx
svl/source/notify/hint.cxx
svl/source/notify/isethint.cxx
svl/source/notify/listener.cxx
svl/source/notify/lstner.cxx
svl/source/numbers/currencytable.cxx
@@ -12519,7 +12508,6 @@ svl/source/svdde/ddedata.cxx
svl/source/svdde/ddeimp.hxx
svl/source/svdde/ddestrg.cxx
svl/source/svdde/ddesvr.cxx
svl/source/svsql/converter.cxx
svl/source/undo/undo.cxx
svl/source/uno/pathservice.cxx
svl/unx/source/svdde/ddedummy.cxx
+12 -20
View File
@@ -36,30 +36,26 @@ class SfxBroadcasterTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
};
namespace {
namespace
{
class MockedSfxListener : public SfxListener
{
public:
MockedSfxListener()
: mNotifyWasCalled(false) {}
void Notify(SfxBroadcaster&, const SfxHint&) override {
mNotifyWasCalled = true;
: mNotifyWasCalled(false)
{
}
bool NotifyWasCalled() const {
return mNotifyWasCalled;
}
void Notify(SfxBroadcaster&, const SfxHint&) override { mNotifyWasCalled = true; }
bool NotifyWasCalled() const { return mNotifyWasCalled; }
private:
bool mNotifyWasCalled;
};
}
void
SfxBroadcasterTest::AddingListenersIncreasesCount()
void SfxBroadcasterTest::AddingListenersIncreasesCount()
{
SfxBroadcaster sb;
MockedSfxListener sl;
@@ -70,8 +66,7 @@ SfxBroadcasterTest::AddingListenersIncreasesCount()
CPPUNIT_ASSERT_EQUAL(size_t(1), sb.GetListenerCount());
}
void
SfxBroadcasterTest::RemovingListenersDecreasesCount()
void SfxBroadcasterTest::RemovingListenersDecreasesCount()
{
SfxBroadcaster sb;
MockedSfxListener sl;
@@ -83,8 +78,7 @@ SfxBroadcasterTest::RemovingListenersDecreasesCount()
CPPUNIT_ASSERT_EQUAL(size_t(0), sb.GetListenerCount());
}
void
SfxBroadcasterTest::HintsAreNotForwardedToRemovedListeners()
void SfxBroadcasterTest::HintsAreNotForwardedToRemovedListeners()
{
SfxBroadcaster sb;
MockedSfxListener sl1;
@@ -100,8 +94,7 @@ SfxBroadcasterTest::HintsAreNotForwardedToRemovedListeners()
CPPUNIT_ASSERT_EQUAL(false, sl1.NotifyWasCalled());
}
void
SfxBroadcasterTest::SameListenerCanBeAddedMoreThanOnce()
void SfxBroadcasterTest::SameListenerCanBeAddedMoreThanOnce()
{
MockedSfxListener sl;
SfxBroadcaster sb;
@@ -110,8 +103,7 @@ SfxBroadcasterTest::SameListenerCanBeAddedMoreThanOnce()
CPPUNIT_ASSERT_EQUAL(size_t(2), sb.GetListenerCount());
}
void
SfxBroadcasterTest::StoppingListeningAffectsOnlyFirstOfIdenticalListeners()
void SfxBroadcasterTest::StoppingListeningAffectsOnlyFirstOfIdenticalListeners()
{
MockedSfxListener sl;
SfxBroadcaster sb;
+31 -30
View File
@@ -22,9 +22,9 @@
namespace
{
class LngMiscTest : public CppUnit::TestFixture
{
private:
class LngMiscTest : public CppUnit::TestFixture
{
private:
void testRemoveHyphens();
void testRemoveControlChars();
void testReplaceControlChars();
@@ -38,14 +38,15 @@ namespace
CPPUNIT_TEST(testGetThesaurusReplaceText);
CPPUNIT_TEST_SUITE_END();
};
};
void LngMiscTest::testRemoveHyphens()
{
void LngMiscTest::testRemoveHyphens()
{
OUString str1("");
OUString str2("a-b--c---");
OUString str3 = OUStringChar(SVT_SOFT_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN);
OUString str3 = OUStringChar(SVT_SOFT_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN)
+ OUStringChar(SVT_HARD_HYPHEN);
OUString str4("asdf");
@@ -56,7 +57,7 @@ namespace
// Note that '-' isn't a hyphen to RemoveHyphens.
bModified = linguistic::RemoveHyphens(str2);
CPPUNIT_ASSERT(!bModified);
CPPUNIT_ASSERT_EQUAL( OUString("a-b--c---"), str2 );
CPPUNIT_ASSERT_EQUAL(OUString("a-b--c---"), str2);
bModified = linguistic::RemoveHyphens(str3);
CPPUNIT_ASSERT(bModified);
@@ -64,19 +65,19 @@ namespace
bModified = linguistic::RemoveHyphens(str4);
CPPUNIT_ASSERT(!bModified);
CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str4 );
}
CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str4);
}
void LngMiscTest::testRemoveControlChars()
{
void LngMiscTest::testRemoveControlChars()
{
OUString str1("");
OUString str2("asdf");
OUString str3("asdf\nasdf");
OUStringBuffer str4Buf(33);
str4Buf.setLength(33);
for(int i = 0; i < 33; i++)
str4Buf[i] = static_cast<sal_Unicode>(i);
for (int i = 0; i < 33; i++)
str4Buf[i] = static_cast<sal_Unicode>(i);
// TODO: is this a bug? shouldn't RemoveControlChars remove this?
// str4Buf[33] = static_cast<sal_Unicode>(0x7F);
OUString str4(str4Buf.makeStringAndClear());
@@ -87,27 +88,27 @@ namespace
bModified = linguistic::RemoveControlChars(str2);
CPPUNIT_ASSERT(!bModified);
CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str2 );
CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str2);
bModified = linguistic::RemoveControlChars(str3);
CPPUNIT_ASSERT(bModified);
CPPUNIT_ASSERT_EQUAL( OUString("asdfasdf"), str3 );
CPPUNIT_ASSERT_EQUAL(OUString("asdfasdf"), str3);
bModified = linguistic::RemoveControlChars(str4);
CPPUNIT_ASSERT(bModified);
CPPUNIT_ASSERT_EQUAL( OUString(" "), str4 );
}
CPPUNIT_ASSERT_EQUAL(OUString(" "), str4);
}
void LngMiscTest::testReplaceControlChars()
{
void LngMiscTest::testReplaceControlChars()
{
OUString str1("");
OUString str2("asdf");
OUString str3("asdf\nasdf");
OUStringBuffer str4Buf(33);
str4Buf.setLength(33);
for(int i = 0; i < 33; i++)
str4Buf[i] = static_cast<sal_Unicode>(i);
for (int i = 0; i < 33; i++)
str4Buf[i] = static_cast<sal_Unicode>(i);
// TODO: is this a bug? shouldn't RemoveControlChars remove this?
// str4Buf[33] = static_cast<sal_Unicode>(0x7F);
OUString str4(str4Buf.makeStringAndClear());
@@ -118,21 +119,21 @@ namespace
bModified = linguistic::ReplaceControlChars(str2);
CPPUNIT_ASSERT(!bModified);
CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str2 );
CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str2);
bModified = linguistic::ReplaceControlChars(str3);
CPPUNIT_ASSERT(bModified);
CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), str3 );
CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), str3);
bModified = linguistic::ReplaceControlChars(str4);
CPPUNIT_ASSERT(bModified);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(32), str4.getLength());
for(int i = 0; i < 32; i++)
for (int i = 0; i < 32; i++)
CPPUNIT_ASSERT_EQUAL(u' ', str4[i]);
}
}
void LngMiscTest::testGetThesaurusReplaceText()
{
void LngMiscTest::testGetThesaurusReplaceText()
{
const OUString str2("asdf");
OUString r = linguistic::GetThesaurusReplaceText("");
@@ -158,9 +159,9 @@ namespace
r = linguistic::GetThesaurusReplaceText(" * (abc) asdf *");
CPPUNIT_ASSERT(r.isEmpty());
}
}
CPPUNIT_TEST_SUITE_REGISTRATION(LngMiscTest);
CPPUNIT_TEST_SUITE_REGISTRATION(LngMiscTest);
}
CPPUNIT_PLUGIN_IMPLEMENT();
+2 -3
View File
@@ -31,7 +31,7 @@ class SvStream;
@return On success, returns the reconstructed Unicode string.
*/
OUString readByteString(SvStream & rStream);
OUString readByteString(SvStream& rStream);
/** Write a byte string representation of a Unicode string into a stream.
@@ -40,8 +40,7 @@ OUString readByteString(SvStream & rStream);
@param rString Some Unicode string.
*/
void writeByteString(SvStream & rStream, const OUString& rString);
void writeByteString(SvStream& rStream, const OUString& rString);
#endif // INCLUDED_SVL_SOURCE_INC_STRINGIO_HXX
+9 -11
View File
@@ -17,12 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svl/itemiter.hxx>
#include <svl/itemset.hxx>
SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet )
: m_rSet( rItemSet )
SfxItemIter::SfxItemIter(const SfxItemSet& rItemSet)
: m_rSet(rItemSet)
{
if (!m_rSet.m_nCount)
{
@@ -34,10 +33,10 @@ SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet )
SfxPoolItem const** ppFnd = m_rSet.m_pItems.get();
// Find the first Item that is set
for (m_nStart = 0; !*(ppFnd + m_nStart ); ++m_nStart)
for (m_nStart = 0; !*(ppFnd + m_nStart); ++m_nStart)
; // empty loop
if (1 < m_rSet.Count())
for (m_nEnd = m_rSet.TotalCount(); !*(ppFnd + --m_nEnd); )
for (m_nEnd = m_rSet.TotalCount(); !*(ppFnd + --m_nEnd);)
; // empty loop
else
m_nEnd = m_nStart;
@@ -46,18 +45,17 @@ SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet )
m_nCurrent = m_nStart;
}
SfxItemIter::~SfxItemIter()
{
}
SfxItemIter::~SfxItemIter() {}
// Precondition : m_nCurrent < m_nEnd
const SfxPoolItem* SfxItemIter::ImplNextItem()
{
SfxPoolItem const** ppFnd = m_rSet.m_pItems.get();
do {
do
{
m_nCurrent++;
} while (m_nCurrent < m_nEnd && !*(ppFnd + m_nCurrent ));
return *(ppFnd+m_nCurrent);
} while (m_nCurrent < m_nEnd && !*(ppFnd + m_nCurrent));
return *(ppFnd + m_nCurrent);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+33 -63
View File
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svl/poolitem.hxx>
#include <unotools/intlwrapper.hxx>
#include <unotools/syslocale.hxx>
@@ -476,22 +475,18 @@ SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich)
assert(nWhich <= SHRT_MAX);
}
SfxPoolItem::~SfxPoolItem()
{
assert((m_nRefCount == 0 || m_nRefCount > SFX_ITEMS_MAXREF)
&& "destroying item in use");
assert((m_nRefCount == 0 || m_nRefCount > SFX_ITEMS_MAXREF) && "destroying item in use");
}
bool SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
bool SfxPoolItem::operator==(const SfxPoolItem& rCmp) const
{
assert(typeid(rCmp) == typeid(*this) && "comparing different pool item subclasses");
(void)rCmp;
return true;
}
/**
* This virtual method allows to get a textual representation of the value
* for the SfxPoolItem subclasses. It should be overridden by all UI-relevant
@@ -528,14 +523,12 @@ bool SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
* pSvxBorderItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... )
* "1cm top border, 2cm left border, 0.2cm bottom border, ..."
*/
bool SfxPoolItem::GetPresentation
(
SfxItemPresentation /*ePresentation*/, // IN: how we should format
MapUnit /*eCoreMetric*/, // IN: current metric of the SfxPoolItems
MapUnit /*ePresentationMetric*/, // IN: target metric of the presentation
OUString& /*rText*/, // OUT: textual representation
const IntlWrapper&
) const
bool SfxPoolItem::GetPresentation(
SfxItemPresentation /*ePresentation*/, // IN: how we should format
MapUnit /*eCoreMetric*/, // IN: current metric of the SfxPoolItems
MapUnit /*ePresentationMetric*/, // IN: target metric of the presentation
OUString& /*rText*/, // OUT: textual representation
const IntlWrapper&) const
{
return false;
}
@@ -543,13 +536,15 @@ bool SfxPoolItem::GetPresentation
void SfxPoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SfxPoolItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"),
BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("typeName"), BAD_CAST(typeid(*this).name()));
OUString rText;
IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
if (GetPresentation( SfxItemPresentation::Complete, MapUnit::Map100thMM, MapUnit::Map100thMM, rText, aIntlWrapper))
xmlTextWriterWriteAttribute(
pWriter, BAD_CAST("presentation"), BAD_CAST(rText.toUtf8().getStr()));
if (GetPresentation(SfxItemPresentation::Complete, MapUnit::Map100thMM, MapUnit::Map100thMM,
rText, aIntlWrapper))
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"),
BAD_CAST(rText.toUtf8().getStr()));
xmlTextWriterEndElement(pWriter);
}
@@ -559,44 +554,32 @@ boost::property_tree::ptree SfxPoolItem::dumpAsJSON() const
return aTree;
}
std::unique_ptr<SfxPoolItem> SfxPoolItem::CloneSetWhich( sal_uInt16 nNewWhich ) const
std::unique_ptr<SfxPoolItem> SfxPoolItem::CloneSetWhich(sal_uInt16 nNewWhich) const
{
std::unique_ptr<SfxPoolItem> pItem(Clone());
pItem->SetWhich(nNewWhich);
return pItem;
}
bool SfxPoolItem::IsVoidItem() const
{
return false;
}
bool SfxPoolItem::IsVoidItem() const { return false; }
SfxPoolItem* SfxVoidItem::CreateDefault()
{
return new SfxVoidItem(0);
}
SfxPoolItem* SfxVoidItem::CreateDefault() { return new SfxVoidItem(0); }
SfxVoidItem::SfxVoidItem( sal_uInt16 which ):
SfxPoolItem(which)
SfxVoidItem::SfxVoidItem(sal_uInt16 which)
: SfxPoolItem(which)
{
}
bool SfxVoidItem::operator==( const SfxPoolItem& rCmp ) const
bool SfxVoidItem::operator==(const SfxPoolItem& rCmp) const
{
assert(SfxPoolItem::operator==(rCmp));
(void) rCmp;
(void)rCmp;
return true;
}
bool SfxVoidItem::GetPresentation
(
SfxItemPresentation /*ePresentation*/,
MapUnit /*eCoreMetric*/,
MapUnit /*ePresentationMetric*/,
OUString& rText,
const IntlWrapper&
) const
bool SfxVoidItem::GetPresentation(SfxItemPresentation /*ePresentation*/, MapUnit /*eCoreMetric*/,
MapUnit /*ePresentationMetric*/, OUString& rText,
const IntlWrapper&) const
{
rText = "Void";
return true;
@@ -605,44 +588,31 @@ bool SfxVoidItem::GetPresentation
void SfxVoidItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SfxVoidItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"),
BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterEndElement(pWriter);
}
SfxVoidItem* SfxVoidItem::Clone(SfxItemPool *) const
{
return new SfxVoidItem(*this);
}
SfxVoidItem* SfxVoidItem::Clone(SfxItemPool*) const { return new SfxVoidItem(*this); }
bool SfxVoidItem::IsVoidItem() const
{
return true;
}
bool SfxVoidItem::IsVoidItem() const { return true; }
void SfxPoolItem::ScaleMetrics( tools::Long /*lMult*/, tools::Long /*lDiv*/ )
{
}
void SfxPoolItem::ScaleMetrics(tools::Long /*lMult*/, tools::Long /*lDiv*/) {}
bool SfxPoolItem::HasMetrics() const
{
return false;
}
bool SfxPoolItem::HasMetrics() const { return false; }
bool SfxPoolItem::QueryValue( css::uno::Any&, sal_uInt8 ) const
bool SfxPoolItem::QueryValue(css::uno::Any&, sal_uInt8) const
{
OSL_FAIL("There is no implementation for QueryValue for this item!");
return false;
}
bool SfxPoolItem::PutValue( const css::uno::Any&, sal_uInt8 )
bool SfxPoolItem::PutValue(const css::uno::Any&, sal_uInt8)
{
OSL_FAIL("There is no implementation for PutValue for this item!");
return false;
}
SfxVoidItem::~SfxVoidItem()
{
}
SfxVoidItem::~SfxVoidItem() {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+1 -2
View File
@@ -21,13 +21,12 @@
#include <tools/stream.hxx>
OUString readByteString(SvStream& rStream)
{
return rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
}
void writeByteString(SvStream & rStream, const OUString& rString)
void writeByteString(SvStream& rStream, const OUString& rString)
{
rStream.WriteUniOrByteString(rString, rStream.GetStreamCharSet());
}
+1 -4
View File
@@ -23,9 +23,6 @@
#include <svl/svlresid.hxx>
#include <unotools/resmgr.hxx>
OUString SvlResId(const char* id)
{
return Translate::get(id, Translate::Create("svl"));
}
OUString SvlResId(const char* id) { return Translate::get(id, Translate::Create("svl")); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+16 -18
View File
@@ -15,15 +15,11 @@
#include <unordered_map>
#include <unordered_set>
namespace svl {
namespace {
sal_Int32 getRefCount( const rtl_uString* p )
namespace svl
{
return (p->refCount & 0x3FFFFFFF);
}
namespace
{
sal_Int32 getRefCount(const rtl_uString* p) { return (p->refCount & 0x3FFFFFFF); }
}
struct SharedStringPool::Impl
@@ -32,24 +28,27 @@ struct SharedStringPool::Impl
// We use this map for two purposes - to store lower->upper case mappings
// and to retrieve a shared uppercase object, so the management logic
// is quite complex.
std::unordered_map<OUString,OUString> maStrMap;
std::unordered_map<OUString, OUString> maStrMap;
const CharClass& mrCharClass;
explicit Impl( const CharClass& rCharClass ) : mrCharClass(rCharClass) {}
explicit Impl(const CharClass& rCharClass)
: mrCharClass(rCharClass)
{
}
};
SharedStringPool::SharedStringPool( const CharClass& rCharClass ) :
mpImpl(new Impl(rCharClass)) {}
SharedStringPool::~SharedStringPool()
SharedStringPool::SharedStringPool(const CharClass& rCharClass)
: mpImpl(new Impl(rCharClass))
{
}
SharedString SharedStringPool::intern( const OUString& rStr )
SharedStringPool::~SharedStringPool() {}
SharedString SharedStringPool::intern(const OUString& rStr)
{
osl::MutexGuard aGuard(&mpImpl->maMutex);
auto [mapIt,bInserted] = mpImpl->maStrMap.emplace(rStr, rStr);
auto[mapIt, bInserted] = mpImpl->maStrMap.emplace(rStr, rStr);
if (!bInserted)
// there is already a mapping
return SharedString(mapIt->first.pData, mapIt->second.pData);
@@ -141,11 +140,10 @@ size_t SharedStringPool::getCountIgnoreCase() const
osl::MutexGuard aGuard(&mpImpl->maMutex);
// this is only called from unit tests, so no need to be efficient
std::unordered_set<OUString> aUpperSet;
for (auto const & pair : mpImpl->maStrMap)
for (auto const& pair : mpImpl->maStrMap)
aUpperSet.insert(pair.second);
return aUpperSet.size();
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+18 -33
View File
@@ -27,17 +27,16 @@
#include <cassert>
#include <vector>
// broadcast immediately
void SfxBroadcaster::Broadcast( const SfxHint &rHint )
void SfxBroadcaster::Broadcast(const SfxHint& rHint)
{
// notify all registered listeners exactly once
for (size_t i = 0; i < m_Listeners.size(); ++i)
{
SfxListener *const pListener = m_Listeners[i];
SfxListener* const pListener = m_Listeners[i];
if (pListener)
pListener->Notify( *this, rHint );
pListener->Notify(*this, rHint);
}
}
@@ -45,34 +44,32 @@ void SfxBroadcaster::Broadcast( const SfxHint &rHint )
SfxBroadcaster::~SfxBroadcaster() COVERITY_NOEXCEPT_FALSE
{
Broadcast( SfxHint(SfxHintId::Dying) );
Broadcast(SfxHint(SfxHintId::Dying));
// remove all still registered listeners
for (size_t i = 0; i < m_Listeners.size(); ++i)
{
SfxListener *const pListener = m_Listeners[i];
SfxListener* const pListener = m_Listeners[i];
if (pListener)
pListener->RemoveBroadcaster_Impl(*this);
}
}
// copy ctor of class SfxBroadcaster
SfxBroadcaster::SfxBroadcaster( const SfxBroadcaster &rOther )
SfxBroadcaster::SfxBroadcaster(const SfxBroadcaster& rOther)
{
for (size_t i = 0; i < rOther.m_Listeners.size(); ++i)
{
SfxListener *const pListener = rOther.m_Listeners[i];
SfxListener* const pListener = rOther.m_Listeners[i];
if (pListener)
pListener->StartListening( *this );
pListener->StartListening(*this);
}
}
// add a new SfxListener to the list
void SfxBroadcaster::AddListener( SfxListener& rListener )
void SfxBroadcaster::AddListener(SfxListener& rListener)
{
DBG_TESTSOLARMUTEX();
if (m_RemovedPositions.empty())
@@ -88,23 +85,21 @@ void SfxBroadcaster::AddListener( SfxListener& rListener )
}
}
// forward a notification to all registered listeners
void SfxBroadcaster::Forward(SfxBroadcaster& rBC, const SfxHint& rHint)
{
for (size_t i = 0; i < m_Listeners.size(); ++i)
{
SfxListener *const pListener = m_Listeners[i];
SfxListener* const pListener = m_Listeners[i];
if (pListener)
pListener->Notify( rBC, rHint );
pListener->Notify(rBC, rHint);
}
}
// remove one SfxListener from the list
void SfxBroadcaster::RemoveListener( SfxListener& rListener )
void SfxBroadcaster::RemoveListener(SfxListener& rListener)
{
DBG_TESTSOLARMUTEX();
@@ -114,13 +109,13 @@ void SfxBroadcaster::RemoveListener( SfxListener& rListener )
if (!m_RemovedPositions.empty())
{
auto i = m_RemovedPositions.back();
if (i < m_Listeners.size() - 2 && m_Listeners[i+1] == &rListener)
if (i < m_Listeners.size() - 2 && m_Listeners[i + 1] == &rListener)
{
positionOfRemovedElement = i + 1;
}
else if (i > 0 && m_Listeners[i-1] == &rListener)
else if (i > 0 && m_Listeners[i - 1] == &rListener)
{
positionOfRemovedElement = i-1;
positionOfRemovedElement = i - 1;
}
}
// then scan the whole list if we didn't find it
@@ -135,10 +130,7 @@ void SfxBroadcaster::RemoveListener( SfxListener& rListener )
m_RemovedPositions.push_back(positionOfRemovedElement);
}
bool SfxBroadcaster::HasListeners() const
{
return (GetListenerCount() != 0);
}
bool SfxBroadcaster::HasListeners() const { return (GetListenerCount() != 0); }
size_t SfxBroadcaster::GetListenerCount() const
{
@@ -146,15 +138,8 @@ size_t SfxBroadcaster::GetListenerCount() const
return m_Listeners.size() - m_RemovedPositions.size();
}
size_t SfxBroadcaster::GetSizeOfVector() const
{
return m_Listeners.size();
}
SfxListener* SfxBroadcaster::GetListener( size_t nNo ) const
{
return m_Listeners[nNo];
}
size_t SfxBroadcaster::GetSizeOfVector() const { return m_Listeners.size(); }
SfxListener* SfxBroadcaster::GetListener(size_t nNo) const { return m_Listeners[nNo]; }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+1 -6
View File
@@ -17,15 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svl/hint.hxx>
// virtual dtor for the typical base-class Hint
SfxHint::~SfxHint() COVERITY_NOEXCEPT_FALSE
{
}
SfxHint::~SfxHint() COVERITY_NOEXCEPT_FALSE {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+3 -8
View File
@@ -17,22 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svl/isethint.hxx>
#include <svl/itemset.hxx>
/**
* Copies the SfxItemSet passed as a parameter.
*/
SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet )
: _pItemSet( rItemSet.Clone() )
{
}
SfxItemSetHint::~SfxItemSetHint()
SfxItemSetHint::SfxItemSetHint(const SfxItemSet& rItemSet)
: _pItemSet(rItemSet.Clone())
{
}
SfxItemSetHint::~SfxItemSetHint() {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+2 -3
View File
@@ -21,12 +21,11 @@
sal_Int32 SvDbaseConverter::ConvertPrecisionToDbase(sal_Int32 _nLen, sal_Int32 _nScale)
{
return _nScale ? _nLen +2 : _nLen +1;
return _nScale ? _nLen + 2 : _nLen + 1;
}
sal_Int32 SvDbaseConverter::ConvertPrecisionToOdbc(sal_Int32 _nLen, sal_Int32 _nScale)
{
return _nScale ? _nLen -2 : _nLen -1;
return _nScale ? _nLen - 2 : _nLen - 1;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */