irccd  3.0.3
Public Member Functions | List of all members
irccd::js::duk::stack_guard Class Reference

Stack sanity checker. More...

#include <duk.hpp>

Public Member Functions

 stack_guard (duk_context *ctx, unsigned expected=0) noexcept
 
 ~stack_guard () noexcept
 

Detailed Description

Stack sanity checker.

Instanciate this class where you need to manipulate the Duktape stack outside a Duktape/C function, its destructor will examinate if the stack size matches the user expected size.

When compiled with NDEBUG, this class does nothing.

To use it, just declare an lvalue at the beginning of your function.

Constructor & Destructor Documentation

◆ stack_guard()

irccd::js::duk::stack_guard::stack_guard ( duk_context *  ctx,
unsigned  expected = 0 
)
noexcept

Create the stack checker.

No-op if NDEBUG is set.

Parameters
ctxthe context
expectedthe size expected relative to the already existing values

◆ ~stack_guard()

irccd::js::duk::stack_guard::~stack_guard ( )
noexcept

Verify the expected size.

No-op if NDEBUG is set.


The documentation for this class was generated from the following file: