Lutok  0.4
 All Classes Namespaces Files Functions Variables Macros
Classes | Public Member Functions | Private Attributes
lutok::debug Class Reference

A model for the Lua debug state. More...

#include <debug.hpp>

List of all members.

Classes

struct  impl
 Internal implementation for lutok::debug. More...

Public Member Functions

 debug (void)
 Constructor for an empty debug structure.
 ~debug (void)
 Destructor.
void get_info (state &, const std::string &)
 Wrapper around lua_getinfo.
void get_stack (state &, const int)
 Wrapper around lua_getstack.
int event (void) const
 Accessor for the 'event' field of lua_Debug.
std::string name (void) const
 Accessor for the 'name' field of lua_Debug.
std::string name_what (void) const
 Accessor for the 'namewhat' field of lua_Debug.
std::string what (void) const
 Accessor for the 'what' field of lua_Debug.
std::string source (void) const
 Accessor for the 'source' field of lua_Debug.
int current_line (void) const
 Accessor for the 'currentline' field of lua_Debug.
int n_ups (void) const
 Accessor for the 'nups' field of lua_Debug.
int line_defined (void) const
 Accessor for the 'linedefined' field of lua_Debug.
int last_line_defined (void) const
 Accessor for the 'lastlinedefined' field of lua_Debug.
std::string short_src (void) const
 Accessor for the 'short_src' field of lua_Debug.

Private Attributes

std::tr1::shared_ptr< impl_pimpl
 Pointer to the shared internal implementation.

Detailed Description

A model for the Lua debug state.

This extremely-simple class provides a mechanism to hide the internals of the C native lua_Debug type, exposing its internal fields using friendlier C++ types.

This class also acts as a complement to the state class by exposing any state-related functions as methods of this function. For example, while it might seem that get_info() belongs in state, we expose it from here because its result is really mutating a debug object, not the state object.


Member Function Documentation

int lutok::debug::current_line ( void  ) const

Accessor for the 'currentline' field of lua_Debug.

Returns:
Returns the 'currentline' field of the internal lua_Debug structure.
int lutok::debug::event ( void  ) const

Accessor for the 'event' field of lua_Debug.

Returns:
Returns the 'event' field of the internal lua_Debug structure.
void lutok::debug::get_info ( state s,
const std::string &  what_ 
)

Wrapper around lua_getinfo.

Parameters:
sThe Lua state.
what_The second parameter to lua_getinfo.
Warning:
Terminates execution if there is not enough memory to manipulate the Lua stack.
void lutok::debug::get_stack ( state s,
const int  level 
)

Wrapper around lua_getstack.

Parameters:
sThe Lua state.
levelThe second parameter to lua_getstack.
int lutok::debug::last_line_defined ( void  ) const

Accessor for the 'lastlinedefined' field of lua_Debug.

Returns:
Returns the 'lastlinedefined' field of the internal lua_Debug structure.
int lutok::debug::line_defined ( void  ) const

Accessor for the 'linedefined' field of lua_Debug.

Returns:
Returns the 'linedefined' field of the internal lua_Debug structure.
int lutok::debug::n_ups ( void  ) const

Accessor for the 'nups' field of lua_Debug.

Returns:
Returns the 'nups' field of the internal lua_Debug structure.
std::string lutok::debug::name ( void  ) const

Accessor for the 'name' field of lua_Debug.

Returns:
Returns the 'name' field of the internal lua_Debug structure.
std::string lutok::debug::name_what ( void  ) const

Accessor for the 'namewhat' field of lua_Debug.

Returns:
Returns the 'namewhat' field of the internal lua_Debug structure.
std::string lutok::debug::short_src ( void  ) const

Accessor for the 'short_src' field of lua_Debug.

Returns:
Returns the 'short_src' field of the internal lua_Debug structure.
std::string lutok::debug::source ( void  ) const

Accessor for the 'source' field of lua_Debug.

Returns:
Returns the 'source' field of the internal lua_Debug structure.
std::string lutok::debug::what ( void  ) const

Accessor for the 'what' field of lua_Debug.

Returns:
Returns the 'what' field of the internal lua_Debug structure.

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