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

0001 /******************************************************************************
0002  * This file is part of the libqgit2 library
0003  * Copyright (c) 2011 Laszlo Papp <djszapi@archlinux.us>
0004  * Copyright (C) 2013 Leonardo Giordani
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, write to the Free Software
0018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0019  */
0020 
0021 #include "qgitindexentry.h"
0022 #include "qgitoid.h"
0023 
0024 #include "private/pathcodec.h"
0025 
0026 namespace LibQGit2
0027 {
0028 
0029 IndexEntry::IndexEntry(const git_index_entry *data)
0030     : d(data)
0031 {
0032 }
0033 
0034 IndexEntry::IndexEntry(const IndexEntry& other)
0035     : d(other.d)
0036 {
0037 }
0038 
0039 IndexEntry::~IndexEntry()
0040 {
0041 }
0042 
0043 OId IndexEntry::id() const
0044 {
0045     return OId(&d->id);
0046 }
0047 
0048 QString IndexEntry::path() const
0049 {
0050     return PathCodec::fromLibGit2(d->path);
0051 }
0052 
0053 qint64 IndexEntry::fileSize() const
0054 {
0055     return d->file_size;
0056 }
0057 
0058 int IndexEntry::stage() const {
0059     return git_index_entry_stage(d);
0060 }
0061 
0062 const git_index_entry *IndexEntry::data() const
0063 {
0064     return d;
0065 }
0066 
0067 } // namespace LibQGit2