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_OPTIONS_H
0021 #define LIBQGIT2_STATUS_OPTIONS_H
0022 
0023 #include "git2.h"
0024 
0025 #include <QtGlobal>
0026 
0027 #include "libqgit2_export.h"
0028 
0029 namespace LibQGit2
0030 {
0031 
0032 /**
0033  * @brief Wrapper class for status options.
0034  *
0035  * You will find a complete description of status flags and options in git2/status.h
0036  * in the libgit2 code tree. This object avoid the coder to use the libgit2 defines to
0037  * get and set states and show modes.
0038  *
0039  * @ingroup LibQGit2
0040  * @{
0041  */
0042 class LIBQGIT2_EXPORT StatusOptions
0043 {
0044 public:
0045 
0046     enum ShowType {
0047         ShowIndexAndWorkdir = GIT_STATUS_SHOW_INDEX_AND_WORKDIR,
0048         ShowOnlyIndex = GIT_STATUS_SHOW_INDEX_ONLY,
0049         ShowOnlyWorkdir = GIT_STATUS_SHOW_WORKDIR_ONLY
0050     };
0051 
0052     enum StatusFlag {
0053         IncludeUntracked = GIT_STATUS_OPT_INCLUDE_UNTRACKED,
0054         IncludeIgnored = GIT_STATUS_OPT_INCLUDE_IGNORED,
0055         IncludeUnmodified = GIT_STATUS_OPT_INCLUDE_UNMODIFIED,
0056         ExcludeSubmodules = GIT_STATUS_OPT_EXCLUDE_SUBMODULES,
0057         RecurseUntrackedDirs = GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS,
0058         DisablePathspecMatch = GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH,
0059         RecurseIgnoredDirs = GIT_STATUS_OPT_RECURSE_IGNORED_DIRS,
0060         RenamesHeadToIndex = GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX,
0061         RenamesIndexToWorkdir = GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR,
0062         SortCaseSensitively = GIT_STATUS_OPT_SORT_CASE_SENSITIVELY,
0063         SortCaseInsensitively = GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY
0064     };
0065 
0066     Q_DECLARE_FLAGS(StatusFlags, StatusFlag)
0067 
0068     explicit StatusOptions(ShowType showType = ShowIndexAndWorkdir, StatusFlags statusFlags = StatusFlags());
0069 
0070     explicit StatusOptions(git_status_options status_options);
0071 
0072     StatusOptions(const StatusOptions& other);
0073 
0074     ~StatusOptions();
0075 
0076     ShowType showType() const;
0077 
0078     void setShowType(ShowType type);
0079 
0080     StatusFlags statusFlags() const;
0081 
0082     void setStatusFlags(StatusOptions::StatusFlags sf);
0083 
0084     git_status_options data() const;
0085     const git_status_options constData() const;
0086 
0087 private:
0088     git_status_options d;
0089 
0090     ShowType show_type;
0091     StatusFlags status_flags;
0092 };
0093 
0094 Q_DECLARE_OPERATORS_FOR_FLAGS(StatusOptions::StatusFlags)
0095 
0096 
0097 /**@}*/
0098 }
0099 
0100 #endif // LIBQGIT2_STATUS_OPTIONS_H