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

Utility for consistent output formatting across commands. More...

#include <command_context.h>

Public Types

enum class  Format { kJson , kText }
 

Public Member Functions

 OutputFormatter (Format format)
 
void BeginObject (const std::string &title="")
 Start a JSON object or text section.
 
void EndObject ()
 End a JSON object or text section.
 
void AddField (const std::string &key, const std::string &value)
 Add a key-value pair.
 
void AddField (const std::string &key, const char *value)
 
void AddField (const std::string &key, int value)
 
void AddField (const std::string &key, uint64_t value)
 
void AddField (const std::string &key, bool value)
 
void AddHexField (const std::string &key, uint64_t value, int width=2)
 Add a hex-formatted field.
 
void BeginArray (const std::string &key)
 Begin an array.
 
void EndArray ()
 End an array.
 
void AddArrayItem (const std::string &item)
 Add an item to current array.
 
std::string GetOutput () const
 Get the formatted output.
 
void Print () const
 Print the formatted output to stdout.
 
bool IsJson () const
 Check if using JSON format.
 
bool IsText () const
 Check if using text format.
 

Static Public Member Functions

static absl::StatusOr< OutputFormatterFromString (const std::string &format)
 Create formatter from string ("json" or "text")
 

Private Member Functions

void AddIndent ()
 
std::string EscapeJson (const std::string &str) const
 

Private Attributes

Format format_
 
std::string buffer_
 
int indent_level_ = 0
 
bool first_field_ = true
 
bool in_array_ = false
 
int array_item_count_ = 0
 

Detailed Description

Utility for consistent output formatting across commands.

Definition at line 122 of file command_context.h.

Member Enumeration Documentation

◆ Format

Enumerator
kJson 
kText 

Definition at line 124 of file command_context.h.

Constructor & Destructor Documentation

◆ OutputFormatter()

yaze::cli::resources::OutputFormatter::OutputFormatter ( Format format)
inlineexplicit

Definition at line 126 of file command_context.h.

Referenced by FromString().

Member Function Documentation

◆ FromString()

absl::StatusOr< OutputFormatter > yaze::cli::resources::OutputFormatter::FromString ( const std::string & format)
static

Create formatter from string ("json" or "text")

Definition at line 250 of file command_context.cc.

References kJson, kText, and OutputFormatter().

Referenced by yaze::cli::resources::CommandHandler::Run().

Here is the call graph for this function:

◆ BeginObject()

void yaze::cli::resources::OutputFormatter::BeginObject ( const std::string & title = "")

Start a JSON object or text section.

Definition at line 263 of file command_context.cc.

References buffer_, first_field_, indent_level_, IsJson(), and IsText().

