justify/src/justifyLeft.cpp

45 lines
1.2 KiB
C++

/*
Copyright© 2022 John Sennesael
This file is part of justify.
Justify is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
Justify is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with Justify. If not, see <https://www.gnu.org/licenses/>.
*/
#include "justifyLeft.h"
#include "justifyCommon.h"
#include <fstream>
#include <memory>
#include <string>
#include <vector>
std::vector<std::wstring> justifyLeft(
std::shared_ptr<std::wistream> in,
size_t width)
{
std::vector<std::wstring> result;
const std::vector<std::wstring> parsedLines = truncateLinesToFitWidth(
in,
width
);
for (auto& line: parsedLines)
{
result.emplace_back(line);
}
return result;
}