blob: c3b31d4e5589903588623eb4e80a07a0e52251e2 [file] [log] [blame]
Mikhail Glushenkovaa3bb172008-05-30 06:17:29 +00001//===--- Action.h - The LLVM Compiler Driver --------------------*- C++ -*-===//
Mikhail Glushenkovb90cd832008-05-06 16:34:12 +00002//
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
Mikhail Glushenkovaa3bb172008-05-30 06:17:29 +000022 typedef std::vector<std::string> StrVector;
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 Glushenkovaa3bb172008-05-30 06:17:29 +000032 Action (const std::string& C, const StrVector& 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