Referenced by yaze::cli::handlers::DialogueListCommandHandler::Execute(), yaze::cli::handlers::DialogueReadCommandHandler::Execute(), yaze::cli::handlers::DialogueSearchCommandHandler::Execute(), yaze::cli::handlers::DungeonListSpritesCommandHandler::Execute(), yaze::cli::handlers::DungeonDescribeRoomCommandHandler::Execute(), yaze::cli::handlers::DungeonExportRoomCommandHandler::Execute(), yaze::cli::handlers::DungeonListObjectsCommandHandler::Execute(), yaze::cli::handlers::DungeonGetRoomTilesCommandHandler::Execute(), yaze::cli::handlers::DungeonSetRoomPropertyCommandHandler::Execute(), yaze::cli::handlers::MessageListCommandHandler::Execute(), yaze::cli::handlers::MessageReadCommandHandler::Execute(), yaze::cli::handlers::MessageSearchCommandHandler::Execute(), yaze::cli::handlers::MusicListCommandHandler::Execute(), yaze::cli::handlers::MusicInfoCommandHandler::Execute(), yaze::cli::handlers::MusicTracksCommandHandler::Execute(), yaze::cli::handlers::OverworldFindTileCommandHandler::Execute(), yaze::cli::handlers::OverworldDescribeMapCommandHandler::Execute(), yaze::cli::handlers::OverworldListWarpsCommandHandler::Execute(), yaze::cli::handlers::OverworldListSpritesCommandHandler::Execute(), yaze::cli::handlers::OverworldGetEntranceCommandHandler::Execute(), yaze::cli::handlers::OverworldTileStatsCommandHandler::Execute(), yaze::cli::handlers::HexReadCommandHandler::Execute(), yaze::cli::handlers::HexWriteCommandHandler::Execute(), yaze::cli::handlers::HexSearchCommandHandler::Execute(), yaze::cli::handlers::PaletteGetColorsCommandHandler::Execute(), yaze::cli::handlers::PaletteSetColorCommandHandler::Execute(), yaze::cli::handlers::PaletteAnalyzeCommandHandler::Execute(), yaze::cli::handlers::SpriteListCommandHandler::Execute(), yaze::cli::handlers::SpritePropertiesCommandHandler::Execute(), yaze::cli::handlers::SpritePaletteCommandHandler::Execute(), yaze::cli::handlers::EmulatorStepCommandHandler::Execute(), yaze::cli::handlers::EmulatorRunCommandHandler::Execute(), yaze::cli::handlers::EmulatorPauseCommandHandler::Execute(), yaze::cli::handlers::EmulatorResetCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetStateCommandHandler::Execute(), yaze::cli::handlers::EmulatorSetBreakpointCommandHandler::Execute(), yaze::cli::handlers::EmulatorClearBreakpointCommandHandler::Execute(), yaze::cli::handlers::EmulatorListBreakpointsCommandHandler::Execute(), yaze::cli::handlers::EmulatorReadMemoryCommandHandler::Execute(), yaze::cli::handlers::EmulatorWriteMemoryCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetRegistersCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetMetricsCommandHandler::Execute(), yaze::cli::handlers::EmulatorPressButtonsCommandHandler::Execute(), yaze::cli::handlers::EmulatorReleaseButtonsCommandHandler::Execute(), yaze::cli::handlers::EmulatorHoldButtonsCommandHandler::Execute(), yaze::cli::handlers::GuiPlaceTileCommandHandler::Execute(), yaze::cli::handlers::GuiClickCommandHandler::Execute(), yaze::cli::handlers::GuiDiscoverToolCommandHandler::Execute(), yaze::cli::handlers::GuiScreenshotCommandHandler::Execute(), yaze::cli::handlers::ResourceListCommandHandler::Execute(), yaze::cli::handlers::ResourceSearchCommandHandler::Execute(), yaze::cli::agent::tools::BuildConfigureCommandHandler::Execute(), yaze::cli::agent::tools::BuildCompileCommandHandler::Execute(), yaze::cli::agent::tools::BuildTestCommandHandler::Execute(), yaze::cli::agent::tools::BuildStatusCommandHandler::Execute(), yaze::cli::agent::tools::FileSystemListTool::Execute(), yaze::cli::agent::tools::FileSystemReadTool::Execute(), yaze::cli::agent::tools::FileSystemExistsTool::Execute(), yaze::cli::agent::tools::FileSystemInfoTool::Execute(), yaze::cli::agent::tools::MemoryAnalyzeTool::Execute(), yaze::cli::agent::tools::MemorySearchTool::Execute(), yaze::cli::agent::tools::MemoryCompareTool::Execute(), yaze::cli::agent::tools::MemoryCheckTool::Execute(), yaze::cli::agent::tools::MemoryRegionsTool::Execute(), yaze::cli::agent::tools::ProjectStatusTool::Execute(), yaze::cli::agent::tools::ProjectSnapshotTool::Execute(), yaze::cli::agent::tools::ProjectRestoreTool::Execute(), yaze::cli::agent::tools::ProjectExportTool::Execute(), yaze::cli::agent::tools::ProjectImportTool::Execute(), yaze::cli::agent::tools::ProjectDiffTool::Execute(), yaze::cli::agent::tools::ProjectGraphTool::GetFileStructure(), yaze::cli::agent::tools::ProjectGraphTool::GetSymbolTable(), and yaze::cli::resources::CommandHandler::Run().

Here is the call graph for this function:

◆ EndObject()

void yaze::cli::resources::OutputFormatter::EndObject ( )

End a JSON object or text section.

Definition at line 273 of file command_context.cc.

References AddIndent(), buffer_, first_field_, indent_level_, and IsJson().

Referenced by yaze::cli::handlers::DialogueListCommandHandler::Execute(), yaze::cli::handlers::DialogueReadCommandHandler::Execute(), yaze::cli::handlers::DialogueSearchCommandHandler::Execute(), yaze::cli::handlers::DungeonListSpritesCommandHandler::Execute(), yaze::cli::handlers::DungeonDescribeRoomCommandHandler::Execute(), yaze::cli::handlers::DungeonExportRoomCommandHandler::Execute(), yaze::cli::handlers::DungeonListObjectsCommandHandler::Execute(), yaze::cli::handlers::DungeonGetRoomTilesCommandHandler::Execute(), yaze::cli::handlers::DungeonSetRoomPropertyCommandHandler::Execute(), yaze::cli::handlers::MessageListCommandHandler::Execute(), yaze::cli::handlers::MessageReadCommandHandler::Execute(), yaze::cli::handlers::MessageSearchCommandHandler::Execute(), yaze::cli::handlers::MusicListCommandHandler::Execute(), yaze::cli::handlers::MusicInfoCommandHandler::Execute(), yaze::cli::handlers::MusicTracksCommandHandler::Execute(), yaze::cli::handlers::OverworldFindTileCommandHandler::Execute(), yaze::cli::handlers::OverworldDescribeMapCommandHandler::Execute(), yaze::cli::handlers::OverworldListWarpsCommandHandler::Execute(), yaze::cli::handlers::OverworldListSpritesCommandHandler::Execute(), yaze::cli::handlers::OverworldGetEntranceCommandHandler::Execute(), yaze::cli::handlers::OverworldTileStatsCommandHandler::Execute(), yaze::cli::handlers::HexReadCommandHandler::Execute(), yaze::cli::handlers::HexWriteCommandHandler::Execute(), yaze::cli::handlers::HexSearchCommandHandler::Execute(), yaze::cli::handlers::PaletteGetColorsCommandHandler::Execute(), yaze::cli::handlers::PaletteSetColorCommandHandler::Execute(), yaze::cli::handlers::PaletteAnalyzeCommandHandler::Execute(), yaze::cli::handlers::SpriteListCommandHandler::Execute(), yaze::cli::handlers::SpritePropertiesCommandHandler::Execute(), yaze::cli::handlers::SpritePaletteCommandHandler::Execute(), yaze::cli::handlers::EmulatorStepCommandHandler::Execute(), yaze::cli::handlers::EmulatorRunCommandHandler::Execute(), yaze::cli::handlers::EmulatorPauseCommandHandler::Execute(), yaze::cli::handlers::EmulatorResetCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetStateCommandHandler::Execute(), yaze::cli::handlers::EmulatorSetBreakpointCommandHandler::Execute(), yaze::cli::handlers::EmulatorClearBreakpointCommandHandler::Execute(), yaze::cli::handlers::EmulatorListBreakpointsCommandHandler::Execute(), yaze::cli::handlers::EmulatorReadMemoryCommandHandler::Execute(), yaze::cli::handlers::EmulatorWriteMemoryCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetRegistersCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetMetricsCommandHandler::Execute(), yaze::cli::handlers::EmulatorPressButtonsCommandHandler::Execute(), yaze::cli::handlers::EmulatorReleaseButtonsCommandHandler::Execute(), yaze::cli::handlers::EmulatorHoldButtonsCommandHandler::Execute(), yaze::cli::handlers::GuiPlaceTileCommandHandler::Execute(), yaze::cli::handlers::GuiClickCommandHandler::Execute(), yaze::cli::handlers::GuiDiscoverToolCommandHandler::Execute(), yaze::cli::handlers::GuiScreenshotCommandHandler::Execute(), yaze::cli::handlers::ResourceListCommandHandler::Execute(), yaze::cli::handlers::ResourceSearchCommandHandler::Execute(), yaze::cli::agent::tools::BuildConfigureCommandHandler::Execute(), yaze::cli::agent::tools::BuildCompileCommandHandler::Execute(), yaze::cli::agent::tools::BuildTestCommandHandler::Execute(), yaze::cli::agent::tools::BuildStatusCommandHandler::Execute(), yaze::cli::agent::tools::FileSystemReadTool::Execute(), yaze::cli::agent::tools::FileSystemExistsTool::Execute(), yaze::cli::agent::tools::FileSystemInfoTool::Execute(), yaze::cli::agent::tools::MemoryAnalyzeTool::Execute(), yaze::cli::agent::tools::MemorySearchTool::Execute(), yaze::cli::agent::tools::MemoryCompareTool::Execute(), yaze::cli::agent::tools::MemoryCheckTool::Execute(), yaze::cli::agent::tools::MemoryRegionsTool::Execute(), yaze::cli::agent::tools::ProjectStatusTool::Execute(), yaze::cli::agent::tools::ProjectSnapshotTool::Execute(), yaze::cli::agent::tools::ProjectRestoreTool::Execute(), yaze::cli::agent::tools::ProjectExportTool::Execute(), yaze::cli::agent::tools::ProjectImportTool::Execute(), yaze::cli::agent::tools::ProjectDiffTool::Execute(), yaze::cli::agent::tools::ProjectGraphTool::GetFileStructure(), yaze::cli::agent::tools::ProjectGraphTool::GetSymbolTable(), and yaze::cli::resources::CommandHandler::Run().

