blob: 0f3f0bd26b6d6a56a2bce5d6e087c435dff55ce9 [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 Glushenkovb5ccfbf2008-05-30 06:10:19 +000028 /// Args_ - Command arguments. Stdout redirection ("> file") is allowed.
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000029 std::vector<std::string> Args_;
30 public:
Mikhail Glushenkovb5ccfbf2008-05-30 06:10:19 +000031 Action() {}
Mikhail Glushenkovbe9d9a12008-05-06 18:08:59 +000032 Action (const std::string& C,
33 const StringVector& A)
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000034 : Command_(C), Args_(A)
35 {}
36
Mikhail Glushenkov4561ab52008-05-07 21:50:19 +000037 /// Execute - Executes the represented action.
Mikhail Glushenkovaa4948f2008-05-06 16:34:39 +000038 int Execute() const;
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +000039 };
40
41}
42
43#endif // LLVM_TOOLS_LLVMC2_ACTION_H