File indexing completed on 2024-04-28 16:01:33

0001 /******************************************************************************
0002  * This file is part of the libqgit2 library
0003  * Copyright (C) 2013 Leonardo Giordani
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public
0016  * License along with this library; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018  */
0019 
0020 #ifndef LIBQGIT2_STATUS_ENTRY_H
0021 #define LIBQGIT2_STATUS_ENTRY_H
0022 
0023 #include "libqgit2_export.h"
0024 
0025 #include "git2.h"
0026 
0027 namespace LibQGit2
0028 {
0029 
0030 class Status;
0031 class DiffDelta;
0032 
0033 /**
0034  * @brief Wrapper class for git_status_entry.
0035  *
0036  * Represents a status entry in a Git repository, that is a Git status linked to a file name.
0037  * Actually the status entry encompasses two file names, to take renames into account.
0038  *
0039  * @ingroup LibQGit2
0040  * @{
0041  */
0042 class LIBQGIT2_EXPORT StatusEntry
0043 {
0044 public:
0045 
0046     explicit StatusEntry(const git_status_entry *entry);
0047 
0048     StatusEntry(const StatusEntry& other);
0049 
0050     ~StatusEntry();
0051 
0052     /**
0053      * Return the status of the entry
0054      */
0055     Status status() const;
0056 
0057     /**
0058      * Returns the diff between HEAD and index.
0059      */
0060     DiffDelta headToIndex() const;
0061 
0062     /**
0063      * Returns the diff between index and working directory.
0064      */
0065     DiffDelta indexToWorkdir() const;
0066 
0067 private:
0068     const git_status_entry* d;
0069 };
0070 
0071 /**@}*/
0072 }
0073 
0074 #endif // LIBQGIT2_STATUS_ENTRY_H