Here is the call graph for this function:

◆ AddField() [1/5]

void yaze::cli::resources::OutputFormatter::AddField ( const std::string & key,
const std::string & value )

Add a key-value pair.

Definition at line 289 of file command_context.cc.

References AddIndent(), buffer_, EscapeJson(), first_field_, and IsJson().

Referenced by AddField(), yaze::cli::MessageDoctorCommandHandler::Execute(), yaze::cli::handlers::SimpleChatCommandHandler::Execute(), yaze::cli::handlers::DialogueListCommandHandler::Execute(), yaze::cli::handlers::DialogueReadCommandHandler::Execute(), yaze::cli::handlers::DialogueSearchCommandHandler::Execute(), yaze::cli::handlers::DungeonListSpritesCommandHandler::Execute(), yaze::cli::handlers::DungeonDescribeRoomCommandHandler::Execute(), yaze::cli::handlers::DungeonExportRoomCommandHandler::Execute(), yaze::cli::handlers::DungeonListObjectsCommandHandler::Execute(), yaze::cli::handlers::DungeonGetRoomTilesCommandHandler::Execute(), yaze::cli::handlers::DungeonSetRoomPropertyCommandHandler::Execute(), yaze::cli::handlers::MessageListCommandHandler::Execute(), yaze::cli::handlers::MessageReadCommandHandler::Execute(), yaze::cli::handlers::MessageSearchCommandHandler::Execute(), yaze::cli::handlers::MusicListCommandHandler::Execute(), yaze::cli::handlers::MusicInfoCommandHandler::Execute(), yaze::cli::handlers::MusicTracksCommandHandler::Execute(), yaze::cli::handlers::OverworldFindTileCommandHandler::Execute(), yaze::cli::handlers::OverworldDescribeMapCommandHandler::Execute(), yaze::cli::handlers::OverworldListWarpsCommandHandler::Execute(), yaze::cli::handlers::OverworldListSpritesCommandHandler::Execute(), yaze::cli::handlers::OverworldGetEntranceCommandHandler::Execute(), yaze::cli::handlers::OverworldTileStatsCommandHandler::Execute(), yaze::cli::handlers::HexReadCommandHandler::Execute(), yaze::cli::handlers::HexWriteCommandHandler::Execute(), yaze::cli::handlers::HexSearchCommandHandler::Execute(), yaze::cli::handlers::PaletteGetColorsCommandHandler::Execute(), yaze::cli::handlers::PaletteSetColorCommandHandler::Execute(), yaze::cli::handlers::PaletteAnalyzeCommandHandler::Execute(), yaze::cli::handlers::SpriteListCommandHandler::Execute(), yaze::cli::handlers::SpritePropertiesCommandHandler::Execute(), yaze::cli::handlers::SpritePaletteCommandHandler::Execute(), yaze::cli::handlers::ProjectInitCommandHandler::Execute(), yaze::cli::handlers::ProjectBuildCommandHandler::Execute(), yaze::cli::handlers::RomInfoCommandHandler::Execute(), yaze::cli::handlers::RomValidateCommandHandler::Execute(), yaze::cli::handlers::RomDiffCommandHandler::Execute(), yaze::cli::handlers::RomGenerateGoldenCommandHandler::Execute(), yaze::cli::DungeonDoctorCommandHandler::Execute(), yaze::cli::handlers::EmulatorStepCommandHandler::Execute(), yaze::cli::handlers::EmulatorRunCommandHandler::Execute(), yaze::cli::handlers::EmulatorPauseCommandHandler::Execute(), yaze::cli::handlers::EmulatorResetCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetStateCommandHandler::Execute(), yaze::cli::handlers::EmulatorSetBreakpointCommandHandler::Execute(), yaze::cli::handlers::EmulatorClearBreakpointCommandHandler::Execute(), yaze::cli::handlers::EmulatorListBreakpointsCommandHandler::Execute(), yaze::cli::handlers::EmulatorReadMemoryCommandHandler::Execute(), yaze::cli::handlers::EmulatorWriteMemoryCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetRegistersCommandHandler::Execute(), yaze::cli::handlers::EmulatorGetMetricsCommandHandler::Execute(), yaze::cli::handlers::EmulatorPressButtonsCommandHandler::Execute(), yaze::cli::handlers::EmulatorReleaseButtonsCommandHandler::Execute(), yaze::cli::handlers::EmulatorHoldButtonsCommandHandler::Execute(), yaze::cli::GraphicsDoctorCommandHandler::Execute(), yaze::cli::handlers::GuiPlaceTileCommandHandler::Execute(), yaze::cli::handlers::GuiClickCommandHandler::Execute(), yaze::cli::handlers::GuiDiscoverToolCommandHandler::Execute(), yaze::cli::handlers::GuiScreenshotCommandHandler::Execute(), yaze::cli::HexCompareCommandHandler::Execute(), yaze::cli::HexAnnotateCommandHandler::Execute(), yaze::cli::OverworldDoctorCommandHandler::Execute(), yaze::cli::OverworldValidateCommandHandler::Execute(), yaze::cli::handlers::ResourceListCommandHandler::Execute(), yaze::cli::handlers::ResourceSearchCommandHandler::Execute(), yaze::cli::RomCompareCommandHandler::Execute(), yaze::cli::RomDoctorCommandHandler::Execute(), yaze::cli::SpriteDoctorCommandHandler::Execute(), yaze::cli::TestListCommandHandler::Execute(), yaze::cli::TestRunCommandHandler::Execute(), yaze::cli::TestStatusCommandHandler::Execute(), yaze::cli::handlers::ToolsHarnessStateCommandHandler::Execute(), yaze::cli::handlers::ToolsExtractValuesCommandHandler::Execute(), yaze::cli::handlers::ToolsExtractGoldenCommandHandler::Execute(), yaze::cli::handlers::ToolsPatchV3CommandHandler::Execute(), yaze::cli::handlers::ToolsListCommandHandler::Execute(), yaze::cli::agent::tools::BuildConfigureCommandHandler::Execute(), yaze::cli::agent::tools::BuildCompileCommandHandler::Execute(), yaze::cli::agent::tools::BuildTestCommandHandler::Execute(), yaze::cli::agent::tools::BuildStatusCommandHandler::Execute(), yaze::cli::agent::tools::FileSystemListTool::Execute(), yaze::cli::agent::tools::FileSystemReadTool::Execute(), yaze::cli::agent::tools::FileSystemExistsTool::Execute(), yaze::cli::agent::tools::FileSystemInfoTool::Execute(), yaze::cli::agent::tools::MemoryAnalyzeTool::Execute(), yaze::cli::agent::tools::MemorySearchTool::Execute(), yaze::cli::agent::tools::MemoryCompareTool::Execute(), yaze::cli::agent::tools::MemoryCheckTool::Execute(), yaze::cli::agent::tools::MemoryRegionsTool::Execute(), yaze::cli::agent::tools::ProjectStatusTool::Execute(), yaze::cli::agent::tools::ProjectSnapshotTool::Execute(), yaze::cli::agent::tools::ProjectRestoreTool::Execute(), yaze::cli::agent::tools::ProjectExportTool::Execute(), yaze::cli::agent::tools::ProjectImportTool::Execute(), yaze::cli::agent::tools::ProjectDiffTool::Execute(), yaze::cli::agent::tools::RomDiffTool::Execute(), yaze::cli::agent::tools::RomChangesTool::Execute(), yaze::cli::agent::tools::RomValidateTool::Execute(), yaze::cli::agent::tools::DataValidateTool::Execute(), yaze::cli::agent::tools::PatchCheckTool::Execute(), yaze::cli::agent::tools::ValidateAllTool::Execute(), yaze::cli::agent::tools::ProjectGraphTool::GetFileStructure(), yaze::cli::agent::tools::ProjectGraphTool::GetProjectInfo(), yaze::cli::agent::tools::ProjectGraphTool::GetSymbolTable(), yaze::cli::anonymous_namespace{overworld_doctor_commands.cc}::OutputFeaturesJson(), yaze::cli::anonymous_namespace{overworld_doctor_commands.cc}::OutputMapStatusJson(), yaze::cli::anonymous_namespace{rom_compare_commands.cc}::OutputRomInfoJson(), and yaze::cli::anonymous_namespace{overworld_doctor_commands.cc}::OutputSummaryJson().

