summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-02 16:15:51 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-02-08 06:08:14 +0000
commitb14224fe97b8a44232c9c1401d3a49771f46582e (patch)
tree8f9cf31cf4b51a0edbb43022499a6acd17d0945d /editeng
parentc474e610e453d0f38f7cc6cb9559ad7e7b5d69ca (diff)
loplugin:unusedmethods
using an idea from dtardon: <dtardon> noelgrandin, hi. could you try to run the unusedmethods clang plugin with "make build-nocheck"? that would catch functions that are only used in tests. e.g., i just removed the whole o3tl::range class, which has not been used in many years, but htere was a test for it... <noelgrandin> dtardon, interesting idea! Sure, I can do that. Change-Id: I5653953a426a2186a1e43017212d87ffce520387 Reviewed-on: https://gerrit.libreoffice.org/22041 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/qa/lookuptree/lookuptree_test.cxx17
-rw-r--r--editeng/source/lookuptree/Trie.cxx11
2 files changed, 10 insertions, 18 deletions
diff --git a/editeng/qa/lookuptree/lookuptree_test.cxx b/editeng/qa/lookuptree/lookuptree_test.cxx
index 91228fdfd9f3..fcdf93ac5d68 100644
--- a/editeng/qa/lookuptree/lookuptree_test.cxx
+++ b/editeng/qa/lookuptree/lookuptree_test.cxx
@@ -125,27 +125,18 @@ void LookupTreeTest::testTrieGetAllEntries()
{
editeng::Trie trie;
- std::vector<OUString> entries;
-
- trie.getAllEntries(entries);
- CPPUNIT_ASSERT_EQUAL( (size_t) 0, entries.size() );
+ CPPUNIT_ASSERT_EQUAL( (size_t) 0, trie.size() );
trie.insert("A");
- trie.getAllEntries(entries);
- CPPUNIT_ASSERT_EQUAL( (size_t) 1, entries.size() );
- entries.clear();
+ CPPUNIT_ASSERT_EQUAL( (size_t) 1, trie.size() );
trie.insert("B");
trie.insert("C");
- trie.getAllEntries(entries);
- CPPUNIT_ASSERT_EQUAL( (size_t) 3, entries.size() );
- entries.clear();
+ CPPUNIT_ASSERT_EQUAL( (size_t) 3, trie.size() );
trie.insert("AA");
trie.insert("AAA");
- trie.getAllEntries(entries);
- CPPUNIT_ASSERT_EQUAL( (size_t) 5, entries.size() );
- entries.clear();
+ CPPUNIT_ASSERT_EQUAL( (size_t) 5, trie.size() );
}
} // namespace end
diff --git a/editeng/source/lookuptree/Trie.cxx b/editeng/source/lookuptree/Trie.cxx
index 1a6dbd16401a..234a8f5e344f 100644
--- a/editeng/source/lookuptree/Trie.cxx
+++ b/editeng/source/lookuptree/Trie.cxx
@@ -196,12 +196,13 @@ void Trie::findSuggestions(const OUString& sWordPart, vector<OUString>& rSuggest
}
}
-void Trie::getAllEntries(std::vector<OUString>& entries)
+size_t Trie::size() const
{
- if (mRoot)
- {
- mRoot->collectSuggestions(OUString(), entries);
- }
+ if (!mRoot)
+ return 0;
+ std::vector<OUString> entries;
+ mRoot->collectSuggestions(OUString(), entries);
+ return entries.size();
}
}