Debian Codegraph @

native/common/include/jp_methoddispatch.h

raw symbols SCIP
1 /*****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 *****************************************************************************/
16 #ifndef _JPMETHODDISPATCH_H_
17 #define _JPMETHODDISPATCH_H_
18
19 #include "jp_class.h"
20
21 class JPMethodDispatch : public JPResource
22 {
23 public:
24
25 /**
26 * Create a new method based on class and a name;
27 */
28 JPMethodDispatch(JPClass *clazz,
29 const string& name,
30 JPMethodList& overloads,
31 jint modifiers);
32
33 ~JPMethodDispatch() override;
34 JPMethodDispatch(const JPMethodDispatch& method) = delete;
35 JPMethodDispatch& operator=(const JPMethodDispatch& method) = delete;
36
37 public:
38
39 JPClass* getClass()
40 {
41 return m_Class;
42 }
43
44 const string& getName() const;
45
46 bool hasStatic() const
47 {
48 return JPModifier::isStatic(m_Modifiers);
49 }
50
51 bool isBeanMutator() const
52 {
53 return JPModifier::isBeanMutator(m_Modifiers);
54 }
55
56 bool isBeanAccessor() const
57 {
58 return JPModifier::isBeanAccessor(m_Modifiers);
59 }
60
61 JPPyObject invoke(JPJavaFrame& frame, JPPyObjectVector& vargs, bool instance);
62 JPValue invokeConstructor(JPJavaFrame& frame, JPPyObjectVector& vargs);
63 bool matches(JPJavaFrame& frame, JPPyObjectVector& args, bool instance);
64
65 string matchReport(JPPyObjectVector& sequence);
66
67 const JPMethodList& getMethodOverloads()
68 {
69 return m_Overloads;
70 }
71
72 private:
73 /** Search for a matching overload.
74 *
75 * @param searchInstance is true if the first argument is to be skipped
76 * when matching with a non-static.
77 */
78 bool findOverload(JPJavaFrame& frame, JPMethodMatch &bestMatch, JPPyObjectVector& vargs, bool searchInstance, bool raise);
79
80 JPClass* m_Class;
81 string m_Name;
82 JPMethodList m_Overloads;
83 jlong m_Modifiers;
84 JPMethodCache m_LastCache{};
85 } ;
86
87 #endif // _JPMETHODDISPATCH_H_