Here is the call graph for this function:

◆ AddField() [2/5]

void yaze::cli::resources::OutputFormatter::AddField ( const std::string & key,
const char * value )

Definition at line 304 of file command_context.cc.

References AddField().

Here is the call graph for this function:

◆ AddField() [3/5]

void yaze::cli::resources::OutputFormatter::AddField ( const std::string & key,
int value )

Definition at line 308 of file command_context.cc.

References AddIndent(), buffer_, EscapeJson(), first_field_, and IsJson().

Here is the call graph for this function:

◆ AddField() [4/5]

void yaze::cli::resources::OutputFormatter::AddField ( const std::string & key,
uint64_t value )

Definition at line 321 of file command_context.cc.

References AddIndent(), buffer_, EscapeJson(), first_field_, and IsJson().

Here is the call graph for this function:

◆ AddField() [5/5]

void yaze::cli::resources::OutputFormatter::AddField ( const std::string & key,
bool value )

Definition at line 334 of file command_context.cc.

References AddIndent(), buffer_, EscapeJson(), first_field_, and IsJson().

Here is the call graph for this function:

◆ AddHexField()

◆ BeginArray()

void yaze::cli::resources::OutputFormatter::BeginArray ( const std::string & key)

Begin an array.

Definition at line 363 of file command_context.cc.

