diff --git a/.gitignore b/.gitignore index fcbfa6108..3b6c55f50 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ commit.h Makefile */*task */*libtask.a +*/*/libcommands.a +*/*/libcolumns.a *~ .*.swp package-config/osx/binary/task diff --git a/CMakeLists.txt b/CMakeLists.txt index 64098e231..8e1f6205b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,6 @@ if (EXISTS .git/index) message ("-- Found SHA1 reference: ${COMMIT}") endif (EXISTS .git/index) - set (PACKAGE "${PROJECT_NAME}") set (VERSION "${PROJECT_VERSION}") set (PACKAGE_BUGREPORT "support@taskwarrior.org") @@ -39,26 +38,15 @@ if (LUA51_FOUND) set (TASK_LIBRARIES ${TASK_LIBRARIES} ${LUA_LIBRARIES}) endif (LUA51_FOUND) -message ("-- Looking for pthread") -find_path (PTHREAD_INCLUDE_DIR pthread.h) -find_library (PTHREAD_LIBRARY NAMES pthread) -if (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY) - message ("-- Found pthread: ${PTHREAD_LIBRARY}") - set (HAVE_LIBPTHREAD true) - set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR}) - set (TASK_LIBRARIES ${TASK_LIBRARIES} ${PTHREAD_LIBRARIES}) -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) +#message ("-- Looking for pthread") +#find_path (PTHREAD_INCLUDE_DIR pthread.h) +#find_library (PTHREAD_LIBRARY NAMES pthread) +#if (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY) +# message ("-- Found pthread: ${PTHREAD_LIBRARY}") +# set (HAVE_LIBPTHREAD true) +# set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR}) +# set (TASK_LIBRARIES ${TASK_LIBRARIES} ${PTHREAD_LIBRARIES}) +#endif (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY) check_function_exists (random HAVE_RANDOM) check_function_exists (srandom HAVE_SRANDOM) @@ -69,7 +57,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set (DARWIN true) elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - set (FREEBSD true) + set (FREEBSD true) else (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set (UNKNOWN true) endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -80,6 +68,8 @@ configure_file ( ${CMAKE_SOURCE_DIR}/cmake.h) add_subdirectory (src) +add_subdirectory (src/commands) +add_subdirectory (src/columns) add_subdirectory (doc) add_subdirectory (i18n) add_subdirectory (scripts) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 1f8b0ebb0..8170cd13b 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required (VERSION 2.8) message ("-- Configuring man pages") set (man_FILES task-color.5 task-faq.5 task-sync.5 task-tutorial.5 task.1 taskrc.5) foreach (man_FILE ${man_FILES}) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 663b964ca..28a55fc1a 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required (VERSION 2.8) install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${TASK_DOCDIR}/i18n FILES_MATCHING REGEX "tips.*" PATTERN "CMakeFiles" EXCLUDE) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index ad1fc8614..1079578f8 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1 +1,2 @@ +cmake_minimum_required (VERSION 2.8) install (DIRECTORY bash fish vim zsh add-ons extensions DESTINATION ${TASK_DOCDIR}/scripts) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e496d09c5..875f2a192 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,7 @@ +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 (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_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") install (TARGETS task_executable DESTINATION ${TASK_BINDIR}) diff --git a/src/Context.h b/src/Context.h index 04d73ed8c..536f94d9d 100644 --- a/src/Context.h +++ b/src/Context.h @@ -27,16 +27,17 @@ #ifndef INCLUDED_CONTEXT #define INCLUDED_CONTEXT -#include "Filter.h" -#include "Config.h" -#include "Sequence.h" -#include "Subst.h" -#include "Cmd.h" -#include "Task.h" -#include "TDB.h" -#include "TDB2.h" -#include "Hooks.h" -#include "DOM.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include class Context { @@ -82,13 +83,13 @@ public: Sequence sequence; Subst subst; Task task; - TDB tdb; + TDB tdb; // TODO Obsolete TDB2 tdb2; std::string program; std::vector args; std::string file_override; std::string var_overrides; - Cmd cmd; + Cmd cmd; // TODO Obsolete std::map aliases; std::vector tagAdditions; std::vector tagRemovals; @@ -100,6 +101,8 @@ public: std::vector debugMessages; bool inShadow; + std::vector commands; + int terminal_width; int terminal_height; }; diff --git a/src/TDB2.cpp b/src/TDB2.cpp index fbcdd1b6c..4b0c28ba1 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -29,20 +29,192 @@ #include +//////////////////////////////////////////////////////////////////////////////// +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 & TF2::get_tasks () +{ + if (! _loaded_tasks) + load_tasks (); + + return _tasks /*+ _added_tasks*/; +} + +//////////////////////////////////////////////////////////////////////////////// +std::vector & 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 modified; + std::vector ::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 ::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 ::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 () : _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) { _location = location; -} -//////////////////////////////////////////////////////////////////////////////// -std::vector & TDB2::get_pending_tasks () -{ - if (! _loaded_pending_tasks) - load_pending_tasks (); - - return _pending_tasks; -} - -//////////////////////////////////////////////////////////////////////////////// -std::vector & 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 ::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; - } + pending.target (location + "/pending.data"); + completed.target (location + "/completed.data"); + undo.target (location + "/undo.data"); + backlog.target (location + "/backlog.data"); + synch_key.target (location + "/synch.key"); } //////////////////////////////////////////////////////////////////////////////// void TDB2::add (const Task& task) { - // TODO Handle pending vs completed/deleted - - _dirty_pending_tasks = true; + // Use the raw string form for speed. + std::string status = task.get ("status"); + if (status == "completed" || status == "deleted") + completed.add_task (task); + else + pending.add_task (task); } //////////////////////////////////////////////////////////////////////////////// void TDB2::modify (const Task& task) { // TODO Handle pending vs completed/deleted - - _dirty_pending_tasks = true; } //////////////////////////////////////////////////////////////////////////////// void TDB2::commit () { - if (_dirty_pending_tasks) - { - // TODO Compose _pending_lines from _pending_tasks - _dirty_pending_tasks = false; - } - - 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; - } + pending.commit (); + completed.commit (); + undo.commit (); + backlog.commit (); + synch_key.commit (); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/TDB2.h b/src/TDB2.h index 8b54297b8..22b596367 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -34,6 +34,46 @@ #include #include +// TF2 Class represents a single file in the task database. +class TF2 +{ +public: + TF2 (); + ~TF2 (); + + void target (const std::string&); + + std::vector & get_tasks (); + std::vector & 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 _tasks; + std::vector _added_tasks; + std::vector _modified_tasks; + std::vector _lines; + std::vector _added_lines; + std::string _contents; + File _file; +}; + + +// TDB2 Class represents all the files in the task database. class TDB2 { public: @@ -41,37 +81,19 @@ public: ~TDB2 (); void set_location (const std::string&); - - std::vector & get_pending_tasks (); - std::vector & get_pending_lines (); - std::string& get_pending_contents (); - void add (const Task&); void modify (const Task&); void commit (); -private: - void load_pending_tasks (); - void load_pending_lines (); - void load_pending_contents (); +public: + TF2 pending; + TF2 completed; + TF2 undo; + TF2 backlog; + TF2 synch_key; private: 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 _pending_tasks; - std::vector _pending_lines; - std::string _pending_contents; - File _pending_file; - - std::string _completed_contents; - std::string _backlog_contents; - std::string _undo_contents; }; diff --git a/src/Variant.cpp b/src/Variant.cpp index c387aa8c6..d4d448ace 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -789,10 +789,10 @@ void Variant::cast (const variant_type type) else if (mType == v_string && type == v_double) mDouble = atol (mString.c_str ()); - // From v_date + // TODO From v_date - // From v_duration + // TODO From v_duration 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); +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Variant.h b/src/Variant.h index 33f992ea8..2167a9f1e 100644 --- a/src/Variant.h +++ b/src/Variant.h @@ -37,14 +37,14 @@ class Variant public: enum variant_type { - v_unknown, - v_boolean, - v_integer, - v_double, - v_string, - v_date, - v_duration, - v_other + v_unknown = 1, + v_boolean = 2, + v_integer = 4, + v_double = 8, + v_string = 16, + v_date = 32, + v_duration = 64, + v_other = 128 }; Variant (); @@ -89,6 +89,7 @@ public: std::string format (); void cast (const variant_type); variant_type type (); + void promote (Variant&, Variant&); private: variant_type mType; diff --git a/src/columns/CMakeLists.txt b/src/columns/CMakeLists.txt new file mode 100644 index 000000000..797d4e084 --- /dev/null +++ b/src/columns/CMakeLists.txt @@ -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") diff --git a/src/columns/Column.cpp b/src/columns/Column.cpp index 4a3e2ccfc..9cd423784 100644 --- a/src/columns/Column.cpp +++ b/src/columns/Column.cpp @@ -26,16 +26,19 @@ //////////////////////////////////////////////////////////////////////////////// #include +#include #include extern Context context; //////////////////////////////////////////////////////////////////////////////// -static Column* Column::factory (const std::string& name) +Column* Column::factory (const std::string& name) { +/* if (name == "description") return new ColumnDescription (); throw std::string ("Unrecognized column type '") + name + "'"; +*/ return NULL; } diff --git a/src/columns/Column.h b/src/columns/Column.h index 4dfc7553f..c6887bab4 100644 --- a/src/columns/Column.h +++ b/src/columns/Column.h @@ -56,11 +56,5 @@ private: sizing _sizing; }; -class ColumnDescription : public Column -{ -public: -private: -}; - #endif //////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CMakeLists.txt b/src/commands/CMakeLists.txt new file mode 100644 index 000000000..8122366e4 --- /dev/null +++ b/src/commands/CMakeLists.txt @@ -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") diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index e3530c8f4..e203dc542 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -27,9 +27,21 @@ #include #include +#include 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 () { diff --git a/src/commands/Command.h b/src/commands/Command.h index 393bcccdd..c8247dfb4 100644 --- a/src/commands/Command.h +++ b/src/commands/Command.h @@ -38,6 +38,8 @@ public: bool operator== (const Command&) const; // TODO Is this necessary? ~Command (); + static Command* factory (const std::string&); + bool implements (const std::string&) const; std::string execute (const std::string&); diff --git a/src/commands/Install.cpp b/src/commands/Install.cpp new file mode 100644 index 000000000..2f8717acf --- /dev/null +++ b/src/commands/Install.cpp @@ -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 +#include +#include + +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"; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/Install.h b/src/commands/Install.h new file mode 100644 index 000000000..19739539f --- /dev/null +++ b/src/commands/Install.h @@ -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 +#include + +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 +//////////////////////////////////////////////////////////////////////////////// diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ab8f3c878..2d7d8fdf6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required (VERSION 2.8) include_directories (${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/commands + ${CMAKE_SOURCE_DIR}/src/columns ${CMAKE_SOURCE_DIR}/test ${TASK_INCLUDE_DIRS}) @@ -17,5 +19,5 @@ add_custom_target (build_tests DEPENDS ${test_SRCS} foreach (src_FILE ${test_SRCS}) 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)