summaryrefslogtreecommitdiffstats
path: root/src/net/sf/antcontrib/cpptasks/ide/DebugDef.java
blob: 8ddd04e949837239ae47b5ba68e80fdab7e2b4c9 (plain)
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
/*
*
* Copyright 2004-2005 The Ant-Contrib project
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package net.sf.antcontrib.cpptasks.ide;

import java.io.File;

import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.types.DataType;


/**
*  Specifies a debugging configuration for a project.
*
* @author Curt Arnold
*/
public final class DebugDef
   extends DataType {

    /**
     * Working directory for debug runs.
     */
    private File dir;
    /**
     * Name of executable.
     */
    private String executable;
    /**
     * Environment used to hold environment variables.
     */
    private Environment env = new Environment();
    /**
     * Command line used to hold command line arguments.
     */
    private Commandline cmdl = new Commandline();

    /**
     * Constructor.
     *
     */
     public DebugDef() {
     }


     /**
      * Set the name of the executable program.
      * @param value the name of the executable program
      */
     public void setExecutable(final String value) {
         this.executable = value;
     }

     /**
      * Get the name of the executable program.
      * @return the name of the executable program, may be null.
      */
     public String getExecutable() {
         return executable;
     }

     /**
      * Set the working directory of the process.
      * @param d the working directory of the process
      */
     public void setDir(final File d) {
        this.dir = d;
     }

     /**
      * Get the working directory of the process.
      * @return the working directory of the process, may be null.
      */
     public File getDir() {
        return dir;
     }

     /**
      * Add an environment variable.
      *
      * @param var new environment variable
      */
     public void addEnv(final Environment.Variable var) {
        env.addVariable(var);
     }

     /**
      * Get the variable list as an array.
      * @return array of key=value assignment strings
      */
     public String[] getVariables() {
        return env.getVariables();
     }


     /**
      * Adds a command-line argument.
      *
      * @return new command line argument created
      */
     public Commandline.Argument createArg() {
         return cmdl.createArgument();
     }

     /**
      * Returns all arguments defined by <code>addLine</code>,
      * <code>addValue</code> or the argument object.
      * @return array of command line arguments, may be zero-length.
      */
     public String[] getArguments() {
        return cmdl.getArguments();
     }

}