yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::api::HttpServer Class Reference

#include <http_server.h>

Collaboration diagram for yaze::cli::api::HttpServer:

Public Types

using SymbolProviderSource = std::function<emu::debug::SymbolProvider*()>
 
using RenderServiceSource = std::function<app::service::RenderService*()>
 
using RomSource = std::function<Rom*()>
 
using ProjectPathSource = std::function<std::string()>
 
using WindowAction = std::function<bool()>
 
using EditorControl
 

Public Member Functions

void SetEditorControl (EditorControl control)
 
 HttpServer ()
 
 ~HttpServer ()
 
absl::Status Start (int port, bool loopback_only=false)
 
void SetBindAddress (std::string address)
 
void SetCommandExecutionEnabled (bool enabled)
 
void Stop ()
 
bool IsRunning () const
 
void SetSymbolProviderSource (SymbolProviderSource source)
 
void SetRenderServiceSource (RenderServiceSource source)
 
void SetRomSource (RomSource source)
 
void SetProjectPathSource (ProjectPathSource source)
 
int port () const
 
void SetWindowActions (WindowAction show, WindowAction hide)
 
SymbolProviderSource GetSymbolSource () const
 
BonjourPublisher & GetBonjourPublisher ()
 

Private Member Functions

void RunServer (int port)
 
void RegisterRoutes ()
 

Private Attributes

std::unique_ptr< httplib::Server > server_
 
std::unique_ptr< std::thread > server_thread_
 
std::atomic< bool > is_running_ {false}
 
int port_ = 0
 
bool editor_control_only_ = false
 
std::string bind_address_ = "0.0.0.0"
 
bool command_execution_enabled_ = true
 
BonjourPublisher bonjour_
 
SymbolProviderSource symbol_source_
 
RenderServiceSource render_source_
 
RomSource rom_source_
 
ProjectPathSource project_path_source_
 
WindowAction window_show_
 
WindowAction window_hide_
 
EditorControl editor_control_
 

Detailed Description

Definition at line 38 of file http_server.h.

Member Typedef Documentation

◆ SymbolProviderSource

◆ RenderServiceSource

◆ RomSource

using yaze::cli::api::HttpServer::RomSource = std::function<Rom*()>

Definition at line 42 of file http_server.h.

◆ ProjectPathSource

using yaze::cli::api::HttpServer::ProjectPathSource = std::function<std::string()>

Definition at line 43 of file http_server.h.

◆ WindowAction

using yaze::cli::api::HttpServer::WindowAction = std::function<bool()>

Definition at line 44 of file http_server.h.

◆ EditorControl

Initial value:
std::function<absl::StatusOr<std::string>(const std::string&)>

Definition at line 45 of file http_server.h.

Constructor & Destructor Documentation

◆ HttpServer()

yaze::cli::api::HttpServer::HttpServer ( )

Definition at line 14 of file http_server.cc.

◆ ~HttpServer()

yaze::cli::api::HttpServer::~HttpServer ( )

Definition at line 16 of file http_server.cc.

References Stop().

Here is the call graph for this function:

Member Function Documentation

◆ SetEditorControl()

void yaze::cli::api::HttpServer::SetEditorControl ( EditorControl control)
inline

Definition at line 47 of file http_server.h.

References editor_control_.

◆ Start()

◆ SetBindAddress()

void yaze::cli::api::HttpServer::SetBindAddress ( std::string address)
inline

Definition at line 59 of file http_server.h.

References bind_address_.

◆ SetCommandExecutionEnabled()

void yaze::cli::api::HttpServer::SetCommandExecutionEnabled ( bool enabled)
inline

Definition at line 65 of file http_server.h.

References command_execution_enabled_.

◆ Stop()

void yaze::cli::api::HttpServer::Stop ( )

Definition at line 68 of file http_server.cc.

References bonjour_, is_running_, server_, server_thread_, and yaze::cli::api::BonjourPublisher::Unpublish().

Referenced by ~HttpServer().

Here is the call graph for this function:

◆ IsRunning()

bool yaze::cli::api::HttpServer::IsRunning ( ) const

Definition at line 77 of file http_server.cc.

References is_running_.

◆ SetSymbolProviderSource()

void yaze::cli::api::HttpServer::SetSymbolProviderSource ( SymbolProviderSource source)
inline

Definition at line 76 of file http_server.h.

References symbol_source_.

◆ SetRenderServiceSource()

void yaze::cli::api::HttpServer::SetRenderServiceSource ( RenderServiceSource source)
inline

