GCC Code Coverage Report


Directory: avs_core/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 3
Functions: 0.0% 0 / 0 / 2
Branches: -% 0 / 0 / 0

core/function.h
Line Branch Exec Source
1 #pragma once
2
3 #include <avisynth.h>
4
5 struct Function {
6
7 typedef AVSValue(__cdecl *apply_func_t)(AVSValue args, void* user_data, IScriptEnvironment* env);
8
9 apply_func_t apply;
10 const char* name;
11 const char* canon_name;
12 const char* param_types;
13 void* user_data;
14 const char* dll_path;
15 // can be filled during plugin load:
16 bool isPluginAvs25;
17 bool isPluginPreV11C;
18 };
19
20 struct CaptureVars {
21 int count;
22 const char** var_names;
23 const AVSValue* var_data;
24 };
25
26 class IFunction {
27 public:
28 IFunction() : refcnt(0) {}
29 virtual ~IFunction() { }
30 virtual const char* ToString(IScriptEnvironment* env) = 0;
31 virtual const char* GetLegacyName() = 0;
32 virtual const Function* GetDefinition() = 0;
33 virtual CaptureVars GetCaptures() = 0;
34
35 private:
36 friend class PFunction;
37 friend class AVSValue;
38 unsigned long refcnt;
39 void AddRef();
40 void Release();
41 };
42
43
44 class AVSFunction : public Function {
45
46 public:
47
48 typedef Function::apply_func_t apply_func_t;
49
50 AVSFunction(void*);
51 AVSFunction(const char* _name, const char* _plugin_basename, const char* _param_types, apply_func_t _apply);
52 AVSFunction(const char* _name, const char* _plugin_basename, const char* _param_types, apply_func_t _apply, void *_user_data);
53 AVSFunction(const char* _name, const char* _plugin_basename, const char* _param_types, apply_func_t _apply, void *_user_data, const char* _dll_path,
54 bool _isPluginAvs25,
55 bool _isPluginPreV11C);
56 ~AVSFunction();
57
58 AVSFunction() = delete;
59 AVSFunction(const AVSFunction&) = delete;
60 AVSFunction& operator=(const AVSFunction&) = delete;
61 AVSFunction(AVSFunction&&) = delete;
62 AVSFunction& operator=(AVSFunction&&) = delete;
63
64 bool empty() const;
65
66 static bool IsScriptFunction(const Function* func);
67 static bool ArgNameMatch(const char* param_types, size_t args_names_count, const char* const* arg_names);
68 static bool TypeMatch(const char* param_types, const AVSValue* args, size_t num_args, bool strict, IScriptEnvironment* env);
69 static bool SingleTypeMatch(char type, const AVSValue& arg, bool strict);
70 static bool SingleTypeMatchArray(char type, const AVSValue& arg, bool strict);
71 };
72