ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
pagination_context Class Reference

Manages pagination state across shell commands. More...

#include <pagination_context.hpp>

Collaboration diagram for pagination_context:
Collaboration graph

Public Member Functions

std::uint32_t page_size () const
 Get the current page size.
 
void set_page_size (std::uint32_t size)
 Set the page size.
 
entity_page_statestate_for (const std::string &entity_name)
 Get or create pagination state for an entity.
 
const std::string & last_entity () const
 Get the last entity that was listed.
 
void set_last_entity (const std::string &name)
 Set the last entity that was listed.
 
void register_list_callback (const std::string &entity_name, list_callback callback)
 Register a callback for listing an entity.
 
const list_callbackget_list_callback (const std::string &entity_name) const
 Get the list callback for an entity.
 

Detailed Description

Manages pagination state across shell commands.

Tracks per-entity pagination state (offset, total count) and maintains a registry of callbacks to re-invoke list commands during navigation.

Member Function Documentation

◆ page_size()

std::uint32_t page_size ( ) const

Get the current page size.

Returns
The number of records per page.
Here is the caller graph for this function:

◆ set_page_size()

void set_page_size ( std::uint32_t  size)

Set the page size.

Parameters
sizeThe number of records per page.
Here is the caller graph for this function:

◆ state_for()

entity_page_state & state_for ( const std::string &  entity_name)

Get or create pagination state for an entity.

Parameters
entity_nameThe name of the entity (e.g., "currencies").
Returns
Reference to the entity's pagination state.
Here is the caller graph for this function:

◆ last_entity()

const std::string & last_entity ( ) const

Get the last entity that was listed.

Returns
The name of the last listed entity.
Here is the caller graph for this function:

◆ set_last_entity()

void set_last_entity ( const std::string &  name)

Set the last entity that was listed.

Parameters
nameThe name of the entity.
Here is the caller graph for this function:

◆ register_list_callback()

void register_list_callback ( const std::string &  entity_name,
list_callback  callback 
)

Register a callback for listing an entity.

Parameters
entity_nameThe name of the entity.
callbackThe callback to invoke for listing.
Here is the caller graph for this function:

◆ get_list_callback()

const list_callback * get_list_callback ( const std::string &  entity_name) const

Get the list callback for an entity.

Parameters
entity_nameThe name of the entity.
Returns
Pointer to the callback, or nullptr if not registered.
Here is the caller graph for this function: