Skip to content
Welcome to the new CppUtils documentation!

Namespace: CppUtils::Language::CSV

using CppUtils::Language::CSV::Line = typedef std::vector<std::string_view>;
auto parse(std::string_view src, char delimiter=';') -> Container::Tree::VariantNode<Type::Token, std::string>;

auto parseTable(std::string_view src, char delimiter=';') -> std::vector<std::vector<std::string>>;

template <class Object, class Mapping>
auto toStruct(const auto& csvLine) -> Object;

template <class Object, class Mapping>
auto toStructs(const auto& lines, std::size_t dropNFirstLines = 0, std::vector<Object> &&objects={}) -> std::vector<Object>;

template <class Object, class Mapping>
auto toCSV(const Object& object, std::string_view separator=";") -> std::string;

template <class Object, class Mapping>
auto toCSV(const std::vector<Object> &objects, std::string_view columnSeparator=";", std::string_view lineSeparator="\n") -> std::string;

template <class Object, class Mapping>
auto toStruct();

template <class Object, class Mapping>
auto toCSV(std::string_view separator=";");

template <class Object, class Mapping>
auto toStructSafe(const auto& csvLine, std::string_view separator=";", std::size_t lineNumber = 0) -> std::expected<Object, RejectEntry>;

template <class Object, class Mapping>
auto toStructSafe(std::string_view separator=";");

auto routeRejected(std::filesystem::path path, std::string_view separator=";");

auto splitLineView(std::string_view line, std::string_view separator=";");

auto splitLine(std::string_view line, std::string_view separator=";") -> std::vector<std::string_view>;

auto parseCSV(std::string_view csv, std::string_view columnSeparator=";", std::string_view lineSeparator="\n") -> std::vector<std::vector<std::string_view>>;

template <class Object, class Mapping>
auto loadFile(const std::filesystem::path& filePath, std::size_t dropNFirstLines = 0, std::string_view columnSeparator=";", std::string_view lineSeparator="\n", std::vector<Object> &&elements={});

auto parseLines(std::string_view separator=";");