LibraryInterface Class Reference

#include <vm.h>

Inheritance diagram for LibraryInterface:

Detailed Description

A helper interface with convenient functions, which are needed when dealing with other interfaces in this framework

Static Public Member Functions

static MAXON_METHOD Bool ConsoleIsAvailable ()
 
static MAXON_METHOD Result< StringGetFileContent (const Url &filepath)
 
static MAXON_METHOD Result< void > SetFileContent (const Url &filepath, const String &str, Bool append)
 

Private Member Functions

 MAXON_INTERFACE (LibraryInterface, MAXON_REFERENCE_NORMAL, "net.maxon.python.interface.library")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( LibraryInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.python.interface.library"   
)
private

◆ ConsoleIsAvailable()

static MAXON_METHOD Bool ConsoleIsAvailable ( )
static

Checks if a console is attached to the current process

Returns
True if a console is attached, otherwise False.

◆ GetFileContent()

static MAXON_METHOD Result<String> GetFileContent ( const Url filepath)
static

Returns the content of a given file in a string. The file is expected to be encoded in UTF-8.

Parameters
[in]filepathPath of the file.
Returns
Content of the file in a string, or returns an error if reading failed.

◆ SetFileContent()

static MAXON_METHOD Result<void> SetFileContent ( const Url filepath,
const String str,
Bool  append 
)
static

Writes the content of a string to a given file. The content will be encoded in UTF-8.

Parameters
[in]filepathPath of the file.
[in]strContent to write.
[in]appendTrue to append the content to the file, or False to overwrite the entire content with the new string.
Returns
Returns OK if the operation succeeded.