//////////////////////////////////////////////////////////////////////////////// // task - a command line task list manager. // // Copyright 2006 - 2009, Paul Beckingham. // 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_T #define INCLUDED_T #include #include #include // Length of longest line. #define T_LINE_MAX 32768 class T { public: enum status {pending, completed, deleted, recurring}; T (); // Default constructor T (const std::string&); // Initialize by parsing storage format T (const T&); // Copy constructor T& operator= (const T&); // Assignment operator ~T (); // Destructor std::string getUUID () const { return mUUID; } void setUUID (const std::string& uuid) { mUUID = uuid; } int getId () const { return mId; } void setId (int id) { mId = id; } status getStatus () const { return mStatus; } void setStatus (status s) { mStatus = s; } const std::string getDescription () const { return mDescription; } void setDescription (const std::string& description) { mDescription = description; } void getSubstitution (std::string&, std::string&) const; void setSubstitution (const std::string&, const std::string&); bool hasTag (const std::string&) const; void getRemoveTags (std::vector&); // SPECIAL void addRemoveTag (const std::string&); // SPECIAL void getTags (std::vector&) const; void addTag (const std::string&); void addTags (const std::vector &); void removeTag (const std::string&); void removeTags (); void getAttributes (std::map&); const std::string getAttribute (const std::string&); void setAttribute (const std::string&, const std::string&); void setAttributes (const std::map &); void removeAttribute (const std::string&); void removeAttributes (); const std::string compose () const; const std::string composeCSV (); void parse (const std::string&); bool validate () const; private: int determineVersion (const std::string&); private: status mStatus; std::string mUUID; int mId; std::string mDescription; std::vector mTags; std::vector mRemoveTags; std::map mAttributes; std::string mFrom; std::string mTo; }; #endif ////////////////////////////////////////////////////////////////////////////////