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_H 0021 #define LIBQGIT2_STATUS_H 0022 0023 #include "git2.h" 0024 0025 #include "libqgit2_export.h" 0026 0027 namespace LibQGit2 0028 { 0029 /** 0030 * @brief Wrapper class for status flags. 0031 * 0032 * You will find a complete description of libgit status values in git2/status.h 0033 * in the libgit2 code tree. 0034 * Remember that Git status refers both to index and workdir, i.e. to modifications 0035 * you already staged (index) and to modifications made in the local workdir and not yet staged (workdir). 0036 * 0037 * @ingroup LibQGit2 0038 * @{ 0039 */ 0040 class LIBQGIT2_EXPORT Status 0041 { 0042 public: 0043 explicit Status(const git_status_t status_flags); 0044 0045 Status(const Status& other); 0046 0047 ~Status(); 0048 0049 /** 0050 * Returns true if no changes are pending 0051 */ 0052 bool isCurrent() const; 0053 0054 /** 0055 * Returns true if the file is new in the index 0056 */ 0057 bool isNewInIndex() const; 0058 0059 /** 0060 * Returns true if the file has been modified in the index 0061 */ 0062 bool isModifiedInIndex() const; 0063 0064 /** 0065 * Returns true if the file has been deleted in the index 0066 */ 0067 bool isDeletedInIndex() const; 0068 0069 /** 0070 * Returns true if the file has been renamed in the index 0071 */ 0072 bool isRenamedInIndex() const; 0073 0074 /** 0075 * Returns true if the file type has been changed in the index 0076 */ 0077 bool isTypeChangedInIndex() const; 0078 0079 /** 0080 * Returns true if the file is new in the workdir 0081 */ 0082 bool isNewInWorkdir() const; 0083 0084 /** 0085 * Returns true if the file has been modified in the workdir 0086 */ 0087 bool isModifiedInWorkdir() const; 0088 0089 /** 0090 * Returns true if the file has been deleted in the workdir 0091 */ 0092 bool isDeletedInWorkdir() const; 0093 0094 /** 0095 * Returns true if the file has been renamed in the workdir 0096 */ 0097 bool isRenamedInWorkdir() const; 0098 0099 /** 0100 * Returns true if the file type has been changed in the workdir 0101 */ 0102 bool isTypeChangedInWorkdir() const; 0103 0104 unsigned int data() const; 0105 0106 private: 0107 git_status_t d; 0108 }; 0109 0110 0111 /**@}*/ 0112 } 0113 0114 #endif // LIBQGIT2_STATUS_H