mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-25 21:27:19 +02:00
Commands
- Modified command object design.
This commit is contained in:
parent
a7c3858729
commit
638fcd8ca0
4 changed files with 26 additions and 4 deletions
|
@ -68,6 +68,12 @@ Command& Command::operator= (const Command& other)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool Command::read_only () const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool Command::operator== (const Command& other) const
|
bool Command::operator== (const Command& other) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,12 +36,13 @@ public:
|
||||||
Command (const Command&);
|
Command (const Command&);
|
||||||
Command& operator= (const Command&);
|
Command& operator= (const Command&);
|
||||||
bool operator== (const Command&) const; // TODO Is this necessary?
|
bool operator== (const Command&) const; // TODO Is this necessary?
|
||||||
~Command ();
|
virtual ~Command ();
|
||||||
|
|
||||||
static Command* factory (const std::string&);
|
static Command* factory (const std::string&);
|
||||||
|
|
||||||
bool implements (const std::string&) const;
|
virtual bool read_only () const;
|
||||||
std::string execute (const std::string&);
|
virtual bool implements (const std::string&) const = 0;
|
||||||
|
virtual std::string execute (const std::string&) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,9 @@ extern Context context;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Install::Install ()
|
Install::Install ()
|
||||||
|
/*
|
||||||
|
: _name ("")
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,12 +80,23 @@ Install::~Install ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool Install::implements (const std::string&) const
|
bool Install::read_only () const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool Install::implements (const std::string& command_line) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Algorithm:
|
||||||
|
// Copy file rc.data.location/extensions
|
||||||
|
// Generate UUID
|
||||||
|
// Call the "install" function once, store results in rc:
|
||||||
|
// extension.<uuid>=<JSON>
|
||||||
std::string Install::execute (const std::string&)
|
std::string Install::execute (const std::string&)
|
||||||
{
|
{
|
||||||
return "output";
|
return "output";
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
bool operator== (const Install&) const; // TODO Is this necessary?
|
bool operator== (const Install&) const; // TODO Is this necessary?
|
||||||
~Install ();
|
~Install ();
|
||||||
|
|
||||||
|
bool read_only () const;
|
||||||
bool implements (const std::string&) const;
|
bool implements (const std::string&) const;
|
||||||
std::string execute (const std::string&);
|
std::string execute (const std::string&);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue