Code::Blocks  SVN r11506
compiler_defs.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  *
5  * $Revision: 11435 $
6  * $Id: compiler_defs.cpp 11435 2018-08-07 07:13:14Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/compilergcc/compiler_defs.cpp $
8  */
9 
10 #include <sdk.h>
11 #include "compiler_defs.h"
12 #include <cbproject.h>
13 #include <projectbuildtarget.h>
14 
15 #include <wx/listimpl.cpp>
16 WX_DEFINE_LIST(CompilerCommands);
17 
19  : m_LastWasRun(false)
20 {
21 }
22 
24 {
25  Clear();
26 }
27 
29 {
30  m_Commands.DeleteContents(true);
31  m_Commands.Clear();
32  m_Commands.DeleteContents(false);
33 }
34 
36 {
37  return m_Commands.GetCount();
38 }
39 
41 {
42  return m_LastWasRun;
43 }
44 
46 {
47  if (cmd)
48  {
49  if (cmd->dir.IsEmpty() && cmd->project)
50  cmd->dir = cmd->project->GetExecutionDir();
51  m_Commands.Append(cmd);
52  }
53 }
54 
56 {
57  for (CompilerCommands::iterator it = queue->m_Commands.begin(); it != queue->m_Commands.end(); ++it)
58  {
59  if (*it)
60  Add(new CompilerCommand(**it));
61  }
62 }
63 
65 {
66  if (m_Commands.empty())
67  return nullptr;
68  else
69  return m_Commands.front();
70 }
71 
73 {
74  if (m_Commands.empty())
75  return nullptr;
76  CompilerCommand* cmd = m_Commands.front();
77  m_Commands.pop_front();
78  m_LastWasRun = cmd ? cmd->isRun : false;
79  return cmd;
80 }
cbProject * project
Definition: compiler_defs.h:26
void Clear()
Clear the queue.
wxString GetExecutionDir()
Definition: cbproject.cpp:1023
CompilerCommands m_Commands
Definition: compiler_defs.h:59
void Add(CompilerCommand *cmd)
Queue a command.
bool isRun
if it&#39;s a command to run the target.
Definition: compiler_defs.h:28
bool LastCommandWasRun() const
bool IsEmpty() const
CompilerCommand * Peek()
WX_DEFINE_LIST(CompilerCommands)
size_t GetCount() const
Get the commands count.
CompilerCommand * Next()
Get the next command in queue.