File indexing completed on 2024-04-28 05:42:09

0001 /***************************************************************************
0002  *   Copyright (C) 2008-2009 by Rajko Albrecht  ral@alwins-world.de        *
0003  *   https://kde.org/applications/development/org.kde.kdesvn               *
0004  *                                                                         *
0005  * This program 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 program 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 program (in the file LGPL.txt); if not,         *
0017  * write to the Free Software Foundation, Inc., 51 Franklin St,            *
0018  * Fifth Floor, Boston, MA  02110-1301  USA                                *
0019  *                                                                         *
0020  * This software consists of voluntary contributions made by many          *
0021  * individuals.  For exact contribution history, see the revision          *
0022  * history and logs, available at https://commits.kde.org/kdesvn.          *
0023  ***************************************************************************/
0024 
0025 #ifndef SVNQT_DIFF_DATA_H
0026 #define SVNQT_DIFF_DATA_H
0027 
0028 #include <svnqt/path.h>
0029 #include <svnqt/pool.h>
0030 #include <svnqt/revision.h>
0031 #include <svnqt/svnqt_defines.h>
0032 #include <svnqt/svnstream.h>
0033 
0034 #include "helper.h"
0035 
0036 struct apr_file_t;
0037 struct svn_stream_t;
0038 
0039 namespace svn
0040 {
0041 class Path;
0042 
0043 class SVNQT_NOEXPORT DiffData
0044 {
0045 protected:
0046     Pool m_Pool;
0047 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0)
0048     stream::SvnByteStream *m_outStream;
0049     stream::SvnByteStream *m_errStream;
0050 #else
0051     Path m_tmpPath;
0052     apr_file_t *m_outFile;
0053     apr_file_t *m_errFile;
0054     const char *m_outFileName;
0055     const char *m_errFileName;
0056 #endif
0057 
0058     Path m_p1, m_p2;
0059     Revision m_r1, m_r2;
0060 
0061     bool m_working_copy_present, m_url_is_present;
0062 
0063     void init();
0064     void close();
0065 
0066 public:
0067     DiffData(const Path &aTmpPath, const Path &, const Revision &, const Path &, const Revision &);
0068     ~DiffData();
0069     DiffData(const DiffData &) = delete;
0070     DiffData &operator=(const DiffData &) = delete;
0071 
0072 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0)
0073     svn_stream_t *outStream()
0074     {
0075         return *m_outStream;
0076     }
0077     svn_stream_t *errStream()
0078     {
0079         return *m_errStream;
0080     }
0081 #else
0082     apr_file_t *outFile()
0083     {
0084         return m_outFile;
0085     }
0086     apr_file_t *errFile()
0087     {
0088         return m_errFile;
0089     }
0090 #endif
0091     const Revision &r1() const
0092     {
0093         return m_r1;
0094     }
0095     const Revision &r2() const
0096     {
0097         return m_r2;
0098     }
0099 
0100     QByteArray content();
0101 };
0102 }
0103 
0104 #endif