//
// aegis - project change supervisor
// Copyright (C) 2001, 2002, 2004-2006, 2008, 2012, 2014 Peter Miller
//
// 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 3 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, see .
//
#include
#include
#include
change_set_file::change_set_file(
const nstring &arg1,
const nstring &arg2,
action_t arg3,
const nstring_list &arg4
) :
filename(arg1),
edit(arg2),
action(arg3),
tag(arg4)
{
}
change_set_file::~change_set_file()
{
}
change_set_file::change_set_file(const change_set_file &rhs) :
filename(rhs.filename),
edit(rhs.edit),
action(rhs.action),
tag(rhs.tag)
{
}
void
change_set_file::swap(change_set_file &rhs)
{
filename.swap(rhs.filename);
edit.swap(rhs.edit);
std::swap(action, rhs.action);
tag.swap(rhs.tag);
}
change_set_file &
change_set_file::operator=(const change_set_file &rhs)
{
change_set_file(rhs).swap(*this);
return *this;
}
void
change_set_file::validate(void)
const
{
assert(valid());
}
bool
change_set_file::valid(void)
const
{
return (filename.valid() && edit.valid() && tag.valid());
}
const char *
change_set_file::action_name(action_t n)
{
switch (n)
{
case action_create:
return "create";
case action_modify:
return "modify";
case action_remove:
return "remove";
}
return "unknown";
}
void
change_set_file::merge(const change_set_file &from)
{
assert(filename == from.filename);
edit = from.edit;
tag.push_back_unique(from.tag);
}
// vim: set ts=8 sw=4 et :