Build System

- Added new src/commands and src/columns intermediate libs.
- Began implementation of the first Command object.
- Began implementation of the first Column object.
- TDB2, Variant updates.
This commit is contained in:
Paul Beckingham 2011-04-23 16:41:37 -04:00
parent f1fa315342
commit 0471c17f12
20 changed files with 513 additions and 184 deletions

2
.gitignore vendored
View file

@ -4,6 +4,8 @@ commit.h
Makefile Makefile
*/*task */*task
*/*libtask.a */*libtask.a
*/*/libcommands.a
*/*/libcolumns.a
*~ *~
.*.swp .*.swp
package-config/osx/binary/task package-config/osx/binary/task

View file

@ -21,7 +21,6 @@ if (EXISTS .git/index)
message ("-- Found SHA1 reference: ${COMMIT}") message ("-- Found SHA1 reference: ${COMMIT}")
endif (EXISTS .git/index) endif (EXISTS .git/index)
set (PACKAGE "${PROJECT_NAME}") set (PACKAGE "${PROJECT_NAME}")
set (VERSION "${PROJECT_VERSION}") set (VERSION "${PROJECT_VERSION}")
set (PACKAGE_BUGREPORT "support@taskwarrior.org") set (PACKAGE_BUGREPORT "support@taskwarrior.org")
@ -39,26 +38,15 @@ if (LUA51_FOUND)
set (TASK_LIBRARIES ${TASK_LIBRARIES} ${LUA_LIBRARIES}) set (TASK_LIBRARIES ${TASK_LIBRARIES} ${LUA_LIBRARIES})
endif (LUA51_FOUND) endif (LUA51_FOUND)
message ("-- Looking for pthread") #message ("-- Looking for pthread")
find_path (PTHREAD_INCLUDE_DIR pthread.h) #find_path (PTHREAD_INCLUDE_DIR pthread.h)
find_library (PTHREAD_LIBRARY NAMES pthread) #find_library (PTHREAD_LIBRARY NAMES pthread)
if (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY) #if (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY)
message ("-- Found pthread: ${PTHREAD_LIBRARY}") # message ("-- Found pthread: ${PTHREAD_LIBRARY}")
set (HAVE_LIBPTHREAD true) # set (HAVE_LIBPTHREAD true)
set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR}) # set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR})
set (TASK_LIBRARIES ${TASK_LIBRARIES} ${PTHREAD_LIBRARIES}) # set (TASK_LIBRARIES ${TASK_LIBRARIES} ${PTHREAD_LIBRARIES})
endif (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY) #endif (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY)
#message ("-- Looking for readline")
#find_path (READLINE_INCLUDE_DIR readline/readline.h)
#find_library (READLINE_LIBRARY NAMES readline)
#if (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
# message ("-- Found readline: ${READLINE_LIBRARY}")
# set (HAVE_LIBREADLINE true)
# set (HAVE_READLINE true)
# set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${READLINE_INCLUDE_DIR})
# set (TASK_LIBRARIES ${TASK_LIBRARIES } ${READLINE_LIBRARIES})
#endif (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
check_function_exists (random HAVE_RANDOM) check_function_exists (random HAVE_RANDOM)
check_function_exists (srandom HAVE_SRANDOM) check_function_exists (srandom HAVE_SRANDOM)
@ -80,6 +68,8 @@ configure_file (
${CMAKE_SOURCE_DIR}/cmake.h) ${CMAKE_SOURCE_DIR}/cmake.h)
add_subdirectory (src) add_subdirectory (src)
add_subdirectory (src/commands)
add_subdirectory (src/columns)
add_subdirectory (doc) add_subdirectory (doc)
add_subdirectory (i18n) add_subdirectory (i18n)
add_subdirectory (scripts) add_subdirectory (scripts)

View file

@ -1,3 +1,4 @@
cmake_minimum_required (VERSION 2.8)
message ("-- Configuring man pages") message ("-- Configuring man pages")
set (man_FILES task-color.5 task-faq.5 task-sync.5 task-tutorial.5 task.1 taskrc.5) set (man_FILES task-color.5 task-faq.5 task-sync.5 task-tutorial.5 task.1 taskrc.5)
foreach (man_FILE ${man_FILES}) foreach (man_FILE ${man_FILES})