References AddIndent(), array_item_count_, buffer_, EscapeJson(), first_field_, in_array_, indent_level_, and IsJson().

Referenced by yaze::cli::MessageDoctorCommandHandler::Execute(), yaze::cli::handlers::DialogueListCommandHandler::Execute(), yaze::cli::handlers::DialogueSearchCommandHandler::Execute(), yaze::cli::handlers::DungeonListSpritesCommandHandler::Execute(), yaze::cli::handlers::DungeonListObjectsCommandHandler::Execute(), yaze::cli::handlers::DungeonGetRoomTilesCommandHandler::Execute(), yaze::cli::handlers::MessageListCommandHandler::Execute(), yaze::cli::handlers::MessageSearchCommandHandler::Execute(), yaze::cli::handlers::MusicListCommandHandler::Execute(), yaze::cli::handlers::MusicTracksCommandHandler::Execute(), yaze::cli::handlers::OverworldFindTileCommandHandler::Execute(), yaze::cli::handlers::OverworldDescribeMapCommandHandler::Execute(), yaze::cli::handlers::OverworldListWarpsCommandHandler::Execute(), yaze::cli::handlers::OverworldListSpritesCommandHandler::Execute(), yaze::cli::handlers::OverworldTileStatsCommandHandler::Execute(), yaze::cli::handlers::HexSearchCommandHandler::Execute(), yaze::cli::handlers::PaletteGetColorsCommandHandler::Execute(), yaze::cli::handlers::SpriteListCommandHandler::Execute(), yaze::cli::handlers::SpritePaletteCommandHandler::Execute(), yaze::cli::DungeonDoctorCommandHandler::Execute(), yaze::cli::GraphicsDoctorCommandHandler::Execute(), yaze::cli::handlers::GuiDiscoverToolCommandHandler::Execute(), yaze::cli::HexAnnotateCommandHandler::Execute(), yaze::cli::OverworldValidateCommandHandler::Execute(), yaze::cli::handlers::ResourceSearchCommandHandler::Execute(), yaze::cli::RomCompareCommandHandler::Execute(), yaze::cli::RomDoctorCommandHandler::Execute(), yaze::cli::SpriteDoctorCommandHandler::Execute(), yaze::cli::TestListCommandHandler::Execute(), yaze::cli::TestStatusCommandHandler::Execute(), yaze::cli::agent::tools::BuildStatusCommandHandler::Execute(), yaze::cli::agent::tools::FileSystemReadTool::Execute(), yaze::cli::agent::tools::MemoryRegionsTool::Execute(), yaze::cli::agent::tools::ProjectStatusTool::Execute(), yaze::cli::agent::tools::ProjectGraphTool::GetFileStructure(), yaze::cli::agent::tools::ProjectGraphTool::GetSymbolTable(), and yaze::cli::anonymous_namespace{overworld_doctor_commands.cc}::OutputFindingsJson().

