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 EnumMapper.h
24  * @brief Interface of the class EnumMapper
25  */
26 
27 #ifndef ENUM_MAPPER_H
28 #define ENUM_MAPPER_H
29 
30 #include <jni.h>
31 #include "svn_client.h"
32 #include "svn_wc.h"
33 #include "svn_repos.h"
34 #include "svn_types.h"
35 
36 class JNIStringHolder;
37 
38 /**
39  * This class contains all the mappers between the C enum's and the
40  * matching Java enums's.
41  */
42 class EnumMapper
43 {
44  public:
45   /* Converting to C enum's */
46   static svn_depth_t toDepth(jobject jdepth);
47   static svn_opt_revision_kind toRevisionKind(jobject jkind);
48   static svn_wc_conflict_choice_t toConflictChoice(jobject jchoice);
49   static int toMergeinfoLogKind(jobject jLogKind);
50   static int toLogLevel(jobject jLogLevel);
51   static svn_node_kind_t toNodeKind(jobject jNodeKind);
52   static svn_checksum_kind_t toChecksumKind(jobject jChecksumKind);
53   static svn_tristate_t toTristate(jobject jTristate);
54   static svn_mergeinfo_inheritance_t
55     toMergeinfoInheritance(jobject jInheritance);
56 
57   /* Converting from C enum's */
58   static jobject mapChangePathAction(const char action);
59   static jobject mapNotifyState(svn_wc_notify_state_t state);
60   static jobject mapNotifyAction(svn_wc_notify_action_t action);
61   static jobject mapReposNotifyNodeAction(svn_node_action action);
62   static jobject mapReposNotifyAction(svn_repos_notify_action_t action);
63   static jobject mapNodeKind(svn_node_kind_t nodeKind);
64   static jobject mapNotifyLockState(svn_wc_notify_lock_state_t state);
65   static jobject mapStatusKind(svn_wc_status_kind svnKind);
66   static jobject mapScheduleKind(svn_wc_schedule_t schedule);
67   static jobject mapChecksumKind(svn_checksum_kind_t kind);
68   static jobject mapConflictKind(svn_wc_conflict_kind_t kind);
69   static jobject mapConflictAction(svn_wc_conflict_action_t action);
70   static jobject mapConflictReason(svn_wc_conflict_reason_t reason);
71   static jobject mapDepth(svn_depth_t depth);
72   static jobject mapOperation(svn_wc_operation_t);
73   static jobject mapTristate(svn_tristate_t);
74   static jobject mapSummarizeKind(svn_client_diff_summarize_kind_t);
75  private:
76   static jobject mapEnum(const char *clazzName, int offset);
77   static int getOrdinal(const char *clazzName, jobject jenum);
78 };
79 
80 #endif  // ENUM_MAPPER_H
81