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

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_SIGNATURE_H
0022 #define LIBQGIT2_SIGNATURE_H
0023 
0024 #include <QtCore/QString>
0025 #include <QtCore/QDateTime>
0026 #include <QtCore/QSharedPointer>
0027 
0028 #include "git2.h"
0029 
0030 #include "libqgit2_export.h"
0031 
0032 namespace LibQGit2
0033 {
0034     /**
0035      * @brief This class represents signatures, used e.g. when creating commits.
0036      *
0037      * @ingroup LibQGit2
0038      * @{
0039      */
0040     class LIBQGIT2_EXPORT Signature
0041     {
0042         public:
0043             /**
0044              * Construct a new action signature.
0045              *
0046              * @param name name of the person
0047              * @param email email of the person
0048              * @param dateTime time when the action happened
0049              * @throws LibQGit2::Exception
0050              */
0051             Signature(const QString& name, const QString& email, QDateTime dateTime);
0052 
0053             /**
0054              * Construct a new action signature, using the `now` datetime generated by the
0055              * underlaying library.
0056              *
0057              * @param name name of the person
0058              * @param email email of the person
0059              * @throws LibQGit2::Exception
0060              */
0061             Signature(const QString& name, const QString& email);
0062 
0063             /**
0064              * Create a reference to an existing \a signature; ownership of the pointer is not transferred.
0065              */
0066             explicit Signature(const git_signature *signature = 0);
0067 
0068             /**
0069              * Return the 'name' from this signature
0070              */
0071             QString name() const;
0072 
0073             /**
0074              * Return the 'email' from this signature
0075              */
0076             QString email() const;
0077 
0078             /**
0079              * Return the time stamp from this signature
0080              */
0081             QDateTime when() const;
0082 
0083             const git_signature *data() const;
0084 
0085         private:
0086             class Private;
0087             QSharedPointer<Private> d_ptr;
0088     };
0089 
0090     /**@}*/
0091 }
0092 
0093 #endif // LIBQGIT2_SIGNATURE_H