Skip to content

Commit d7f8c4b

Browse files
authored
[Cleanup] Remove some default parameter (#3584)
* [cleanup] Remove default parameter of `FunctionFromFileLine` * [cleanup] Remove default parameter of `DirTraverser` * [cleanup] Remove default parameter of `TagsManager::GetClasses` * [cleanup] Remove default parameter of `GetTagsByScopeAndKind` and remove extra overload * [cleanup] Remove default parameter of `TagsByScope` * [cleanup] Remove default parameter of `CxxVariable::ToString` * [cleanup] Remove default parameter `forceDelay` of `clEditor::SetEnsureCaretIsVisible`
1 parent 86c7c77 commit d7f8c4b

File tree

12 files changed

+28
-86
lines changed

12 files changed

+28
-86
lines changed

CodeLite/Cxx/CxxCodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ std::vector<TagEntryPtr> CxxCodeCompletion::get_children_of_scope(TagEntryPtr pa
10031003
scope = tag->GetScope();
10041004
}
10051005
std::vector<TagEntryPtr> parent_tags;
1006-
m_lookup->GetTagsByScopeAndKind(scope, to_wx_array_string(kinds), filter, parent_tags, true);
1006+
m_lookup->GetTagsByScopeAndKind(scope, to_wx_array_string(kinds), filter, parent_tags);
10071007
tags.reserve(tags.size() + parent_tags.size());
10081008
tags.insert(tags.end(), parent_tags.begin(), parent_tags.end());
10091009
}

CodeLite/Cxx/CxxVariable.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ wxString CxxVariable::GetTypeAsCxxString(const wxStringTable_t& table) const
2828
return PackType(m_type, m_standard, true, table);
2929
}
3030

31-
wxString CxxVariable::ToString(size_t flags, const wxStringTable_t& table) const
31+
wxString CxxVariable::ToString(size_t flags) const
3232
{
33-
wxUnusedVar(table);
34-
3533
wxString str;
3634
str << GetTypeAsString({});
3735

CodeLite/Cxx/CxxVariable.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class WXDLLIMPEXP_CL CxxVariable
5151
// Include the default value
5252
kToString_DefaultValue = (1 << 1),
5353
kToString_Default = kToString_Name,
54-
// Revert back type->macro (e.g. wxWindowMSW -> wxWindow)
55-
kToString_ReverseMacros = (1 << 2),
5654
};
5755

5856
protected:
@@ -114,11 +112,8 @@ class WXDLLIMPEXP_CL CxxVariable
114112
/**
115113
* @brief return a string representation for this variable
116114
* @param flags see values in eFlags
117-
* @param table macros table - reversed. i.e. the actual type is the key and the value is the macro name
118-
* this table is used when the flag kToString_ReverseMacros is passed
119115
*/
120-
wxString ToString(size_t flags = CxxVariable::kToString_Default,
121-
const wxStringTable_t& table = wxStringTable_t()) const;
116+
wxString ToString(size_t flags = CxxVariable::kToString_Default) const;
122117

123118
void SetDefaultValue(const wxString& defaultValue) { this->m_defaultValue = defaultValue; }
124119
const wxString& GetDefaultValue() const { return m_defaultValue; }

CodeLite/ctags_manager.cpp

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ void TagsManager::GetFiles(const wxString& partialName, std::vector<wxFileName>&
367367
}
368368
}
369369

