summaryrefslogtreecommitdiff
path: root/services/job.h
diff options
context:
space:
mode:
authorJeongho Hwang <jbera.hwang@samsung.com>2012-09-19 13:40:18 +0900
committerJeongho Hwang <jbera.hwang@samsung.com>2012-09-19 13:40:18 +0900
commitd208c9cb79b228fd48d9f7adef432486389e1abe (patch)
tree1f8533ae700c789c992dcebb88c558a963e59efc /services/job.h
parent8701a5293e4e52a995b1ee0b683f234848d8d745 (diff)
downloadicecream-2.0alpha.tar.gz
icecream-2.0alpha.tar.bz2
icecream-2.0alpha.zip
Signed-off-by: Jeongho Hwang <jbera.hwang@samsung.com>
Diffstat (limited to 'services/job.h')
-rw-r--r--services/job.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/services/job.h b/services/job.h
new file mode 100644
index 0000000..efdf894
--- /dev/null
+++ b/services/job.h
@@ -0,0 +1,120 @@
+/*
+ This file is part of Icecream.
+
+ Copyright (c) 2004 Stephan Kulow <coolo@suse.de>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _COMPILE_JOB_H
+#define _COMPILE_JOB_H
+
+#include <list>
+#include <string>
+
+typedef enum { Arg_Unspecified, Arg_Local, Arg_Remote, Arg_Rest } Argument_Type;
+class ArgumentsList : public std::list< std::pair<std::string, Argument_Type> >
+{
+public:
+ void append( std::string s, Argument_Type t ) {
+ push_back( make_pair( s, t ) );
+ }
+};
+
+class CompileJob {
+
+public:
+ typedef enum {Lang_C, Lang_CXX, Lang_OBJC, Lang_Custom} Language;
+ typedef enum { Flag_None = 0, Flag_g = 0x1, Flag_g3 = 0x2, Flag_O = 0x4, Flag_O2 = 0x8, Flag_Ol2 = 0x10 } Flag;
+
+ CompileJob() : m_id( 0 ) { __setTargetPlatform(); }
+
+ void setCompilerName(const std::string& name) { m_compiler_name = name; }
+ std::string compilerName() const { return m_compiler_name; }
+
+ void setLanguage( Language lg ) { m_language = lg; }
+ Language language() const { return m_language; }
+
+ void setEnvironmentVersion( const std::string& ver ) {
+ m_environment_version = ver;
+ }
+
+ std::string environmentVersion() const {
+ return m_environment_version;
+ }
+
+ unsigned int argumentFlags() const;
+
+ void setFlags( const ArgumentsList &flags ) {
+ m_flags = flags;
+ }
+ std::list<std::string> localFlags() const;
+ std::list<std::string> remoteFlags() const;
+ std::list<std::string> restFlags() const;
+ std::list<std::string> allFlags() const;
+
+ void setInputFile( const std::string &file ) {
+ m_input_file = file;
+ }
+
+ std::string inputFile() const {
+ return m_input_file;
+ }
+
+ void setOutputFile( const std::string &file ) {
+ m_output_file = file;
+ }
+
+ std::string outputFile() const {
+ return m_output_file;
+ }
+
+ void setJobID( unsigned int id ) {
+ m_id = id;
+ }
+ unsigned int jobID() const {
+ return m_id;
+ }
+
+ void appendFlag( std::string arg, Argument_Type argumentType ) {
+ m_flags.append( arg, argumentType );
+ }
+
+ std::string targetPlatform() const { return m_target_platform; }
+ void setTargetPlatform( const std::string &_target ) {
+ m_target_platform = _target;
+ }
+
+private:
+ std::list<std::string> flags( Argument_Type argumentType ) const;
+ void __setTargetPlatform();
+
+ unsigned int m_id;
+ Language m_language;
+ std::string m_compiler_name;
+ std::string m_environment_version;
+ ArgumentsList m_flags;
+ std::string m_input_file, m_output_file;
+ std::string m_target_platform;
+};
+
+inline void appendList( std::list<std::string> &list,
+ const std::list<std::string> &toadd )
+{
+ // Cannot splice since toadd is a reference-to-const
+ list.insert( list.end(), toadd.begin(), toadd.end() );
+}
+
+#endif