Enhancements - TDB::mId

- Implemented ID assignment.
- Removed unnecessary constructors.
This commit is contained in:
Paul Beckingham 2009-06-11 20:30:54 -04:00
parent 754b79afb2
commit ac9dae9af8
2 changed files with 8 additions and 37 deletions

View file

@ -68,42 +68,10 @@
TDB2::TDB2 ()
: mLock (true)
, mAllOpenAndLocked (false)
, mId (1)
{
}
////////////////////////////////////////////////////////////////////////////////
TDB2::TDB2 (const TDB2& other)
{
throw std::string ("unimplemented TDB2::TDB2");
// mLocations = other.mLocations;
// mFiles = other.mFiles;
// mLock = other.mLock;
// mAllOpenAndLocked = false; // Deliberately so.
//
// // Set all to NULL, otherwise we are duplicating open file handles.
// foreach (file, mFiles)
// mFiles[file->first] = NULL;
}
////////////////////////////////////////////////////////////////////////////////
TDB2& TDB2::operator= (const TDB2& other)
{
throw std::string ("unimplemented TDB2::operator=");
// if (this != &other)
// {
// mLocations = other.mLocations;
// mFiles = other.mFiles;
// mLock = other.mLock;
// mAllOpenAndLocked = false; // Deliberately so.
//
// // Set all to NULL, otherwise we are duplicating open file handles.
// foreach (file, mFiles)
// mFiles[file->first] = NULL;
// }
//
return *this;
}
////////////////////////////////////////////////////////////////////////////////
TDB2::~TDB2 ()
{
@ -205,6 +173,8 @@ int TDB2::loadPending (std::vector <Task>& tasks, Filter& filter)
// TODO Add hidden attribute indicating source?
line[length - 1] = '\0'; // Kill \n
Task task (line);
task.id (mId++);
if (filter.pass (task))
tasks.push_back (task);
}
@ -255,6 +225,8 @@ int TDB2::loadCompleted (std::vector <Task>& tasks, Filter& filter)
// TODO Add hidden attribute indicating source?
line[length - 1] = '\0'; // Kill \n
Task task (line);
task.id (mId++);
if (filter.pass (task))
tasks.push_back (task);
}

View file

@ -40,10 +40,8 @@
class TDB2
{
public:
TDB2 (); // Default constructor
TDB2 (const TDB2&); // Copy constructor
TDB2& operator= (const TDB2&); // Assignment operator
~TDB2 (); // Destructor
TDB2 (); // Default constructor
~TDB2 (); // Destructor
void clear ();
void location (const std::string&);
@ -66,6 +64,7 @@ private:
std::vector <Location> mLocations;
bool mLock;
bool mAllOpenAndLocked;
int mId;
// TODO Need cache of raw file contents to preserve comments.
};