Remove optional usage to make old compilers happy, update readme

This commit is contained in:
John Sennesael 2022-03-24 19:25:04 -05:00
parent 8a85662ce4
commit 383d544d48
3 changed files with 33 additions and 26 deletions

View File

@ -30,40 +30,46 @@ and cmake.
## Building
The standard cmake routine:
The standard Makefile routine:
mkdir build && cd build && cmake .. && make
make
On some unix systems (bsd's, irix,...) you may have to run ...
gmake
... in order to get the gnu version of make.
## Usage
Usage: ./justify [OPTION]...
Usage: ./justify [OPTION]...
Input / output options:
Input / output options:
-i,--input [FILE] Input file to process, defaults to stdin.
-o,--output [FILE] Output file, defaults to stdout.
-i,--input [FILE] Input file to process, defaults to stdin.
-o,--output [FILE] Output file, defaults to stdout.
Column options:
Column options:
-c,--cols [COLS] Number of columns for multi-column
output.
-s,--hspacing [COLS] Column horizontal spacing.
(default: 2)
-v,--vspacing [ROWS] Column vertical spacing.
(default: 1)
-m,--colheight [ROWS] Column max. height.
(default: 0, =infinite)
-c,--cols [COLS] Number of columns for multi-column
output.
-s,--hspacing [COLS] Column horizontal spacing.
(default: 2)
-v,--vspacing [ROWS] Column vertical spacing.
(default: 1)
-m,--colheight [ROWS] Column max. height.
(default: 0, =infinite)
Alignment options:
Alignment options:
-w,--width [NUM] Text width to format text into.
(defaults to terminal width)
-a,--align [center|fill|left|right]
Justify method (default=fill).
-w,--width [NUM] Text width to format text into.
(defaults to terminal width)
-a,--align [center|fill|left|right]
Justify method (default=fill).
Misc options:
Misc options:
-h,--help Show this help text.
-h,--help Show this help text.
## Screenshots

View File

@ -32,7 +32,6 @@
#include <fstream>
#include <iostream>
#include <memory>
#include <optional>
#include <string>
#include <vector>

View File

@ -25,7 +25,6 @@
#include <filesystem>
#include <fstream>
#include <iostream>
#include <optional>
#include <memory>
#include <string>
#include <vector>
@ -108,13 +107,16 @@ WordScore findHighestScore(const std::vector<WordScore>& vScores)
return highest;
}
std::optional<const WordScore> findScoreFor(
std::unique_ptr<WordScore> findScoreFor(
const std::vector<WordScore>& scores,
const std::vector<std::wstring>::const_iterator& searchFor)
{
for (auto it = scores.begin(); it != scores.end(); ++it)
{
if ((*it).iterator == searchFor) return (*it);
if ((*it).iterator == searchFor)
{
return std::make_unique<WordScore>((*it));
}
}
return {};
}