CVB++ 15.0
Loading...
Searching...
No Matches
detail_context.hpp
1#pragma once
2
3#include "../_decl/decl_context.hpp"
4#include "../_decl/decl_object.hpp"
5
6namespace Cvb
7{
8
9 CVB_BEGIN_INLINE_NS
10
11 namespace PyScript
12 {
13 inline ObjectPtr Context::Eval(const Cvb::String &fileName, const Cvb::String &code)
14 {
15 return Internal::DoResCallShareOut<Object>([this, &fileName, &code](void *&handle) {
16 return CVB_CALL_CAPI(CVPYSContextEvalTyped(handle_.Handle(), fileName.c_str(), code.c_str(), handle));
17 });
18 }
19
20 inline ObjectPtr Context::Import(const Cvb::String& moduleName)
21 {
22 return Internal::DoResCallShareOut<Object>([this, &moduleName](void *&handle) {
23 return CVB_CALL_CAPI(CVPYSContextImportTyped(handle_.Handle(), moduleName.c_str(), handle));
24 });
25 }
26
27 inline ObjectPtr Context::Item(const Cvb::String &itemName)
28 {
29 return Internal::DoResCallShareOut<Object>([this, &itemName](void *&handle) {
30 return CVB_CALL_CAPI(CVPYSContextGetItemTyped(handle_.Handle(), itemName.c_str(), handle));
31 });
32 }
33 }
34
35 CVB_END_INLINE_NS
36
37} // namespace Cvb
ObjectPtr Eval(const Cvb::String &fileName, const Cvb::String &code)
Compiles and evaluates python code-.
Definition detail_context.hpp:13
ObjectPtr Item(const Cvb::String &itemName)
Get an item from this context.
Definition detail_context.hpp:27
ObjectPtr Import(const Cvb::String &moduleName)
Imports a python module.
Definition detail_context.hpp:20
Namespace for the python scripting package.
Definition decl_context.hpp:21
std::shared_ptr< Object > ObjectPtr
Convenience shared pointer for Object.
Definition py_script.hpp:127
Root namespace for the Image Manager interface.
Definition version.hpp:11
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49