370-
TagEntryPtr TagsManager::FunctionFromFileLine(const wxFileName& fileName, int lineno, bool nextFunction /*false*/)
370+
TagEntryPtr TagsManager::FunctionFromFileLine(const wxFileName& fileName, int lineno)
371371
{
372372
if(!GetDatabase()) {
373373
return NULL;
@@ -377,22 +377,12 @@ TagEntryPtr TagsManager::FunctionFromFileLine(const wxFileName& fileName, int li
377377
CacheFile(fileName.GetFullPath());
378378
}
379379

380-
TagEntryPtr foo = NULL;
381-
for(size_t i = 0; i < m_cachedFileFunctionsTags.size(); i++) {
382-
TagEntryPtr t = m_cachedFileFunctionsTags.at(i);
383-
384-
if(nextFunction && t->GetLine() > lineno) {
385-
// keep the last non matched method
386-
foo = t;
387-
} else if(t->GetLine() <= lineno) {
388-
if(nextFunction) {
389-
return foo;
390-
} else {
391-
return t;
392-
}
380+
for (TagEntryPtr t : m_cachedFileFunctionsTags) {
381+
if (t->GetLine() <= lineno) {
382+
return t;
393383
}
394384
}
395-
return foo;
385+
return nullptr;
396386
}
397387

398388
wxString TagsManager::FormatFunction(TagEntryPtr tag, size_t flags, const wxString& scope)
@@ -497,18 +487,15 @@ Language* TagsManager::GetLanguage()
497487
}
498488
}
499489

500-
void TagsManager::GetClasses(std::vector<TagEntryPtr>& tags, bool onlyWorkspace)
490+
void TagsManager::GetClasses(std::vector<TagEntryPtr>& tags)
501491
{
502492
const wxArrayString kind = StdToWX::ToArrayString({ wxT("class"), wxT("struct"), wxT("union") });
503493

504494
GetDatabase()->GetTagsByKind(kind, wxT("name"), ITagsStorage::OrderAsc, tags);
505495
}
506496

507-
void TagsManager::TagsByScope(const wxString& scopeName, const wxArrayString& kind, std::vector<TagEntryPtr>& tags,
508-
bool include_anon)
497+
void TagsManager::TagsByScope(const wxString& scopeName, const wxArrayString& kind, std::vector<TagEntryPtr>& tags)
509498
{
510-
wxUnusedVar(include_anon);
511-
512499
wxArrayString scopes;
513500
GetScopesByScopeName(scopeName, scopes);
514501
// make enough room for max of 500 elements in the vector
@@ -549,7 +536,7 @@ wxString TagsManager::NormalizeFunctionSig(const wxString& sig, size_t flags,
549536
toStringFlags |= CxxVariable::kToString_DefaultValue;
550537
}
551538

552-
str_output << var->ToString(toStringFlags, {});
539+
str_output << var->ToString(toStringFlags);
553540
// keep the length of this argument
554541
if(paramLen) {
555542
paramLen->push_back({ start_offset, str_output.length() - start_offset });

CodeLite/ctags_manager.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,8 @@ class WXDLLIMPEXP_CL TagsManager : public wxEvtHandler
227227
* @param scopeName the scope to search
228228
* @param kind list of tags kind to return
229229
* @param tags [output] the result vector
230-
* @param inherits set to true if you want inherited members as well members
231-
* @param include_anon included anonymous members (of Unions/structs/enums)
232230
*/
233-
void TagsByScope(const wxString& scopeName, const wxArrayString& kind, std::vector<TagEntryPtr>& tags,
234-
bool include_anon = false);
231+
void TagsByScope(const wxString& scopeName, const wxArrayString& kind, std::vector<TagEntryPtr>& tags);
235232

236233
/**
237234
* @brief get the scope name. CodeLite assumes that the caret is placed at the end of the 'scope'
@@ -261,7 +258,7 @@ class WXDLLIMPEXP_CL TagsManager : public wxEvtHandler
261258
* @param lineno the line number
262259
* @return pointer to the tage which matches the line number & files
263260
*/
264-
TagEntryPtr FunctionFromFileLine(const wxFileName& fileName, int lineno, bool nextFunction = false);
261+
TagEntryPtr FunctionFromFileLine(const wxFileName& fileName, int lineno);
265262

266263
/**
267264
* @brief
@@ -279,11 +276,8 @@ class WXDLLIMPEXP_CL TagsManager : public wxEvtHandler
279276
/**
280277
* @brief return list of all classes.
281278
* @param tags [output] vector of tags for the classes
282-
* @param onlyWorkspace set to true if you wish to accept only classes belongs to the workspace, false if you would
283-
* like to receive
284-
* classes from the external database as well
285279
*/
286-
void GetClasses(std::vector<TagEntryPtr>& tags, bool onlyWorkspace = true);
280+
void GetClasses(std::vector<TagEntryPtr>& tags);
287281

288282
/**
289283
* @brief return list of tags by their partial names

CodeLite/database/istorage.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,14 @@ class ITagsStorage
160160
*/
161161
virtual void GetTagsByFileAndLine(const wxString& file, int line, std::vector<TagEntryPtr>& tags) = 0;
162162

163-
/**
164-
* @brief return list by kind and scope
165-
* @param scope
166-
* @param kinds
167-
* @param tags [output]
168-
*/
169-
virtual void GetTagsByScopeAndKind(const wxString& scope, const wxArrayString& kinds,
170-
std::vector<TagEntryPtr>& tags, bool applyLimit = true) = 0;
171-
172163
/**
173164
* @brief return list by kind and scope while using a filter
174165
* @param scope
175166
* @param kinds
176167
* @param tags [output]
177168
*/
178169
virtual void GetTagsByScopeAndKind(const wxString& scope, const wxArrayString& kinds, const wxString& filter,
179-
std::vector<TagEntryPtr>& tags, bool applyLimit = true) = 0;
170+
std::vector<TagEntryPtr>& tags) = 0;
180171

181172
/**
182173
* @brief get list of tags by kind and file

CodeLite/database/tags_storage_sqlite3.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,6 @@ void TagsStorageSQLite::GetTagsByFileAndLine(const wxString& file, int line, std
690690
DoFetchTags(sql, tags);
691691
}
692692

693-
void TagsStorageSQLite::GetTagsByScopeAndKind(const wxString& scope, const wxArrayString& kinds,
694-
std::vector<TagEntryPtr>& tags, bool applyLimit)
695-
{
696-
GetTagsByScopeAndKind(scope, kinds, wxEmptyString, tags, applyLimit);
697-
}
698-
699693
void TagsStorageSQLite::GetTagsByKindAndFile(const wxArrayString& kind, const wxString& fileName,
700694
const wxString& orderingColumn, int order, std::vector<TagEntryPtr>& tags)
701695
{
@@ -948,7 +942,7 @@ void TagsStorageSQLite::GetTagsByScopeAndName(const wxArrayString& scope, const
948942
}
949943

950944
void TagsStorageSQLite::GetTagsByScopeAndKind(const wxString& scope, const wxArrayString& kinds, const wxString& filter,
951-
std::vector<TagEntryPtr>& tags, bool applyLimit)
945+
std::vector<TagEntryPtr>& tags)
952946
{
953947
if(kinds.empty()) {
954948
return;
@@ -973,9 +967,7 @@ void TagsStorageSQLite::GetTagsByScopeAndKind(const wxString& scope, const wxArr
973967
sql << kinds_buffer;
974968
}
975969

976-
if(applyLimit) {
977-
sql << " LIMIT " << GetSingleSearchLimit();
978-
}
970+
sql << " LIMIT " << GetSingleSearchLimit();
979971
DoFetchTags(sql, tags);
980972
}
981973

CodeLite/database/tags_storage_sqlite3.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,16 +403,13 @@ class WXDLLIMPEXP_CL TagsStorageSQLite : public ITagsStorage
403403
* @brief return list by kind and scope
404404
* @param scope
405405
* @param kinds
406+
* @param filter "starts_with" filter
406407
* @param tags [output]
407408
*/
408-
virtual void GetTagsByScopeAndKind(const wxString& scope, const wxArrayString& kinds,
409-
std::vector<TagEntryPtr>& tags, bool applyLimit = true);
410-
411-
/**
412-
* @brief similar to the above, but with filter ("starts_with")
413-
*/
414-
virtual void GetTagsByScopeAndKind(const wxString& scope, const wxArrayString& kinds, const wxString& filter,
415-
std::vector<TagEntryPtr>& tags, bool applyLimit = true);
409+
virtual void GetTagsByScopeAndKind(const wxString& scope,
410+
const wxArrayString& kinds,
411+
const wxString& filter,
412+
std::vector<TagEntryPtr>& tags);
416413

417414
/**
418415
* @see ITagsStorage::GetTagsByName

CodeLite/dirtraverser.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929
#include <wx/log.h>
3030
#include <wx/tokenzr.h>
3131

32-
DirTraverser::DirTraverser(const wxString &filespec, bool includeExtLessFiles)
32+
DirTraverser::DirTraverser(const wxString &filespec)
3333
: wxDirTraverser()
3434
, m_filespec(filespec)
35-
, m_extlessFiles(includeExtLessFiles)
3635
{
3736
m_specArray = wxStringTokenize(filespec, wxT(";"), wxTOKEN_STRTOK);
3837
}
@@ -41,18 +40,10 @@ wxDirTraverseResult DirTraverser::OnFile(const wxString& filename)
4140
{
4241
// add the file to our array
4342
wxFileName fn(filename);
44-
45-
if(FileUtils::WildMatch(m_filespec, fn)) {
46-
m_files.Add(filename);
47-
return wxDIR_CONTINUE;
48-
}
4943

50-
// if we reached this point, no pattern was suitable for our file
51-
// test for extensionless file flag
52-
if (fn.GetExt().IsEmpty() && m_extlessFiles) {
44+
if (FileUtils::WildMatch(m_filespec, fn)) {
5345
m_files.Add(filename);
5446
}
55-
5647
return wxDIR_CONTINUE;
5748
}
5849

CodeLite/dirtraverser.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,14 @@ class WXDLLIMPEXP_CL DirTraverser : public wxDirTraverser
4747
wxString m_filespec;
4848
wxArrayString m_specArray;
4949

50-
bool m_extlessFiles;
5150
wxArrayString m_excludeDirs;
5251

5352
public:
5453

5554
/**
5655
* Construct a DirTraverser with a given file spec
5756
*/
58-
DirTraverser(const wxString &filespec, bool includExtLessFiles = false);
57+
DirTraverser(const wxString &filespec);
5958
virtual ~DirTraverser();
6059

6160
/**

0 commit comments

Comments
 (0)