Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] Code removal of unused code #3537

Merged
merged 19 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions CodeLite/Console/clConsoleBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,8 @@ wxString clConsoleBase::GetSelectedTerminalName()
return terminalName;
}

clConsoleEnvironment::clConsoleEnvironment() {}

clConsoleEnvironment::~clConsoleEnvironment() { UnApply(); }

void clConsoleEnvironment::Add(const wxString& name, const wxString& value)
{
m_environment.erase(name);
m_environment.insert({ name, value });
}

void clConsoleEnvironment::Apply()
{
if(!m_oldEnvironment.empty()) {
Expand Down
2 changes: 0 additions & 2 deletions CodeLite/Console/clConsoleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ class WXDLLIMPEXP_CL clConsoleEnvironment

public:
clConsoleEnvironment(const wxStringMap_t& env);
clConsoleEnvironment();
~clConsoleEnvironment();

void Add(const wxString& name, const wxString& value);
void Apply();
void UnApply();
};
Expand Down
40 changes: 0 additions & 40 deletions CodeLite/compiler_command_line_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,6 @@ CompilerCommandLineParser::~CompilerCommandLineParser()
m_argc = 0;
}

wxString CompilerCommandLineParser::GetCompileLine() const
{
wxString s;
for(size_t i = 0; i < m_includes.GetCount(); i++) {
s << "-I" << m_includes.Item(i) << " ";
}

for(size_t i = 0; i < m_macros.GetCount(); i++) {
s << "-D" << m_macros.Item(i) << " ";
}

for(size_t i = 0; i < m_sysroots.size(); ++i) {
s << "-isysroot " << m_sysroots.Item(i) << " ";
}
s.Trim().Trim(false);
return s;
}

wxString CompilerCommandLineParser::GetStandardWithPrefix() const
{
if(m_standard.IsEmpty()) {
Expand All @@ -201,28 +183,6 @@ wxString CompilerCommandLineParser::GetStandardWithPrefix() const
return "-std=" + m_standard;
}

void CompilerCommandLineParser::MakeAbsolute(const wxString& path)
{
wxArrayString incls;
incls.reserve(m_includes.size());

for(size_t i = 0; i < m_includes.GetCount(); ++i) {
wxFileName fn(m_includes.Item(i), "");
fn.MakeAbsolute(path);
incls.Add(fn.GetPath());
}
m_includes.swap(incls);

m_includesWithPrefix.Clear();
for(size_t i = 0; i < m_framworks.GetCount(); ++i) {
m_includesWithPrefix.Add("-F" + m_framworks.Item(i));
}

for(size_t i = 0; i < m_includes.GetCount(); ++i) {
m_includesWithPrefix.Add("-I" + m_includes.Item(i));
}
}

void CompilerCommandLineParser::AddIncludesFromFile(const wxFileName& includeFile)
{
wxFFile fp(includeFile.GetFullPath(), "rb");
Expand Down
2 changes: 0 additions & 2 deletions CodeLite/compiler_command_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class WXDLLIMPEXP_CL CompilerCommandLineParser
CompilerCommandLineParser(const wxString& cmdline, const wxString& workingDirectory = wxEmptyString);
virtual ~CompilerCommandLineParser();

wxString GetCompileLine() const;
void MakeAbsolute(const wxString& path);
const wxString& GetStandard() const { return m_standard; }

wxString GetStandardWithPrefix() const;
Expand Down
7 changes: 0 additions & 7 deletions CodeLite/event_notifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ void EventNotifier::PostReloadExternallyModifiedEvent(bool prompt)
AddPendingEvent(event);
}

void EventNotifier::PostFileRemovedEvent(const wxArrayString& files)
{
clCommandEvent filesRemovedEvent(wxEVT_PROJ_FILE_REMOVED);
filesRemovedEvent.SetStrings(files);
AddPendingEvent(filesRemovedEvent);
}

void EventNotifier::NotifyWorkspaceReloadEndEvent(const wxString& workspaceFile)
{
clWorkspaceEvent event(wxEVT_WORKSPACE_RELOAD_ENDED);
Expand Down
5 changes: 0 additions & 5 deletions CodeLite/event_notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ class WXDLLIMPEXP_CL EventNotifier : public wxEvtHandler
*/
void PostReloadExternallyModifiedEvent(bool prompt = true);

/**
* @brief post a wxEVT_PROJ_FILE_REMOVED event
*/
void PostFileRemovedEvent(const wxArrayString& files);

/**
* @brief send a wxEVT_WORKSPACE_RELOAD_STARTED event (sync event)
*/
Expand Down
94 changes: 0 additions & 94 deletions CodeLite/fileutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,28 +504,6 @@ size_t FileUtils::GetFileSize(const wxFileName& filename)
}
}

wxString FileUtils::EscapeString(const wxString& str)
{
wxString modstr = str;
modstr.Replace(" ", "\\ ");
modstr.Replace("\"", "\\\"");
return modstr;
}

wxString FileUtils::GetOSXTerminalCommand(const wxString& command, const wxString& workingDirectory)
{
wxFileName script(clStandardPaths::Get().GetBinFolder(), "osx-terminal.sh");

wxString cmd;
cmd << EscapeString(script.GetFullPath()) << " \"";
if (!workingDirectory.IsEmpty()) {
cmd << "cd " << EscapeString(workingDirectory) << " && ";
}
cmd << EscapeString(command) << "\"";
clDEBUG() << "GetOSXTerminalCommand returned:" << cmd << clEndl;
return cmd;
}

wxString FileUtils::NormaliseName(const wxString& name)
{
static bool initialised = false;
Expand Down Expand Up @@ -583,17 +561,6 @@ bool FileUtils::NextWord(const wxString& str, size_t& offset, wxString& word, bo
return false;
}

size_t FileUtils::SplitWords(const wxString& str, wxStringSet_t& outputSet, bool makeLower)
{
size_t offset = 0;
wxString word;
outputSet.clear();
while (NextWord(str, offset, word, makeLower)) {
outputSet.insert(word);
}
return outputSet.size();
}

bool FileUtils::RemoveFile(const wxString& filename, const wxString& context)
{
LOG_IF_TRACE { clDEBUG1() << "Deleting file:" << filename << "(" << context << ")"; }
Expand Down Expand Up @@ -650,30 +617,6 @@ wxString FileUtils::RealPath(const wxString& filepath)
return filepath;
}

void FileUtils::OpenBuiltInTerminal(const wxString& wd, const wxString& user_command, bool pause_when_exit)
{
wxString title(user_command);

wxFileName fnCodeliteTerminal(clStandardPaths::Get().GetExecutablePath());
fnCodeliteTerminal.SetFullName("codelite-terminal");

wxString newCommand;
newCommand << fnCodeliteTerminal.GetFullPath() << " --exit ";
if (pause_when_exit) {
newCommand << " --wait ";
}
if (wxDirExists(wd)) {
wxString workingDirectory = wd;
workingDirectory.Trim().Trim(false);
if (workingDirectory.Contains(" ") && !workingDirectory.StartsWith("\"")) {
workingDirectory.Prepend("\"").Append("\"");
}
newCommand << " --working-directory " << wd;
}
newCommand << " --cmd " << title;
::wxExecute(newCommand, wxEXEC_ASYNC);
}

std::string FileUtils::ToStdString(const wxString& str) { return StringUtils::ToStdString(str); }

bool FileUtils::ReadBufferFromFile(const wxFileName& fn, wxString& data, size_t bufferSize)
Expand Down Expand Up @@ -851,43 +794,6 @@ size_t FileUtils::FindSimilar(const wxFileName& filename, const std::vector<wxSt
return vout.size();
}

bool FileUtils::ParseURI(const wxString& uri, wxString& path, wxString& scheme, wxString& user, wxString& host,
wxString& port)
{
if (uri.StartsWith("file://")) {
path = uri.Mid(7);
scheme = "file://";
return true;
} else if (uri.StartsWith("ssh://")) {
// expected syntax:
// ssh://user@host:port:/path
scheme = "ssh://";
wxString remainder = uri.Mid(6);
user = remainder.BeforeFirst('@');
remainder = remainder.AfterFirst('@');
host = remainder.BeforeFirst(':');
remainder = remainder.AfterFirst(':');

// at this point we got:
// port:/path
// OR -
// /path
if (remainder.empty()) {
return true;
}

if (remainder[0] == '/') {
path = remainder;
} else {
port = remainder.BeforeFirst(':');
path = remainder.AfterFirst(':');
}
return true;
} else {
return false;
}
}

wxString FileUtils::FilePathToURI(const wxString& filepath)
{
if (filepath.StartsWith("file://")) {
Expand Down
21 changes: 0 additions & 21 deletions CodeLite/fileutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ class WXDLLIMPEXP_CL FileUtils
static void OSXOpenDebuggerTerminalAndGetTTY(const wxString& path, const wxString& appname, wxString& tty,
long& pid);

/**
* @brief return the command needed to open OSX terminal at a given directory and launch a command
*/
static wxString GetOSXTerminalCommand(const wxString& command, const wxString& workingDirectory);

/**
* @brief file masking search
*/
Expand Down Expand Up @@ -159,11 +154,6 @@ class WXDLLIMPEXP_CL FileUtils
*/
static bool NextWord(const wxString& str, size_t& offset, wxString& word, bool makeLower = false);

/**
* @brief split a string by whitespace
*/
static size_t SplitWords(const wxString& str, wxStringSet_t& outputSet, bool makeLower = false);

/**
* @brief decode URI using percent encoding
*/
Expand All @@ -174,11 +164,6 @@ class WXDLLIMPEXP_CL FileUtils
*/
static wxString EncodeURI(const wxString& uri);

/**
* @brief escape string. Each space and double quotes marker is escaped with backslash
*/
static wxString EscapeString(const wxString& str);

/**
* @brief is the file or folder a hidden file?
*/
Expand Down Expand Up @@ -305,12 +290,6 @@ class WXDLLIMPEXP_CL FileUtils
static size_t FindSimilar(const wxFileName& filename, const std::vector<wxString>& extensions,
std::vector<wxFileName>& vout);

/**
* @brief given URI, parse it into its basic parts
*/
static bool ParseURI(const wxString& uri, wxString& path, wxString& scheme, wxString& user, wxString& host,
wxString& port);

/**
* @brief convert path to uri
* /home/eran/file.cpp -> file:///home/eran/file.cpp
Expand Down
35 changes: 0 additions & 35 deletions CodeLite/language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,6 @@ wxArrayString Language::DoExtractTemplateDeclarationArgs(TagEntryPtr tag)
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

void TemplateHelper::SetTemplateDeclaration(const wxString& templateDeclaration)
{
LanguageST::Get()->ParseTemplateArgs(templateDeclaration, this->templateDeclaration);
}

void TemplateHelper::SetTemplateInstantiation(const wxString& templateInstantiation)
{
this->templateInstantiationVector.clear();
Expand All @@ -363,36 +358,6 @@ void TemplateHelper::SetTemplateInstantiation(const wxString& templateInstantiat
this->templateInstantiationVector.push_back(l);
}

void TemplateHelper::SetTemplateInstantiation(const wxArrayString& templInstantiation)
{
// incase we are using template argument as template instantiation,
// we should perform the replacement or else we will lose
// the actual template instantiation list
// an example for such cases:
// template <class _Tp> class vector {
// typedef Something<_Tp> reference;
// reference get();
// };
// Now, by attempting to resolve this:
// vector<wxString> v;
// v.get()->
// we should replace Something<_Tp> into Something<wxString> *before* we continue with
// the resolving

wxArrayString newInstantiationList = templInstantiation;
// search for 'name' in the declaration list
for(size_t i = 0; i < newInstantiationList.GetCount(); i++) {
int where = this->templateDeclaration.Index(newInstantiationList.Item(i));
if(where != wxNOT_FOUND) {
wxString name = Substitute(newInstantiationList.Item(i));
if(!name.IsEmpty())
newInstantiationList[i] = name;
}
}

templateInstantiationVector.push_back(newInstantiationList);
}

wxString TemplateHelper::Substitute(const wxString& name)
{
// for(size_t i=0; i<templateInstantiationVector.size(); i++) {
Expand Down
2 changes: 0 additions & 2 deletions CodeLite/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ class TemplateHelper
TemplateHelper() {}
~TemplateHelper() {}

void SetTemplateDeclaration(const wxString& templateDeclaration);
void SetTemplateInstantiation(const wxString& templateInstantiation);

void SetTemplateDeclaration(const wxArrayString& templateDeclaration)
{
this->templateDeclaration = templateDeclaration;
}
void SetTemplateInstantiation(const wxArrayString& templateInstantiation);

const wxArrayString& GetTemplateDeclaration() const { return templateDeclaration; }
bool IsTemplate() const { return templateDeclaration.IsEmpty() == false; }
Expand Down
Loading
Loading