+bool getTokenValue(string const & str, char const * token, Change & change, BufferParams bp)
+{
+ // set the change to be Change() as default as this it should be if not
+ // in the file format.
+ change = Change();
+ string tmp;
+ if (getTokenValue(str, token, tmp)) {
+ vector<string> const changedata = getVectorFromString(tmp, " ");
+ if (changedata.size() != 3) {
+ Alert::warning(_("Change tracking data incomplete"),
+ _("Change tracking information for tabular row/column "
+ "is incomplete. I will ignore this."));
+ return false;
+ }
+ BufferParams::AuthorMap const & am = bp.author_map_;
+ int aid = convert<int>(changedata[1]);
+ if (am.find(aid) == am.end()) {
+ // FIXME Use ErrorList
+ Alert::warning(_("Change tracking author index missing"),
+ bformat(_("A change tracking author information for index "
+ "%1$d is missing. This can happen after a wrong "
+ "merge by a version control system. In this case, "
+ "either fix the merge, or have this information "
+ "missing until the corresponding tracked changes "
+ "are merged or this user edits the file again.\n"),
+ aid));
+ bp.addAuthor(Author(aid));
+ }
+ istringstream is(changedata[2]);
+ time_t ct;
+ is >> ct;
+ if (changedata[0] == "inserted") {
+ change = Change(Change::INSERTED, am.find(aid)->second, ct);
+ return true;
+ } else if (changedata[0] == "deleted") {
+ change = Change(Change::DELETED, am.find(aid)->second, ct);
+ return true;
+ }
+ }
+ return false;
+}
+
+