mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
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:
parent
f1fa315342
commit
0471c17f12
20 changed files with 513 additions and 184 deletions
|
@ -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})
|
||||
|
|
|
@ -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 <Command.h>
|
||||
#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>
|
||||
|
||||
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 <std::string> args;
|
||||
std::string file_override;
|
||||
std::string var_overrides;
|
||||
Cmd cmd;
|
||||
Cmd cmd; // TODO Obsolete
|
||||
std::map <std::string, std::string> aliases;
|
||||
std::vector <std::string> tagAdditions;
|
||||
std::vector <std::string> tagRemovals;
|
||||
|
@ -100,6 +101,8 @@ public:
|
|||
std::vector <std::string> debugMessages;
|
||||
bool inShadow;
|
||||
|
||||
std::vector <Command*> commands;
|
||||
|
||||
int terminal_width;
|
||||
int terminal_height;
|
||||
};
|
||||
|
|
308
src/TDB2.cpp
308
src/TDB2.cpp
|
@ -29,20 +29,192 @@
|
|||
#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 ()
|
||||
: _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 <Task>& TDB2::get_pending_tasks ()
|
||||
{
|
||||
if (! _loaded_pending_tasks)
|
||||
load_pending_tasks ();
|
||||
|
||||
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;
|
||||
}
|
||||
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 ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
70
src/TDB2.h
70
src/TDB2.h
|
@ -34,6 +34,46 @@
|
|||
#include <File.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
|
||||
{
|
||||
public:
|
||||
|
@ -41,37 +81,19 @@ public:
|
|||
~TDB2 ();
|
||||
|
||||
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 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 <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;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
13
src/columns/CMakeLists.txt
Normal file
13
src/columns/CMakeLists.txt
Normal 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")
|
|
@ -26,16 +26,19 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
#include <Context.h>
|
||||
#include <Column.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,11 +56,5 @@ private:
|
|||
sizing _sizing;
|
||||
};
|
||||
|
||||
class ColumnDescription : public Column
|
||||
{
|
||||
public:
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
14
src/commands/CMakeLists.txt
Normal file
14
src/commands/CMakeLists.txt
Normal 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")
|
|
@ -27,9 +27,21 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <Command.h>
|
||||
#include <Context.h>
|
||||
|
||||
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 ()
|
||||
{
|
||||
|
|
|
@ -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&);
|
||||
|
||||
|
|
91
src/commands/Install.cpp
Normal file
91
src/commands/Install.cpp
Normal 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
49
src/commands/Install.h
Normal 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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
Loading…
Add table
Add a link
Reference in a new issue