File indexing completed on 2024-04-28 16:01:31
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 #ifndef LIBQGIT2_BLOB_H 0022 #define LIBQGIT2_BLOB_H 0023 0024 #include "qgitobject.h" 0025 0026 namespace LibQGit2 0027 { 0028 /** 0029 * @brief Wrapper class for git_blob. 0030 * 0031 * @ingroup LibQGit2 0032 * @{ 0033 */ 0034 class LIBQGIT2_EXPORT Blob : public Object 0035 { 0036 public: 0037 0038 /** 0039 * Create an Blob. 0040 * 0041 * Creates a Blob that points to the given git_blob. 0042 */ 0043 explicit Blob(git_blob *blob = 0); 0044 0045 /** 0046 * Copy constructor. 0047 */ 0048 Blob(const Blob& other); 0049 0050 /** 0051 * Destroy the object. 0052 */ 0053 ~Blob(); 0054 0055 /** 0056 * Get the raw content of this blob. 0057 * 0058 * This method returns a read-only buffer with the raw content 0059 * of the blob. This pointer is automatically freed when there 0060 * are no more objects referencing it. The pointer may be 0061 * invalidated at a later time (e.g. when changing the contents 0062 * of the blob). 0063 * 0064 * @return the pointer; NULL if the blob has no contents 0065 */ 0066 const void* rawContent() const; 0067 0068 /** 0069 * @return The blob content as QByteArray. 0070 */ 0071 QByteArray content() const; 0072 0073 /** 0074 * Get the size in bytes of the contents of a blob 0075 * 0076 * @return size on bytes 0077 */ 0078 int rawSize() const; 0079 0080 git_blob* data() const; 0081 const git_blob* constData() const; 0082 }; 0083 0084 /**@}*/ 0085 } 0086 0087 #endif // LIBQGIT2_BLOB_H