Here is the call graph for this function:

◆ EndArray()

void yaze::cli::resources::OutputFormatter::EndArray ( )

End an array.

Definition at line 380 of file command_context.cc.

References AddIndent(), array_item_count_, buffer_, in_array_, indent_level_, and IsJson().

Referenced by yaze::cli::MessageDoctorCommandHandler::Execute(), yaze::cli::handlers::DialogueListCommandHandler::Execute(), yaze::cli::handlers::DialogueSearchCommandHandler::Execute(), yaze::cli::handlers::DungeonListSpritesCommandHandler::Execute(), yaze::cli::handlers::DungeonListObjectsCommandHandler::Execute(), yaze::cli::handlers::DungeonGetRoomTilesCommandHandler::Execute(), yaze::cli::handlers::MessageListCommandHandler::Execute(), yaze::cli::handlers::MessageSearchCommandHandler::Execute(), yaze::cli::handlers::MusicListCommandHandler::Execute(), yaze::cli::handlers::MusicTracksCommandHandler::Execute(), yaze::cli::handlers::OverworldFindTileCommandHandler::Execute(), yaze::cli::handlers::OverworldDescribeMapCommandHandler::Execute(), yaze::cli::handlers::OverworldListWarpsCommandHandler::Execute(), yaze::cli::handlers::OverworldListSpritesCommandHandler::Execute(), yaze::cli::handlers::OverworldTileStatsCommandHandler::Execute(), yaze::cli::handlers::HexSearchCommandHandler::Execute(), yaze::cli::handlers::PaletteGetColorsCommandHandler::Execute(), yaze::cli::handlers::SpriteListCommandHandler::Execute(), yaze::cli::handlers::SpritePaletteCommandHandler::Execute(), yaze::cli::DungeonDoctorCommandHandler::Execute(), yaze::cli::GraphicsDoctorCommandHandler::Execute(), yaze::cli::handlers::GuiDiscoverToolCommandHandler::Execute(), yaze::cli::HexAnnotateCommandHandler::Execute(), yaze::cli::OverworldValidateCommandHandler::Execute(), yaze::cli::handlers::ResourceSearchCommandHandler::Execute(), yaze::cli::RomCompareCommandHandler::Execute(), yaze::cli::RomDoctorCommandHandler::Execute(), yaze::cli::SpriteDoctorCommandHandler::Execute(), yaze::cli::TestListCommandHandler::Execute(), yaze::cli::TestStatusCommandHandler::Execute(), yaze::cli::agent::tools::BuildStatusCommandHandler::Execute(), yaze::cli::agent::tools::FileSystemReadTool::Execute(), yaze::cli::agent::tools::MemoryRegionsTool::Execute(), yaze::cli::agent::tools::ProjectStatusTool::Execute(), yaze::cli::agent::tools::ProjectGraphTool::GetFileStructure(), yaze::cli::agent::tools::ProjectGraphTool::GetSymbolTable(), and yaze::cli::anonymous_namespace{overworld_doctor_commands.cc}::OutputFindingsJson().

