//
// aegis - project change supervisor
// Copyright (C) 2001, 2002, 2004-2006, 2008, 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 .
//
#ifndef AEIMPORT_FORMAT_H
#define AEIMPORT_FORMAT_H
#include
#include
#include
class format_search_list; // forward
class format_version; // forward
/**
* This is the base class for deriving all format classes.
* The format abstract base class is used to represent a vommon
* interface to various VCS formats.
* This is the base class for deriving all format classes.
* The formats include RCS and SCCS.
*/
class format
{
public:
typedef aegis_shared_ptr pointer;
/**
* The destructor.
*/
virtual ~format();
/**
* The factory clsss method is used to manufacture a format
* instance based on the name of the format.
*
* @param name
* The nam eof the repository format.
*/
static pointer factory(const nstring &name);
/**
* The search method is used to
*/
format_search_list *search(const nstring &filename);
/**
* The valid method is used to
*/
virtual bool valid(void) const = 0;
/**
* The history_get method is used to obtain command strings
* suitable for placing in the project "config" file.
*/
virtual nstring history_get(void) = 0;
/**
* The history_put method is used to obtain command strings
* suitable for placing in the project "config" file.
*/
virtual nstring history_put(void) = 0;
/**
* The history_query method is used to obtain command strings
* suitable for placing in the project "config" file.
*/
virtual nstring history_query(void) = 0;
/**
* The diff method is used to obtain command strings
* suitable for placing in the project "config" file.
*/
virtual nstring diff(void) = 0;
/**
* The merge method is used to obtain command strings
* suitable for placing in the project "config" file.
*/
virtual nstring merge(void) = 0;
/**
* The unlock method is used to to unlock the source file, if the
* format supports file locking, and the file is actually locked.
*/
virtual void unlock(const nstring &filename) = 0;
/**
* The sanitize method is used to remove path components that are
* not required, and also discard shell spevial characters.
*
* @param filenamr
* The file name to be sanitized.
* @param do_last
* If true, get rid of format-specific filename junk on the last
* path component.
*/
virtual nstring sanitize(const nstring &filename, bool do_last) = 0;
/**
* The is_a_candidate method is used to determine whether or
* not and file's name indicates it is a file containg versions
* information.
*/
virtual bool is_a_candidate(const nstring &filename) = 0;
/**
* The read_versions method is used to extract file version
* information from a history repository file.
*/
virtual format_version *read_versions(const nstring &physical_filename,
const nstring &logical_filename) = 0;
protected:
/**
* The default constructor.
* For use of derived classes only.
*/
format();
private:
/**
* The copy construvtor.
* Do not use.
*/
format(const format &rhs);
/**
* The assignment operator.
* Do not use.
*/
format &operator=(const format &rhs);
};
#endif // AEIMPORT_FORMAT_H
// vim: set ts=8 sw=4 et :