Skip to content

Class jac::StringView

ClassList > jac > StringView

A wrapper around QuickJS C-string with automatic memory management.

  • #include <stringView.h>

Inherits the following classes: std::basic_string_view< char >

Public Functions

Type Name
StringView (StringView && other)
StringView () = default
StringView (ContextRef ctx, const char * str)
Wrap a QuickJS allocated string. The string will be freed when the StringView is freed.
const char * c_str () const
Get the C string.
string () const
StringView & operator= (StringView && other)
~StringView ()

Public Functions Documentation

function StringView [3/5]

inline jac::StringView::StringView (
    StringView && other
) 

function StringView [4/5]

jac::StringView::StringView () = default

function StringView [5/5]

Wrap a QuickJS allocated string. The string will be freed when the StringView is freed.

inline jac::StringView::StringView (
    ContextRef ctx,
    const char * str
) 

Note:

The string must be allocated using QuickJS functions - JS_NewString, JS_ToCString, etc.

Parameters:

  • ctx context to work in
  • str string to wrap

function c_str

Get the C string.

inline const char * jac::StringView::c_str () const

Returns:

const char*

function string

inline jac::StringView::string () const

function operator=

inline StringView & jac::StringView::operator= (
    StringView && other
) 

function ~StringView

inline jac::StringView::~StringView () 

The documentation for this class was generated from the following file src/jac/machine/stringView.h