Here is the call graph for this function:

◆ AddArrayItem()

◆ GetOutput()

std::string yaze::cli::resources::OutputFormatter::GetOutput ( ) const

Get the formatted output.

Definition at line 411 of file command_context.cc.

References buffer_.

Referenced by yaze::cli::resources::CommandHandler::Run().

◆ Print()

void yaze::cli::resources::OutputFormatter::Print ( ) const

Print the formatted output to stdout.

Definition at line 415 of file command_context.cc.

References buffer_, and IsJson().

Referenced by yaze::cli::resources::CommandHandler::Run().

Here is the call graph for this function:

◆ IsJson()

◆ IsText()

bool yaze::cli::resources::OutputFormatter::IsText ( ) const
inline

Check if using text format.

Definition at line 190 of file command_context.h.

References format_, and kText.

Referenced by BeginObject().

◆ AddIndent()

void yaze::cli::resources::OutputFormatter::AddIndent ( )
private

◆ EscapeJson()

std::string yaze::cli::resources::OutputFormatter::EscapeJson ( const std::string & str) const
private

Member Data Documentation

◆ format_

Format yaze::cli::resources::OutputFormatter::format_
private

Definition at line 193 of file command_context.h.

Referenced by IsJson(), and IsText().

◆ buffer_

std::string yaze::cli::resources::OutputFormatter::buffer_
private

◆ indent_level_

int yaze::cli::resources::OutputFormatter::indent_level_ = 0
private

Definition at line 195 of file command_context.h.

Referenced by AddIndent(), BeginArray(), BeginObject(), EndArray(), and EndObject().

◆ first_field_

bool yaze::cli::resources::OutputFormatter::first_field_ = true
private

◆ in_array_

bool yaze::cli::resources::OutputFormatter::in_array_ = false
private

Definition at line 197 of file command_context.h.

Referenced by BeginArray(), and EndArray().

◆ array_item_count_

int yaze::cli::resources::OutputFormatter::array_item_count_ = 0
private

Definition at line 198 of file command_context.h.

Referenced by AddArrayItem(), BeginArray(), and EndArray().


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