1 // Copyright (C) 2001, 2002, 2003 Michael Bartl
2 // Copyright (C) 2004, 2005 Ulf Lorenz
3 // Copyright (C) 2005 Andrea Paternesi
4 // Copyright (C) 2007, 2008 Ben Asselstine
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Library General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #include "UniquelyIdentified.h"
24 #include "xmlhelper.h"
26 UniquelyIdentified::UniquelyIdentified()
28 d_id = fl_counter->getNextId();
32 UniquelyIdentified::UniquelyIdentified(const UniquelyIdentified& obj)
33 :d_id(obj.d_id), d_unique(false)
37 UniquelyIdentified::UniquelyIdentified(guint32 id)
44 UniquelyIdentified::UniquelyIdentified(XML_Helper* helper)
46 helper->getData(d_id, "id");
47 //only unique objects are saved.
51 UniquelyIdentified::~UniquelyIdentified()
55 void UniquelyIdentified::syncNewId()
57 //we sync to the one after, so we don't reuse the same id
58 fl_counter->syncToId(d_id + 1);
61 void UniquelyIdentified::assignNewId()
63 d_id = fl_counter->getNextId();