View file

@ -1,3 +1,4 @@
cmake_minimum_required (VERSION 2.8)
install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${TASK_DOCDIR}/i18n install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${TASK_DOCDIR}/i18n
FILES_MATCHING REGEX "tips.*" FILES_MATCHING REGEX "tips.*"
PATTERN "CMakeFiles" EXCLUDE) PATTERN "CMakeFiles" EXCLUDE)

View file

@ -1 +1,2 @@
cmake_minimum_required (VERSION 2.8)
install (DIRECTORY bash fish vim zsh add-ons extensions DESTINATION ${TASK_DOCDIR}/scripts) install (DIRECTORY bash fish vim zsh add-ons extensions DESTINATION ${TASK_DOCDIR}/scripts)

View file

@ -1,4 +1,7 @@
cmake_minimum_required (VERSION 2.8)
include_directories (${CMAKE_SOURCE_DIR}/src include_directories (${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands
${CMAKE_SOURCE_DIR}/src/columns
${TASK_INCLUDE_DIRS}) ${TASK_INCLUDE_DIRS})
set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h
@ -21,7 +24,7 @@ set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h
add_library (task STATIC ${task_SRCS}) add_library (task STATIC ${task_SRCS})
add_executable (task_executable main.cpp) add_executable (task_executable main.cpp)
target_link_libraries (task_executable task ${TASK_LIBRARIES}) target_link_libraries (task_executable task commands columns ${TASK_LIBRARIES})
set_property (TARGET task_executable PROPERTY OUTPUT_NAME "task") set_property (TARGET task_executable PROPERTY OUTPUT_NAME "task")
install (TARGETS task_executable DESTINATION ${TASK_BINDIR}) install (TARGETS task_executable DESTINATION ${TASK_BINDIR})

View file

@ -27,16 +27,17 @@
#ifndef INCLUDED_CONTEXT #ifndef INCLUDED_CONTEXT
#define INCLUDED_CONTEXT #define INCLUDED_CONTEXT
#include "Filter.h" #include <Command.h>
#include "Config.h" #include <Filter.h>
#include "Sequence.h" #include <Config.h>
#include "Subst.h" #include <Sequence.h>
#include "Cmd.h" #include <Subst.h>
#include "Task.h" #include <Cmd.h>
#include "TDB.h" #include <Task.h>
#include "TDB2.h" #include <TDB.h>
#include "Hooks.h" #include <TDB2.h>
#include "DOM.h" #include <Hooks.h>
#include <DOM.h>
class Context class Context
{ {
@ -82,13 +83,13 @@ public:
Sequence sequence; Sequence sequence;
Subst subst; Subst subst;
Task task; Task task;
TDB tdb; TDB tdb; // TODO Obsolete
TDB2 tdb2; TDB2 tdb2;
std::string program; std::string program;
std::vector <std::string> args; std::vector <std::string> args;
std::string file_override; std::string file_override;
std::string var_overrides; std::string var_overrides;
Cmd cmd; Cmd cmd; // TODO Obsolete
std::map <std::string, std::string> aliases; std::map <std::string, std::string> aliases;
std::vector <std::string> tagAdditions; std::vector <std::string> tagAdditions;
std::vector <std::string> tagRemovals; std::vector <std::string> tagRemovals;
@ -100,6 +101,8 @@ public:
std::vector <std::string> debugMessages; std::vector <std::string> debugMessages;
bool inShadow; bool inShadow;
std::vector <Command*> commands;
int terminal_width; int terminal_width;
int terminal_height; int terminal_height;
}; };

View file

@ -29,20 +29,192 @@
#include <TDB2.h> #include <TDB2.h>
////////////////////////////////////////////////////////////////////////////////
TF2::TF2 ()
: _dirty (false)
, _loaded_tasks (false)
, _loaded_lines (false)
, _loaded_contents (false)
, _contents ("")
{
}
////////////////////////////////////////////////////////////////////////////////
TF2::~TF2 ()
{
}
////////////////////////////////////////////////////////////////////////////////
void TF2::target (const std::string& f)
{
_file = File (f);
}
////////////////////////////////////////////////////////////////////////////////
std::vector <Task>& TF2::get_tasks ()
{
if (! _loaded_tasks)
load_tasks ();
return _tasks /*+ _added_tasks*/;
}
////////////////////////////////////////////////////////////////////////////////
std::vector <std::string>& TF2::get_lines ()
{
if (! _loaded_lines)
load_lines ();
return _lines /*+ _added_lines*/;
}
////////////////////////////////////////////////////////////////////////////////
std::string& TF2::get_contents ()
{
if (! _loaded_contents)
load_contents ();
return _contents;
}
////////////////////////////////////////////////////////////////////////////////
void TF2::add_task (const Task& task)
{
_added_tasks.push_back (task);
_dirty = true;
}
////////////////////////////////////////////////////////////////////////////////
void TF2::modify_task (const Task& task)
{
_modified_tasks.push_back (task);
_dirty = true;
}
////////////////////////////////////////////////////////////////////////////////
void TF2::add_line (const std::string& line)
{
_added_lines.push_back (line);
_dirty = true;
}
////////////////////////////////////////////////////////////////////////////////
// This is so that synch.key can just overwrite and not grow.
void TF2::clear_lines ()
{
_lines.clear ();
_dirty = true;
}
////////////////////////////////////////////////////////////////////////////////
// Top-down recomposition.
void TF2::commit ()
{
// Load the lowest form, to allow
if (_dirty)
{
load_contents ();
if (_modified_tasks.size ())
{
std::map <std::string, Task> modified;
std::vector <Task>::iterator it;
for (it = _modified_tasks.begin (); it != _modified_tasks.end (); ++it)
modified[it->get ("uuid")] = *it;
// for (it = _
_modified_tasks.clear ();
}
if (_added_tasks.size ())
{
std::vector <Task>::iterator it;
for (it = _added_tasks.begin (); it != _added_tasks.end (); ++it)
_lines.push_back (it->composeF4 ());
_added_tasks.clear ();
}
if (_added_lines.size ())
{
//_lines += _added_lines;
_added_lines.clear ();
}
// TODO This clobbers minimal case.
_contents = ""; // TODO Verify no resize.
join (_contents, "\n", _lines);
_file.write (_contents);
_dirty = false;
}
}
////////////////////////////////////////////////////////////////////////////////
void TF2::load_tasks ()
{
if (! _loaded_tasks)
{
if (! _loaded_lines)
load_lines ();
std::vector <std::string>::iterator i;
for (i = _lines.begin (); i != _lines.end (); ++i)
_tasks.push_back (Task (*i));
_loaded_tasks = true;
}
}
////////////////////////////////////////////////////////////////////////////////
void TF2::load_lines ()
{
if (! _loaded_lines)
{
if (! _loaded_contents)
load_contents ();
split (_lines, _contents, '\n');
_loaded_lines = true;
}
}
////////////////////////////////////////////////////////////////////////////////
void TF2::load_contents ()
{
if (! _loaded_contents)
{
_contents = "";
if (_file.open ())
{
if (_file.lock ())
{
_file.read (_contents);
_loaded_contents = true;
}
// TODO Error handling?
}
// TODO Error handling?
}
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
TDB2::TDB2 () TDB2::TDB2 ()
: _location ("") : _location ("")
, _loaded_pending_tasks (false)
, _loaded_pending_lines (false)
, _loaded_pending_contents (false)
, _dirty_pending_tasks (false)
, _dirty_pending_lines (false)
, _dirty_pending_contents (false)
, _pending_contents ("")
, _completed_contents ("")
, _backlog_contents ("")
, _undo_contents ("")
{ {
} }
@ -54,122 +226,44 @@ TDB2::~TDB2 ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Once a location is known, the files can be set up. Note that they are not
// read.
void TDB2::set_location (const std::string& location) void TDB2::set_location (const std::string& location)
{ {
_location = location; _location = location;
}
//////////////////////////////////////////////////////////////////////////////// pending.target (location + "/pending.data");
std::vector <Task>& TDB2::get_pending_tasks () completed.target (location + "/completed.data");
{ undo.target (location + "/undo.data");
if (! _loaded_pending_tasks) backlog.target (location + "/backlog.data");
load_pending_tasks (); synch_key.target (location + "/synch.key");
return _pending_tasks;
}
////////////////////////////////////////////////////////////////////////////////
std::vector <std::string>& TDB2::get_pending_lines ()
{
if (! _loaded_pending_lines)
load_pending_lines ();
return _pending_lines;
}
////////////////////////////////////////////////////////////////////////////////
std::string& TDB2::get_pending_contents ()
{
if (! _loaded_pending_contents)
load_pending_contents ();
return _pending_contents;
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::load_pending_tasks ()
{
if (! _loaded_pending_tasks)
{
if (! _loaded_pending_lines)
load_pending_lines ();
std::vector <std::string>::iterator i;
for (i = _pending_lines.begin (); i != _pending_lines.end (); ++i)
_pending_tasks.push_back (Task (*i));
_loaded_pending_tasks = true;
}
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::load_pending_lines ()
{
if (! _loaded_pending_lines)
{
if (! _loaded_pending_contents)
load_pending_contents ();
split (_pending_lines, _pending_contents, '\n');
_loaded_pending_lines = true;
}
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::load_pending_contents ()
{
if (! _loaded_pending_contents)
{
_pending_contents = "";
_dirty_pending_contents = false;
// TODO pending_file = File (_location + "/pending.data");
// TODO pending_file.openAndLock ();
// TODO pending_file.read (_pending_contents);
_loaded_pending_contents = true;
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TDB2::add (const Task& task) void TDB2::add (const Task& task)
{ {
// TODO Handle pending vs completed/deleted // Use the raw string form for speed.
std::string status = task.get ("status");
_dirty_pending_tasks = true; if (status == "completed" || status == "deleted")
completed.add_task (task);
else
pending.add_task (task);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TDB2::modify (const Task& task) void TDB2::modify (const Task& task)
{ {
// TODO Handle pending vs completed/deleted // TODO Handle pending vs completed/deleted
_dirty_pending_tasks = true;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TDB2::commit () void TDB2::commit ()
{ {
if (_dirty_pending_tasks) pending.commit ();
{ completed.commit ();
// TODO Compose _pending_lines from _pending_tasks undo.commit ();
_dirty_pending_tasks = false; backlog.commit ();
} synch_key.commit ();
if (_dirty_pending_lines)
{
_pending_contents = ""; // TODO Verify no resize.
join (_pending_contents, "\n", _pending_lines);
_dirty_pending_lines = false;
}
if (_dirty_pending_contents)
{
// TODO Write _pending_contents to file.
// TODO _pending_file.write (_pending_contents);
_dirty_pending_contents = false;
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -34,6 +34,46 @@
#include <File.h> #include <File.h>
#include <Task.h> #include <Task.h>
// TF2 Class represents a single file in the task database.
class TF2
{
public:
TF2 ();
~TF2 ();
void target (const std::string&);
std::vector <Task>& get_tasks ();
std::vector <std::string>& get_lines ();
std::string& get_contents ();
void add_task (const Task&);
void modify_task (const Task&);
void add_line (const std::string&);
void clear_lines ();
void commit ();
private:
void load_tasks ();
void load_lines ();
void load_contents ();
private:
bool _dirty;
bool _loaded_tasks;
bool _loaded_lines;
bool _loaded_contents;
std::vector <Task> _tasks;
std::vector <Task> _added_tasks;
std::vector <Task> _modified_tasks;
std::vector <std::string> _lines;
std::vector <std::string> _added_lines;
std::string _contents;
File _file;
};
// TDB2 Class represents all the files in the task database.
class TDB2 class TDB2
{ {
public: public:
@ -41,37 +81,19 @@ public:
~TDB2 (); ~TDB2 ();
void set_location (const std::string&); void set_location (const std::string&);
std::vector <Task>& get_pending_tasks ();
std::vector <std::string>& get_pending_lines ();
std::string& get_pending_contents ();
void add (const Task&); void add (const Task&);
void modify (const Task&); void modify (const Task&);
void commit (); void commit ();
private: public:
void load_pending_tasks (); TF2 pending;
void load_pending_lines (); TF2 completed;
void load_pending_contents (); TF2 undo;
TF2 backlog;
TF2 synch_key;
private: private:
std::string _location; std::string _location;
bool _loaded_pending_tasks;
bool _loaded_pending_lines;
bool _loaded_pending_contents;
bool _dirty_pending_tasks;
bool _dirty_pending_lines;
bool _dirty_pending_contents;
std::vector <Task> _pending_tasks;
std::vector <std::string> _pending_lines;
std::string _pending_contents;
File _pending_file;
std::string _completed_contents;
std::string _backlog_contents;
std::string _undo_contents;
}; };

View file

@ -789,10 +789,10 @@ void Variant::cast (const variant_type type)
else if (mType == v_string && type == v_double) else if (mType == v_string && type == v_double)
mDouble = atol (mString.c_str ()); mDouble = atol (mString.c_str ());
// From v_date // TODO From v_date
// From v_duration // TODO From v_duration
mType = type; mType = type;
@ -805,4 +805,35 @@ Variant::variant_type Variant::type ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Variant::promote (Variant& lhs, Variant& rhs)
{
// Short circuit.
if (lhs.type () == rhs.type ())
return;
variant_type newType;
switch (lhs.type () | rhs.type ())
{
case v_boolean | v_integer: newType = v_integer; break;
case v_boolean | v_double: newType = v_double; break;
case v_boolean | v_string: newType = v_string; break;
case v_boolean | v_date: newType = v_date; break;
case v_boolean | v_duration: newType = v_duration; break;
case v_integer | v_double: newType = v_integer; break;
case v_integer | v_string: newType = v_string; break;
case v_integer | v_date: newType = v_date; break;
case v_integer | v_duration: newType = v_duration; break;
case v_double | v_string: newType = v_string; break;
case v_double | v_date: newType = v_date; break;
case v_double | v_duration: newType = v_duration; break;
case v_string | v_date: newType = v_date; break;
case v_string | v_duration: newType = v_duration; break;
case v_date | v_duration: newType = v_date; break;
}
lhs.cast (newType);
rhs.cast (newType);
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -37,14 +37,14 @@ class Variant
public: public:
enum variant_type enum variant_type
{ {
v_unknown, v_unknown = 1,
v_boolean, v_boolean = 2,
v_integer, v_integer = 4,
v_double, v_double = 8,
v_string, v_string = 16,
v_date, v_date = 32,
v_duration, v_duration = 64,
v_other v_other = 128
}; };
Variant (); Variant ();
@ -89,6 +89,7 @@ public:
std::string format (); std::string format ();
void cast (const variant_type); void cast (const variant_type);
variant_type type (); variant_type type ();
void promote (Variant&, Variant&);
private: private:
variant_type mType; variant_type mType;

View file

@ -0,0 +1,13 @@
cmake_minimum_required (VERSION 2.8)
include_directories (${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands
${CMAKE_SOURCE_DIR}/src/columns
${TASK_INCLUDE_DIRS})
set (columns_SRCS Column.cpp Column.h)
add_library (columns STATIC ${columns_SRCS})
set (CMAKE_BUILD_TYPE debug)
set (CMAKE_C_FLAGS_DEBUG "-ggdb3")
set (CMAKE_C_FLAGS_RELEASE "-O3")

View file

@ -26,16 +26,19 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream> #include <iostream>
#include <Context.h>
#include <Column.h> #include <Column.h>
extern Context context; extern Context context;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static Column* Column::factory (const std::string& name) Column* Column::factory (const std::string& name)
{ {
/*
if (name == "description") return new ColumnDescription (); if (name == "description") return new ColumnDescription ();
throw std::string ("Unrecognized column type '") + name + "'"; throw std::string ("Unrecognized column type '") + name + "'";
*/
return NULL; return NULL;
} }

View file

@ -56,11 +56,5 @@ private:
sizing _sizing; sizing _sizing;
}; };
class ColumnDescription : public Column
{
public:
private:
};
#endif #endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -0,0 +1,14 @@
cmake_minimum_required (VERSION 2.8)
include_directories (${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands
${CMAKE_SOURCE_DIR}/src/columns
${TASK_INCLUDE_DIRS})
set (commands_SRCS Command.cpp Command.h
Install.cpp Install.h)
add_library (commands STATIC ${commands_SRCS})
set (CMAKE_BUILD_TYPE debug)
set (CMAKE_C_FLAGS_DEBUG "-ggdb3")
set (CMAKE_C_FLAGS_RELEASE "-O3")

View file

@ -27,9 +27,21 @@
#include <iostream> #include <iostream>
#include <Command.h> #include <Command.h>
#include <Context.h>
extern Context context; extern Context context;
////////////////////////////////////////////////////////////////////////////////
Command* Command::factory (const std::string& name)
{
/*
if (name == "install") return new Install ();
throw std::string ("Unrecognized command '") + name + "'";
*/
return NULL;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Command::Command () Command::Command ()
{ {

View file

@ -38,6 +38,8 @@ public:
bool operator== (const Command&) const; // TODO Is this necessary? bool operator== (const Command&) const; // TODO Is this necessary?
~Command (); ~Command ();
static Command* factory (const std::string&);
bool implements (const std::string&) const; bool implements (const std::string&) const;
std::string execute (const std::string&); std::string execute (const std::string&);

91
src/commands/Install.cpp Normal file
View file

@ -0,0 +1,91 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
// All rights reserved.
//
// 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.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <Install.h>
#include <Context.h>
extern Context context;
////////////////////////////////////////////////////////////////////////////////
Install::Install ()
{
}
////////////////////////////////////////////////////////////////////////////////
Install::Install (const Install& other)
{
/*
_minimum = other._minimum;
*/
}
////////////////////////////////////////////////////////////////////////////////
Install& Install::operator= (const Install& other)
{
if (this != &other)
{
/*
_name = other._name;
*/
}
return *this;
}
////////////////////////////////////////////////////////////////////////////////
bool Install::operator== (const Install& other) const
{
return false;
/*
return _name == other._name &&
_minimum == other._minimum &&
_maximum == other._maximum &&
_wrap == other._wrap &&
_just == other._just &&
_sizing == other._sizing;
*/
}
////////////////////////////////////////////////////////////////////////////////
Install::~Install ()
{
}
////////////////////////////////////////////////////////////////////////////////
bool Install::implements (const std::string&) const
{
return false;
}
////////////////////////////////////////////////////////////////////////////////
std::string Install::execute (const std::string&)
{
return "output";
}
////////////////////////////////////////////////////////////////////////////////

49
src/commands/Install.h Normal file
View file

@ -0,0 +1,49 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
// All rights reserved.
//
// 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.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_INSTALL
#define INCLUDED_INSTALL
#include <string>
#include <Command.h>
class Install : Command
{
public:
Install ();
Install (const Install&);
Install& operator= (const Install&);
bool operator== (const Install&) const; // TODO Is this necessary?
~Install ();
bool implements (const std::string&) const;
std::string execute (const std::string&);
private:
};
#endif
////////////////////////////////////////////////////////////////////////////////

View file

@ -1,5 +1,7 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8)
include_directories (${CMAKE_SOURCE_DIR}/src include_directories (${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands
${CMAKE_SOURCE_DIR}/src/columns
${CMAKE_SOURCE_DIR}/test ${CMAKE_SOURCE_DIR}/test
${TASK_INCLUDE_DIRS}) ${TASK_INCLUDE_DIRS})
@ -17,5 +19,5 @@ add_custom_target (build_tests DEPENDS ${test_SRCS}
foreach (src_FILE ${test_SRCS}) foreach (src_FILE ${test_SRCS})
add_executable (${src_FILE} "${src_FILE}.cpp" test.cpp) add_executable (${src_FILE} "${src_FILE}.cpp" test.cpp)
target_link_libraries (${src_FILE} task ${TASK_LIBRARIES}) target_link_libraries (${src_FILE} task commands columns ${TASK_LIBRARIES})
endforeach (src_FILE) endforeach (src_FILE)