~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/compilergcc/compiler_defs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: 4909 $
 
6
 * $Id: compiler_defs.cpp 4909 2008-02-27 13:15:26Z mortenmacfly $
 
7
 * $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/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
 
 
18
CompilerQueue::CompilerQueue()
 
19
    : m_LastWasRun(false)
 
20
{
 
21
}
 
22
 
 
23
CompilerQueue::~CompilerQueue()
 
24
{
 
25
    Clear();
 
26
}
 
27
 
 
28
void CompilerQueue::Clear()
 
29
{
 
30
    m_Commands.DeleteContents(true);
 
31
    m_Commands.Clear();
 
32
    m_Commands.DeleteContents(false);
 
33
}
 
34
 
 
35
size_t CompilerQueue::GetCount() const
 
36
{
 
37
    return m_Commands.GetCount();
 
38
}
 
39
 
 
40
bool CompilerQueue::LastCommandWasRun() const
 
41
{
 
42
    return m_LastWasRun;
 
43
}
 
44
 
 
45
void CompilerQueue::Add(CompilerCommand* cmd)
 
46
{
 
47
    if (cmd)
 
48
    {
 
49
        if (cmd->dir.IsEmpty() && cmd->project)
 
50
            cmd->dir = cmd->project->GetBasePath();
 
51
        m_Commands.Append(cmd);
 
52
    }
 
53
}
 
54
 
 
55
void CompilerQueue::Add(CompilerQueue* queue)
 
56
{
 
57
    wxCompilerCommandsNode* node = queue->m_Commands.GetFirst();
 
58
    while (node)
 
59
    {
 
60
        if (node->GetData())
 
61
            Add(new CompilerCommand(*(node->GetData())));
 
62
        node = node->GetNext();
 
63
    }
 
64
}
 
65
 
 
66
CompilerCommand* CompilerQueue::Peek()
 
67
{
 
68
    wxCompilerCommandsNode* node = m_Commands.GetFirst();
 
69
    if (!node)
 
70
        return 0;
 
71
    return node->GetData();
 
72
}
 
73
 
 
74
CompilerCommand* CompilerQueue::Next()
 
75
{
 
76
    wxCompilerCommandsNode* node = m_Commands.GetFirst();
 
77
    if (!node)
 
78
        return 0;
 
79
    CompilerCommand* cmd = node->GetData();
 
80
    m_Commands.Erase(node);
 
81
    m_LastWasRun = cmd ? cmd->isRun : false;
 
82
    return cmd;
 
83
}