Definition at line 81 of file http_server.h.

References render_source_.

◆ SetRomSource()

void yaze::cli::api::HttpServer::SetRomSource ( RomSource source)
inline

Definition at line 86 of file http_server.h.

References rom_source_.

◆ SetProjectPathSource()

void yaze::cli::api::HttpServer::SetProjectPathSource ( ProjectPathSource source)
inline

Definition at line 89 of file http_server.h.

References project_path_source_.

◆ port()

int yaze::cli::api::HttpServer::port ( ) const
inline

Definition at line 94 of file http_server.h.

References port_.

Referenced by Start().

◆ SetWindowActions()

void yaze::cli::api::HttpServer::SetWindowActions ( WindowAction show,
WindowAction hide )
inline

Definition at line 97 of file http_server.h.

References window_hide_, and window_show_.

◆ GetSymbolSource()

SymbolProviderSource yaze::cli::api::HttpServer::GetSymbolSource ( ) const
inline

Definition at line 103 of file http_server.h.

References symbol_source_.

◆ GetBonjourPublisher()

BonjourPublisher & yaze::cli::api::HttpServer::GetBonjourPublisher ( )
inline

Definition at line 106 of file http_server.h.

References bonjour_.

◆ RunServer()

void yaze::cli::api::HttpServer::RunServer ( int port)
private

◆ RegisterRoutes()

Member Data Documentation

◆ server_

std::unique_ptr<httplib::Server> yaze::cli::api::HttpServer::server_
private

Definition at line 112 of file http_server.h.

Referenced by RegisterRoutes(), Start(), and Stop().

◆ server_thread_

std::unique_ptr<std::thread> yaze::cli::api::HttpServer::server_thread_
private

Definition at line 113 of file http_server.h.

Referenced by Start(), and Stop().

◆ is_running_

std::atomic<bool> yaze::cli::api::HttpServer::is_running_ {false}
private

Definition at line 114 of file http_server.h.

Referenced by IsRunning(), Start(), and Stop().

◆ port_

int yaze::cli::api::HttpServer::port_ = 0
private

Definition at line 115 of file http_server.h.

Referenced by port(), and Start().

◆ editor_control_only_

bool yaze::cli::api::HttpServer::editor_control_only_ = false
private

Definition at line 116 of file http_server.h.

Referenced by RegisterRoutes(), and Start().

◆ bind_address_

std::string yaze::cli::api::HttpServer::bind_address_ = "0.0.0.0"
private

Definition at line 117 of file http_server.h.

Referenced by SetBindAddress(), and Start().

◆ command_execution_enabled_

bool yaze::cli::api::HttpServer::command_execution_enabled_ = true
private

Definition at line 118 of file http_server.h.

Referenced by RegisterRoutes(), and SetCommandExecutionEnabled().

◆ bonjour_

BonjourPublisher yaze::cli::api::HttpServer::bonjour_
private

Definition at line 119 of file http_server.h.

Referenced by GetBonjourPublisher(), RegisterRoutes(), Start(), and Stop().

◆ symbol_source_

SymbolProviderSource yaze::cli::api::HttpServer::symbol_source_
private

Definition at line 120 of file http_server.h.

Referenced by GetSymbolSource(), RegisterRoutes(), and SetSymbolProviderSource().

◆ render_source_

RenderServiceSource yaze::cli::api::HttpServer::render_source_
private

Definition at line 121 of file http_server.h.

Referenced by RegisterRoutes(), and SetRenderServiceSource().

◆ rom_source_

RomSource yaze::cli::api::HttpServer::rom_source_
private

Definition at line 122 of file http_server.h.

Referenced by RegisterRoutes(), and SetRomSource().

◆ project_path_source_

ProjectPathSource yaze::cli::api::HttpServer::project_path_source_
private

Definition at line 123 of file http_server.h.

Referenced by RegisterRoutes(), and SetProjectPathSource().

◆ window_show_

WindowAction yaze::cli::api::HttpServer::window_show_
private

Definition at line 124 of file http_server.h.

Referenced by RegisterRoutes(), and SetWindowActions().

◆ window_hide_

WindowAction yaze::cli::api::HttpServer::window_hide_
private

Definition at line 125 of file http_server.h.

Referenced by RegisterRoutes(), and SetWindowActions().

◆ editor_control_

EditorControl yaze::cli::api::HttpServer::editor_control_
private

Definition at line 126 of file http_server.h.

Referenced by RegisterRoutes(), SetEditorControl(), and Start().


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