1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00
VILLASnode/fpga/include/villas/fpga/vlnv.hpp
Steffen Vogel 3d73c759ea Reformat all code with clang-format
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
2024-02-29 19:34:27 +01:00

57 lines
1.4 KiB
C++

/* Vendor, Library, Name, Version (VLNV) tag.
*
* Author: Daniel Krebs <github@daniel-krebs.net>
* SPDX-FileCopyrightText: 2017 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <fmt/ostream.h>
#include <iostream>
#include <sstream>
#include <string>
#include <villas/config.hpp>
namespace villas {
namespace fpga {
class Vlnv {
public:
static constexpr char delimiter = ':';
Vlnv() : vendor(""), library(""), name(""), version("") {}
Vlnv(const std::string &s) { parseFromString(s); }
static Vlnv getWildcard() { return Vlnv(); }
std::string toString() const;
bool operator==(const Vlnv &other) const;
bool operator!=(const Vlnv &other) const { return !(*this == other); }
friend std::ostream &operator<<(std::ostream &stream, const Vlnv &vlnv) {
return stream << (vlnv.vendor.empty() ? "*" : vlnv.vendor) << ":"
<< (vlnv.library.empty() ? "*" : vlnv.library) << ":"
<< (vlnv.name.empty() ? "*" : vlnv.name) << ":"
<< (vlnv.version.empty() ? "*" : vlnv.version);
}
private:
void parseFromString(std::string vlnv);
std::string vendor;
std::string library;
std::string name;
std::string version;
};
} // namespace fpga
} // namespace villas
#ifndef FMT_LEGACY_OSTREAM_FORMATTER
template <>
class fmt::formatter<villas::fpga::Vlnv> : public fmt::ostream_formatter {};
#endif