mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Expressions - Refactor
- The A3::Arg object is very similar to the E9::Term object, so the two are being merged. First step is to separate A3::Arg into it's own space, then add a _type member. - Added more valid stop characters as terminators for various arg types. - Removed redundant E9 special handling for dates, which is already built in to the Date object.
This commit is contained in:
parent
7dd3e081c7
commit
816b07e868
6 changed files with 190 additions and 112 deletions
100
src/Arg.cpp
Normal file
100
src/Arg.cpp
Normal file
|
@ -0,0 +1,100 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 <Arg.h>
|
||||
#include <Context.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Arg::Arg ()
|
||||
: _raw ("")
|
||||
, _type ("")
|
||||
, _category ("")
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Arg::Arg (const std::string& raw)
|
||||
: _raw (raw)
|
||||
, _type ("")
|
||||
, _category ("")
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Arg::Arg (
|
||||
const std::string& raw,
|
||||
const std::string& category)
|
||||
: _raw (raw)
|
||||
, _type ("")
|
||||
, _category (category)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Arg::Arg (
|
||||
const std::string& raw,
|
||||
const std::string& type,
|
||||
const std::string& category)
|
||||
: _raw (raw)
|
||||
, _type (type)
|
||||
, _category (category)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Arg::Arg (const Arg& other)
|
||||
{
|
||||
_raw = other._raw;
|
||||
_type = other._type;
|
||||
_category = other._category;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Arg& Arg::operator= (const Arg& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
_raw = other._raw;
|
||||
_type = other._type;
|
||||
_category = other._category;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Arg::operator== (const Arg& other) const
|
||||
{
|
||||
return _raw == other._raw &&
|
||||
_type == other._type &&
|
||||
_category == other._category;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue