Menu

[r13158]: / trunk / src / sdk / compileroptions.cpp  Maximize  Restore  History

Download this file

133 lines (116 with data), 3.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*
* $Revision$
* $Id$
* $HeadURL$
*/
#include "sdk_precomp.h"
#include "compileroptions.h"
CompilerOptions::CompilerOptions()
{
}
CompilerOptions::CompilerOptions(const CompilerOptions& other)
{
// copy ctor
*this = other;
}
CompilerOptions& CompilerOptions::operator=(const CompilerOptions& other)
{
ClearOptions();
for (unsigned int i = 0; i < other.m_Options.GetCount(); ++i)
{
CompOption* coption = new CompOption(*(other.m_Options[i]));
AddOption(coption);
}
return *this;
}
CompilerOptions::~CompilerOptions()
{
ClearOptions();
}
void CompilerOptions::ClearOptions()
{
for (unsigned int i = 0; i < m_Options.GetCount(); ++i)
{
CompOption* coption = m_Options.Item(i);
delete coption;
}
m_Options.Clear();
}
void CompilerOptions::AddOption(CompOption* coption, int index)
{
if (index == -1)
m_Options.Add(coption);
else
m_Options.Insert(coption, index);
}
void CompilerOptions::AddOption(const wxString& name,
const wxString& option,
const wxString& category,
const wxString& additionalLibs,
const wxString& checkAgainst,
const wxString& checkMessage,
const wxString& supersedes,
bool exclusive,
int index)
{
if (name.IsEmpty() || (option.IsEmpty() && additionalLibs.IsEmpty()))
return;
CompOption* coption = new CompOption;
wxString listboxname = name + _T(" [");
if (option.IsEmpty())
listboxname += additionalLibs;
else
listboxname += option;
listboxname += _T("]");
coption->name = listboxname;
coption->option = option;
coption->additionalLibs = additionalLibs;
coption->enabled = false;
coption->category = category;
coption->checkAgainst = checkAgainst;
coption->checkMessage = checkMessage;
coption->supersedes = supersedes;
coption->exclusive = exclusive;
AddOption(coption, index);
}
void CompilerOptions::RemoveOption(int index)
{
CompOption* coption = m_Options.Item(index);
delete coption;
m_Options.RemoveAt(index);
}
CompOption* CompilerOptions::GetOptionByName(const wxString& name)
{
for (unsigned int i = 0; i < m_Options.GetCount(); ++i)
{
CompOption* coption = m_Options.Item(i);
if (coption->name == name)
return coption;
}
return nullptr;
}
CompOption* CompilerOptions::GetOptionByOption(const wxString& option)
{
if (option.IsEmpty()) return nullptr;
for (unsigned int i = 0; i < m_Options.GetCount(); ++i)
{
CompOption* coption = m_Options.Item(i);
if (coption->option == option)
return coption;
}
return nullptr;
}
CompOption* CompilerOptions::GetOptionByAdditionalLibs(const wxString& libs)
{
if (libs.IsEmpty()) return nullptr;
for (unsigned int i = 0; i < m_Options.GetCount(); ++i)
{
CompOption* coption = m_Options.Item(i);
if (coption->additionalLibs == libs)
return coption;
}
return nullptr;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.