Enhancement

- Began detailed implementation of commands and columns objects.
This commit is contained in:
Paul Beckingham 2011-04-24 19:11:56 -04:00
parent 1c23b28514
commit 120562a7e9
9 changed files with 148 additions and 21 deletions

View file

@ -4,7 +4,8 @@ include_directories (${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/columns
${TASK_INCLUDE_DIRS})
set (columns_SRCS Column.cpp Column.h)
set (columns_SRCS Column.cpp Column.h
ID.cpp ID.h)
add_library (columns STATIC ${columns_SRCS})

View file

@ -45,11 +45,13 @@ Column* Column::factory (const std::string& name)
////////////////////////////////////////////////////////////////////////////////
Column::Column ()
: _name ("")
/*
, _minimum (0)
, _maximum (0)
, _wrap (false)
, _just (left)
, _sizing (minimal)
*/
{
}
@ -57,11 +59,13 @@ Column::Column ()
Column::Column (const Column& other)
{
_name = other._name;
/*
_minimum = other._minimum;
_maximum = other._maximum;
_wrap = other._wrap;
_just = other._just;
_sizing = other._sizing;
*/
}
////////////////////////////////////////////////////////////////////////////////
@ -70,11 +74,13 @@ Column& Column::operator= (const Column& other)
if (this != &other)
{
_name = other._name;
/*
_minimum = other._minimum;
_maximum = other._maximum;
_wrap = other._wrap;
_just = other._just;
_sizing = other._sizing;
*/
}
return *this;
@ -83,12 +89,12 @@ Column& Column::operator= (const Column& other)
////////////////////////////////////////////////////////////////////////////////
bool Column::operator== (const Column& other) const
{
return _name == other._name &&
return _name == other._name /*&&
_minimum == other._minimum &&
_maximum == other._maximum &&
_wrap == other._wrap &&
_just == other._just &&
_sizing == other._sizing;
_sizing == other._sizing*/;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -28,12 +28,15 @@
#define INCLUDED_COLUMN
#include <string>
#include <Task.h>
class Column
{
public:
/*
enum just {right = 0, left, center};
enum sizing {minimal = 0, fixed, proportional, maximal};
*/
static Column* factory (const std::string&);
@ -43,17 +46,19 @@ public:
bool operator== (const Column&) const; // TODO Is this necessary?
~Column ();
void setName (const std::string&);
std::string render (Task*, int, int, const std::string style = "default");
std::string type () const;
virtual void setName (const std::string&);
virtual std::string render (Task*, int, int, const std::string style = "default") = 0;
virtual std::string type () const = 0;
private:
protected:
std::string _name;
/*
int _minimum;
int _maximum;
bool _wrap;
just _just;
sizing _sizing;
*/
};
#endif

59
src/columns/ID.cpp Normal file
View file

@ -0,0 +1,59 @@
////////////////////////////////////////////////////////////////////////////////
// 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 <Context.h>
#include <ID.h>
extern Context context;
////////////////////////////////////////////////////////////////////////////////
ColumnID::ColumnID ()
{
setName ("id");
}
////////////////////////////////////////////////////////////////////////////////
ColumnID::~ColumnID ()
{
}
////////////////////////////////////////////////////////////////////////////////
std::string ColumnID::render (
Task* task,
int width,
int height,
const std::string style)
{
}
////////////////////////////////////////////////////////////////////////////////
std::string ColumnID::type () const
{
return "number";
}
////////////////////////////////////////////////////////////////////////////////

47
src/columns/ID.h Normal file
View file

@ -0,0 +1,47 @@
////////////////////////////////////////////////////////////////////////////////
// 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_ID
#define INCLUDED_ID
#include <string>
#include <Column.h>
#include <Task.h>
class ColumnID : public Column
{
public:
ColumnID ();
~ColumnID ();
std::string render (Task*, int, int, const std::string style = "default");
std::string type () const;
private:
};
#endif
////////////////////////////////////////////////////////////////////////////////