ShlubluLib
v0.5
ShlubluLib is a lightweight, modular, general purpose, open-source C++ library for Linux and Windows.
|
ObjectHandler const & keepArgument(ObjectHandler const &object)
Prevents an object reference from being stolen.
Handler of CPython object pointers used by Python to handle references counts.
Definition: Python_ObjectHandler.h:71
ObjectPointer module(std::string const &moduleName)
Retrieves a previously imported module.
void forgetArgument(ObjectHandler const &object)
Get rid of a reference of an object under control.
ObjectHandler list(ObjectHandlersList const &args={}, bool keepArguments=false)
Creates a list object initialized with the given arguments.
void endCriticalSection()
Exits a critical section, allowing other threads to enter a Python critical section.
ObjectPointer callable(ObjectPointer scope, std::string const &callableName, bool forceReload=false)
Retrieves a callable object (function or method) by its name from a scope pointer.
bool isInitialized()
Check whether Python is initialized.
std::string toAscii(ObjectHandler utfStr, bool keepArg=false)
Converts a UTF-8 CPython string object to a std::string.
std::vector< ObjectHandler > ObjectHandlersList
Parameters list to pass to call() or to functions that create collections.
Definition: Python.h:178
PyObject * ObjectPointer
Pointer to scope objects (either imported modules or instances of a class) or callable objects (funct...
Definition: Python.h:180
void beginCriticalSection()
Enters a critical section, preventing other threads from entering any Python critical section.
void addList(ObjectHandler list, ObjectHandler item, bool keepArg=false)
Adds an item to the end of a list.
ObjectHandler const & object(ObjectPointer scope, std::string const &objectName)
Retrieves an object by its name from a scope pointer.
std::vector< RawCode > Program
Complete program.
Definition: Python.h:183
std::string RawCode
Plain Python code.
Definition: Python.h:182
ObjectHandler fromAscii(std::string const &str)
Converts a string to a UTF-8 CPython string object.
std::vector< std::string > PathEntriesList
Path, as a vector of strings.
Definition: Python.h:177
const std::string moduleBuiltins
Built-ins module ("builtins").
ObjectHandler const & controlArgument(ObjectHandler object)
Places an CPython object under control of Python.
void execute(RawCode const &code)
Executes raw code.
const std::string moduleMain
Main module ("__main__").
void init(std::string const &programName, PathEntriesList const &pythonSysPath=PathEntriesList())
Initializes Python.
ObjectHandler const & call(ObjectPointer callableObject, ObjectHandlersList const &args={}, bool keepArguments=false)
Calls a callable with the given arguments.
void shutdown()
Shuts down Python.
ObjectHandler tuple(ObjectHandlersList const &args={}, bool keepArguments=false)
Creates a tuple object initialized with the given arguments.