1 /**
2  * @copyright
3  * ====================================================================
4  *    Licensed to the Apache Software Foundation (ASF) under one
5  *    or more contributor license agreements.  See the NOTICE file
6  *    distributed with this work for additional information
7  *    regarding copyright ownership.  The ASF licenses this file
8  *    to you under the Apache License, Version 2.0 (the
9  *    "License"); you may not use this file except in compliance
10  *    with the License.  You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *    Unless required by applicable law or agreed to in writing,
15  *    software distributed under the License is distributed on an
16  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  *    KIND, either express or implied.  See the License for the
18  *    specific language governing permissions and limitations
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file DiffSummaryReceiver.h
24  * @brief Interface of the class DiffSummaryReceiver
25  */
26 
27 #ifndef DIFFSUMMARYRECEIVER_H
28 #define DIFFSUMMARYRECEIVER_H
29 
30 #include <jni.h>
31 #include "svn_client.h"
32 
33 /**
34  * A diff summary receiver callback.
35  */
36 class DiffSummaryReceiver
37 {
38  public:
39   /**
40    * Create a DiffSummaryReceiver object.
41    * @param jreceiver The Java callback object.
42    */
43   DiffSummaryReceiver(jobject jreceiver);
44 
45   /**
46    * Destroy a DiffSummaryReceiver object
47    */
48   ~DiffSummaryReceiver();
49 
50   /**
51    * Implementation of the svn_client_diff_summarize_func_t API.
52    *
53    * @param diff The diff summary.
54    * @param baton A reference to the DiffSummaryReceiver instance.
55    * @param pool An APR pool from which to allocate memory.
56    */
57   static svn_error_t *summarize(const svn_client_diff_summarize_t *diff,
58                                 void *baton,
59                                 apr_pool_t *pool);
60 
61  protected:
62   /**
63    * Callback invoked for every diff summary.
64    *
65    * @param diff The diff summary.
66    * @param pool An APR pool from which to allocate memory.
67    */
68   svn_error_t *onSummary(const svn_client_diff_summarize_t *diff,
69                          apr_pool_t *pool);
70 
71  private:
72   /**
73    * A local reference to the Java DiffSummaryReceiver peer.
74    */
75   jobject m_receiver;
76 };
77 
78 #endif  // DIFFSUMMARYRECEIVER_H
79