blob: 32d185545a6e83c2eabf8091726f6bfc1edb6e45 [file] [log] [blame]
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +00001//===--- Tools.h - The LLVM Compiler Driver ---------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open
6// Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Action - encapsulates a single shell command.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TOOLS_LLVMC2_ACTION_H
15#define LLVM_TOOLS_LLVMC2_ACTION_H
16
17#include <string>
18#include <vector>
19
Mikhail Glushenkovbe9d9a12008-05-06 18:08:59 +000020namespace llvmc {
21
22 typedef std::vector<std::string> StringVector;
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000023
Mikhail Glushenkov4561ab52008-05-07 21:50:19 +000024 /// Action - A class that encapsulates a single shell command.
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000025 class Action {
Mikhail Glushenkov4561ab52008-05-07 21:50:19 +000026 /// Command_ - The actual command (for example, 'ls').
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000027 std::string Command_;
Mikhail Glushenkov4561ab52008-05-07 21:50:19 +000028 /// Args_ - Command arguments. Stdout redirection is allowed.
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000029 std::vector<std::string> Args_;
30 public:
Mikhail Glushenkovbe9d9a12008-05-06 18:08:59 +000031 Action (const std::string& C,
32 const StringVector& A)
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000033 : Command_(C), Args_(A)
34 {}
35
Mikhail Glushenkov4561ab52008-05-07 21:50:19 +000036 /// Execute - Executes the represented action.
Mikhail Glushenkovaa4948f2008-05-06 16:34:39 +000037 int Execute() const;
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000038 };
39
40}
41
42#endif // LLVM_TOOLS_LLVMC2_ACTION_H