Haio 0.2.X
Homebrew Asset IO/CDN
Loading...
Searching...
No Matches
haio_cli.hpp File Reference
#include "haio.hpp"
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for haio_cli.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Haio::Cli::ParseError
struct  Haio::Cli::Token
struct  Haio::Cli::Command
struct  Haio::Cli::Command::Pending

Namespaces

namespace  Haio
namespace  Haio::Cli

Enumerations

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

Functions

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

Class Documentation

◆ 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

◆ 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::Command::Pending

struct Haio::Cli::Command::Pending

an option that has been read and not yet used by anything.

settings stack and operations take them, so "-filter bayer -palete cga" works and "-palete cga -filter bayer" does not: by the time the filter is written down the palette has already gone by, and nothing after it wants one. a setting still waiting when the line ends is a mistake worth stopping for, because it was written in the belief that it would do something.

Definition at line 67 of file haio_cli.hpp.

Class Members
string option
string value