Haio 0.2.X
Homebrew Asset IO/CDN
Loading...
Searching...
No Matches
Haio::Cli Namespace Reference

Namespaces

namespace  Lexer

Classes

struct  Command
struct  ParseError
struct  Token

Enumerations

enum class  TokenType {
  InputFile , OutputFile , GeneratorXc , GeneratorGradient ,
  FilterCrop , FilterResize , FilterRadius , FilterFormat ,
  FilterFx , FilterPalette , FilterPixFmt
}

Functions

Command parseArgs (int argc, char *argv[])
Command parseCommandLine (std::string_view text)
std::vector< std::string > lexCommandLine (std::string_view text)
Pipeline buildPipeline (const Command &command)
int runCli (int argc, char *argv[])
bool parseSizeToken (std::string_view text, Size &out)
bool parseCropGeometryToken (std::string_view text, Rect &out)
bool parseRectToken (std::string_view text, Rect &out)

Detailed Description

the convert command line.

it used to be namespace Haio::Convert, which now belongs to the colour conversion family – a name cannot be a namespace and a function template at once.


Class Documentation

◆ Haio::Cli::Command

struct Haio::Cli::Command

Definition at line 55 of file haio_cli.hpp.

Collaboration diagram for Haio::Cli::Command:
Class Members
ParseError error
bool hasGenerator = false
bool hasInput = false
Format inputFormat = Format::RAW
string inputFormatName
string inputPath
optional< Color > outputColor

which colour to store inside the output, when -pix_fmt named one

string outputColorName
Format outputFormat = Format::RAW
string outputFormatName
bool outputIsStdout = false
string outputPath
optional< Pending > pendingFilter
optional< Pending > pendingLimit
Limit pendingLimitHow = Limit::Spread

only meaningful when pendingLimit is set

vector< Token > tokens

◆ Haio::Cli::Token

struct Haio::Cli::Token

Definition at line 40 of file haio_cli.hpp.

Class Members
string arg
Color color = Color::RGBA8888
Dither dither = Dither::Nearest
Format format = Format::RAW
size_t limit = 0

zero means the palette is used whole

Limit limitHow = Limit::Spread
int percent = 0
int radius = 0
optional< Rect > rect
optional< Size > size
TokenType type = TokenType::InputFile
string value

Enumeration Type Documentation

◆ TokenType

enum class Haio::Cli::TokenType
strong
Enumerator
InputFile 
OutputFile 
GeneratorXc 
GeneratorGradient 
FilterCrop 
FilterResize 
FilterRadius 
FilterFormat 
FilterFx 
FilterPalette 
FilterPixFmt 

Definition at line 19 of file haio_cli.hpp.

Function Documentation

◆ buildPipeline()

Pipeline Haio::Cli::buildPipeline ( const Command & command)

"raw:" is the container that is not one: the pixels as they are, in whatever -pix_fmt asked for. it has to be named rather than guessed, because a file extension never means it, which is exactly what tells it apart from a format nobody recognised.

Definition at line 15 of file pipeline_builder.cpp.

Here is the call graph for this function:

◆ lexCommandLine()

std::vector< std::string > Haio::Cli::lexCommandLine ( std::string_view text)

Definition at line 528 of file parser.cpp.

Here is the call graph for this function:

◆ parseArgs()

Command Haio::Cli::parseArgs ( int argc,
char * argv[] )

the line is over and something is still waiting to be used.

it is checked here rather than where it was written, because a setting is not wrong when it is read: it is wrong only once the line ends without anything having taken it, which is exactly what "-scale 200% -filter point" does.

Definition at line 544 of file parser.cpp.

Here is the call graph for this function:

◆ parseCommandLine()

Command Haio::Cli::parseCommandLine ( std::string_view text)

Definition at line 540 of file parser.cpp.

Here is the call graph for this function:

◆ parseCropGeometryToken()

bool Haio::Cli::parseCropGeometryToken ( std::string_view text,
Rect & out )

Definition at line 520 of file parser.cpp.

Here is the call graph for this function:

◆ parseRectToken()

bool Haio::Cli::parseRectToken ( std::string_view text,
Rect & out )

Definition at line 524 of file parser.cpp.

Here is the call graph for this function:

◆ parseSizeToken()

bool Haio::Cli::parseSizeToken ( std::string_view text,
Size & out )

Definition at line 516 of file parser.cpp.

Here is the call graph for this function:

◆ runCli()

int Haio::Cli::runCli ( int argc,
char * argv[] )

Definition at line 109 of file cli.cpp.

Here is the call graph for this function: