libdnf5-cli library: Do not export private symbols

This commit is contained in:
Jaroslav Rohel 2024-05-20 09:54:35 +02:00 committed by kolage
parent 86867f135b
commit 5ff855fc78
39 changed files with 186 additions and 111 deletions

View File

@ -16,6 +16,7 @@
#define CV __perl_CV
#define LIBDNF_CLI_API
%include "libdnf5-cli/progressbar/progress_bar.hpp"
%include "libdnf5-cli/progressbar/download_progress_bar.hpp"

View File

@ -20,6 +20,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_ARGUMENT_PARSER_HPP
#define LIBDNF5_CLI_ARGUMENT_PARSER_HPP
#include "libdnf5-cli/defs.h"
#include "libdnf5-cli/exception.hpp"
#include <libdnf5/conf/option.hpp>
@ -153,7 +154,7 @@ public:
/// Base class for user data used in ArgumentParser::Argument
class ArgumentParserUserData {};
class ArgumentParser {
class LIBDNF_CLI_API ArgumentParser {
public:
class Argument;
@ -186,7 +187,7 @@ public:
private:
friend class ArgumentParser;
Group(const std::string & id);
LIBDNF_CLI_LOCAL Group(const std::string & id);
std::string id;
std::string header;
@ -262,7 +263,7 @@ public:
private:
friend class ArgumentParser;
Argument(ArgumentParser & owner, std::string id);
LIBDNF_CLI_LOCAL Argument(ArgumentParser & owner, std::string id);
ArgumentParser & owner;
std::string id;
@ -330,9 +331,9 @@ public:
private:
friend class ArgumentParser;
PositionalArg(
LIBDNF_CLI_LOCAL PositionalArg(
ArgumentParser & owner, const std::string & id, std::vector<std::unique_ptr<libdnf5::Option>> * values);
PositionalArg(
LIBDNF_CLI_LOCAL PositionalArg(
ArgumentParser & owner,
const std::string & id,
int nvals,
@ -341,7 +342,7 @@ public:
/// Parses input.
/// Returns number of consumed arguments from the input.
int parse(const char * option, int argc, const char * const argv[]);
LIBDNF_CLI_LOCAL int parse(const char * option, int argc, const char * const argv[]);
int nvals; // Number of values required by this positional argument on the command line
libdnf5::Option * init_value;
@ -434,16 +435,16 @@ public:
private:
friend class ArgumentParser;
NamedArg(ArgumentParser & owner, const std::string & id);
LIBDNF_CLI_LOCAL NamedArg(ArgumentParser & owner, const std::string & id);
/// Parses long argument.
/// Returns number of consumed arguments from the input.
int parse_long(const char * option, int argc, const char * const argv[]);
LIBDNF_CLI_LOCAL int parse_long(const char * option, int argc, const char * const argv[]);
/// Parses short argument.
/// Returns the number of arguments consumed from the input. It may be zero.
/// Multiple short arguments can be packed in one item. (e.g. "-v -f" -> "-vf").
int parse_short(const char * option, int argc, const char * const argv[]);
LIBDNF_CLI_LOCAL int parse_short(const char * option, int argc, const char * const argv[]);
std::string long_name;
char short_name{'\0'};
@ -557,11 +558,11 @@ public:
private:
friend class ArgumentParser;
Command(ArgumentParser & owner, const std::string & id);
LIBDNF_CLI_LOCAL Command(ArgumentParser & owner, const std::string & id);
// Prints a completed argument `arg` or a table with suggestions and help to complete
// if there is more than one solution.
void print_complete(
LIBDNF_CLI_LOCAL void print_complete(
const char * arg, std::vector<ArgumentParser::NamedArg *> named_args, size_t used_positional_arguments);
Command * parent{nullptr};
@ -634,7 +635,7 @@ public:
private:
friend class ArgumentParser;
CommandOrdinary(ArgumentParser & owner, const std::string & id);
LIBDNF_CLI_LOCAL CommandOrdinary(ArgumentParser & owner, const std::string & id);
std::vector<Command *> cmds;
std::vector<NamedArg *> named_args;
@ -714,7 +715,7 @@ public:
private:
friend class ArgumentParser;
CommandAlias(ArgumentParser & owner, const std::string & id, Command & attached_command);
LIBDNF_CLI_LOCAL CommandAlias(ArgumentParser & owner, const std::string & id, Command & attached_command);
Command & attached_command;
@ -853,7 +854,7 @@ public:
void complete(int argc, const char * const argv[], int complete_arg_idx);
private:
class ArgumentParserImpl;
class LIBDNF_CLI_LOCAL ArgumentParserImpl;
const std::unique_ptr<ArgumentParserImpl> p_impl;
};

View File

@ -22,6 +22,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "exit-codes.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/base/transaction.hpp>
#include <libdnf5/common/exception.hpp>
@ -37,7 +39,7 @@ public:
/// Exception is thrown when the user does not confirm the transaction.
class AbortedByUserError : public Error {
class LIBDNF_CLI_API AbortedByUserError : public Error {
public:
AbortedByUserError();
const char * get_name() const noexcept override { return "AbortedByUserError"; }
@ -53,7 +55,7 @@ public:
/// Exception is thrown when libdnf5 fails to resolve the transaction.
class GoalResolveError : public Error {
class LIBDNF_CLI_API GoalResolveError : public Error {
public:
/// Construct Error from a list of string representations of resolve logs.
/// @param resolve_logs List of resolve logs
@ -97,7 +99,7 @@ private:
};
/// Exception used when non-standard exit code should be returned without displaying any message to the user
class SilentCommandExitError : public Error {
class LIBDNF_CLI_API SilentCommandExitError : public Error {
public:
/// Constructs the error with given exit code.
///

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "advisory_tmpl.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/advisory/advisory.hpp>
#include <libdnf5/advisory/advisory_collection.hpp>
#include <libdnf5/advisory/advisory_module.hpp>
@ -31,11 +33,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::output {
extern template class AdvisoryReferenceAdapter<libdnf5::advisory::AdvisoryReference>;
extern template class AdvisoryPackageAdapter<libdnf5::advisory::AdvisoryPackage>;
extern template class AdvisoryModuleAdapter<libdnf5::advisory::AdvisoryModule>;
extern template class AdvisoryCollectionAdapter<libdnf5::advisory::AdvisoryCollection>;
extern template class AdvisoryAdapter<libdnf5::advisory::Advisory>;
extern template class LIBDNF_CLI_API AdvisoryReferenceAdapter<libdnf5::advisory::AdvisoryReference>;
extern template class LIBDNF_CLI_API AdvisoryPackageAdapter<libdnf5::advisory::AdvisoryPackage>;
extern template class LIBDNF_CLI_API AdvisoryModuleAdapter<libdnf5::advisory::AdvisoryModule>;
extern template class LIBDNF_CLI_API AdvisoryCollectionAdapter<libdnf5::advisory::AdvisoryCollection>;
extern template class LIBDNF_CLI_API AdvisoryAdapter<libdnf5::advisory::Advisory>;
} // namespace libdnf5::cli::output

View File

@ -23,15 +23,17 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "comps_tmpl.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/comps/environment/environment.hpp>
#include <libdnf5/comps/group/group.hpp>
#include <libdnf5/comps/group/package.hpp>
namespace libdnf5::cli::output {
extern template class GroupPackageAdapter<libdnf5::comps::Package>;
extern template class GroupAdapter<libdnf5::comps::Group>;
extern template class EnvironmentAdapter<libdnf5::comps::Environment>;
extern template class LIBDNF_CLI_API GroupPackageAdapter<libdnf5::comps::Package>;
extern template class LIBDNF_CLI_API GroupAdapter<libdnf5::comps::Group>;
extern template class LIBDNF_CLI_API EnvironmentAdapter<libdnf5::comps::Environment>;
} // namespace libdnf5::cli::output

View File

@ -23,15 +23,17 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "module_tmpl.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/module/module_dependency.hpp>
#include <libdnf5/module/module_item.hpp>
#include <libdnf5/module/module_profile.hpp>
namespace libdnf5::cli::output {
extern template class ModuleDependencyAdapter<libdnf5::module::ModuleDependency>;
extern template class ModuleItemAdapter<libdnf5::module::ModuleItem>;
extern template class ModuleProfileAdapter<libdnf5::module::ModuleProfile>;
extern template class LIBDNF_CLI_API ModuleDependencyAdapter<libdnf5::module::ModuleDependency>;
extern template class LIBDNF_CLI_API ModuleItemAdapter<libdnf5::module::ModuleItem>;
extern template class LIBDNF_CLI_API ModuleProfileAdapter<libdnf5::module::ModuleProfile>;
} // namespace libdnf5::cli::output

View File

@ -23,11 +23,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "package_tmpl.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/rpm/package.hpp>
namespace libdnf5::cli::output {
extern template class PackageAdapter<libdnf5::rpm::Package>;
extern template class LIBDNF_CLI_API PackageAdapter<libdnf5::rpm::Package>;
} // namespace libdnf5::cli::output

View File

@ -23,11 +23,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "repo_tmpl.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/repo/repo_weak.hpp>
namespace libdnf5::cli::output {
extern template class RepoAdapter<libdnf5::repo::RepoWeakPtr>;
extern template class LIBDNF_CLI_API RepoAdapter<libdnf5::repo::RepoWeakPtr>;
} // namespace libdnf5::cli::output

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "transaction_tmpl.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/base/transaction.hpp>
#include <libdnf5/base/transaction_environment.hpp>
#include <libdnf5/base/transaction_group.hpp>
@ -31,11 +33,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::output {
extern template class TransactionPackageAdapter<libdnf5::base::TransactionPackage>;
extern template class TransactionGroupAdapter<libdnf5::base::TransactionGroup>;
extern template class TransactionEnvironmentAdapter<libdnf5::base::TransactionEnvironment>;
extern template class TransactionModuleAdapter<libdnf5::base::TransactionModule>;
extern template class TransactionAdapter<libdnf5::base::Transaction>;
extern template class LIBDNF_CLI_API TransactionPackageAdapter<libdnf5::base::TransactionPackage>;
extern template class LIBDNF_CLI_API TransactionGroupAdapter<libdnf5::base::TransactionGroup>;
extern template class LIBDNF_CLI_API TransactionEnvironmentAdapter<libdnf5::base::TransactionEnvironment>;
extern template class LIBDNF_CLI_API TransactionModuleAdapter<libdnf5::base::TransactionModule>;
extern template class LIBDNF_CLI_API TransactionAdapter<libdnf5::base::Transaction>;
} // namespace libdnf5::cli::output

View File

@ -23,9 +23,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/advisory.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
class AdvisoryInfo {
class LIBDNF_CLI_API AdvisoryInfo {
public:
AdvisoryInfo();
~AdvisoryInfo();
@ -34,7 +36,7 @@ public:
void print();
private:
class Impl;
class LIBDNF_CLI_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,16 +23,18 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/advisory.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/advisory/advisory_package.hpp>
#include <libdnf5/advisory/advisory_reference.hpp>
namespace libdnf5::cli::output {
void print_advisorylist_table(
LIBDNF_CLI_API void print_advisorylist_table(
std::vector<std::unique_ptr<IAdvisoryPackage>> & advisory_package_list_not_installed,
std::vector<std::unique_ptr<IAdvisoryPackage>> & advisory_package_list_installed);
void print_advisorylist_references_table(
LIBDNF_CLI_API void print_advisorylist_references_table(
std::vector<libdnf5::advisory::AdvisoryPackage> & advisory_package_list_not_installed,
std::vector<libdnf5::advisory::AdvisoryPackage> & advisory_package_list_installed,
std::string reference_type);

View File

@ -21,11 +21,14 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_OUTPUT_ADVISORYSUMMARY_HPP
#define LIBDNF5_CLI_OUTPUT_ADVISORYSUMMARY_HPP
#include "libdnf5-cli/defs.h"
#include <libdnf5/advisory/advisory_query.hpp>
namespace libdnf5::cli::output {
void print_advisorysummary_table(const libdnf5::advisory::AdvisoryQuery & advisories, const std::string & mode);
LIBDNF_CLI_API void print_advisorysummary_table(
const libdnf5::advisory::AdvisoryQuery & advisories, const std::string & mode);
} // namespace libdnf5::cli::output

View File

@ -21,6 +21,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_OUTPUT_CHANGELOGS_HPP
#define LIBDNF5_CLI_OUTPUT_CHANGELOGS_HPP
#include "libdnf5-cli/defs.h"
#include <libdnf5/rpm/package_query.hpp>
#include <string>
@ -31,7 +33,7 @@ namespace libdnf5::cli::output {
enum class ChangelogFilterType { NONE, UPGRADES, COUNT, SINCE };
void print_changelogs(
LIBDNF_CLI_API void print_changelogs(
libdnf5::rpm::PackageQuery & query,
std::pair<ChangelogFilterType, std::variant<libdnf5::rpm::PackageQuery, int64_t, int32_t>> filter);

View File

@ -23,9 +23,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/comps.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
void print_environmentinfo_table(IEnvironment & environment);
LIBDNF_CLI_API void print_environmentinfo_table(IEnvironment & environment);
} // namespace libdnf5::cli::output

View File

@ -23,9 +23,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/comps.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
void print_environmentlist_table(std::vector<std::unique_ptr<IEnvironment>> & environment_list);
LIBDNF_CLI_API void print_environmentlist_table(std::vector<std::unique_ptr<IEnvironment>> & environment_list);
} // namespace libdnf5::cli::output

View File

@ -23,9 +23,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/comps.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
void print_groupinfo_table(IGroup & group);
LIBDNF_CLI_API void print_groupinfo_table(IGroup & group);
} // namespace libdnf5::cli::output

View File

@ -23,9 +23,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/comps.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
void print_grouplist_table(std::vector<std::unique_ptr<IGroup>> & group_list);
LIBDNF_CLI_API void print_grouplist_table(std::vector<std::unique_ptr<IGroup>> & group_list);
} // namespace libdnf5::cli::output

View File

@ -23,16 +23,18 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/module.hpp"
#include "libdnf5-cli/defs.h"
#include <memory>
#include <vector>
namespace libdnf5::cli::output {
void print_module_item(IModuleItem & module_item);
LIBDNF_CLI_API void print_module_item(IModuleItem & module_item);
void print_moduleinfo_table(std::vector<std::unique_ptr<IModuleItem>> & module_list);
LIBDNF_CLI_API void print_moduleinfo_table(std::vector<std::unique_ptr<IModuleItem>> & module_list);
void print_moduleinfo_table_hint();
LIBDNF_CLI_API void print_moduleinfo_table_hint();
} // namespace libdnf5::cli::output

View File

@ -23,14 +23,16 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/module.hpp"
#include "libdnf5-cli/defs.h"
#include <memory>
#include <vector>
namespace libdnf5::cli::output {
void print_modulelist_table(const std::vector<std::unique_ptr<IModuleItem>> & module_list);
LIBDNF_CLI_API void print_modulelist_table(const std::vector<std::unique_ptr<IModuleItem>> & module_list);
void print_modulelist_table_hint();
LIBDNF_CLI_API void print_modulelist_table_hint();
} // namespace libdnf5::cli::output

View File

@ -23,9 +23,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "package_list_sections.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
class PackageInfoSections : public PackageListSections {
class LIBDNF_CLI_API PackageInfoSections : public PackageListSections {
public:
PackageInfoSections();
~PackageInfoSections();

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "pkg_colorizer.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/rpm/package.hpp>
#include <libdnf5/rpm/package_set.hpp>
@ -34,7 +36,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::output {
/// Print list packages divided into sections.
class PackageListSections {
class LIBDNF_CLI_API PackageListSections {
public:
PackageListSections();
virtual ~PackageListSections();
@ -54,7 +56,7 @@ public:
const std::map<libdnf5::rpm::PackageId, std::vector<libdnf5::rpm::Package>> & obsoletes = {});
protected:
class Impl;
class LIBDNF_CLI_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,9 +24,11 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/package.hpp"
#include "pkg_colorizer.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
void print_package_info(
LIBDNF_CLI_API void print_package_info(
IPackage & pkg,
const std::unique_ptr<PkgColorizer> & colorizer = nullptr,
const std::vector<libdnf5::rpm::Package> & obsoletes = {});

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/package.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/rpm/package_set.hpp>
#include <string>
@ -30,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::output {
class PkgColorizer {
class LIBDNF_CLI_API PkgColorizer {
public:
/// Class is used to compute output color of the package based on the package
/// version and version in `base_versions`. Colors can be either names (e.g. red,
@ -53,7 +55,7 @@ public:
std::string get_pkg_color(const IPackage & package);
private:
std::string to_escape(const std::string & color);
LIBDNF_CLI_LOCAL std::string to_escape(const std::string & color);
// map N.A of the package to the version
std::unordered_map<std::string, libdnf5::rpm::Package> base_na_version;

View File

@ -22,11 +22,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/package.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::output {
enum ProvidesMatchedBy : int { NO_MATCH = 0, PROVIDES = 1, FILENAME = 2, BINARY = 3 };
void print_provides_table(IPackage & package, const char * spec, int match);
LIBDNF_CLI_API void print_provides_table(IPackage & package, const char * spec, int match);
} // namespace libdnf5::cli::output

View File

@ -23,11 +23,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/repo.hpp"
#include "libdnf5-cli/defs.h"
#include <memory>
namespace libdnf5::cli::output {
class RepoInfo {
class LIBDNF_CLI_API RepoInfo {
public:
RepoInfo();
~RepoInfo();
@ -36,11 +38,11 @@ public:
void print();
private:
class Impl;
class LIBDNF_CLI_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};
void print_repoinfo_json(const std::vector<std::unique_ptr<IRepoInfo>> & repos);
LIBDNF_CLI_API void print_repoinfo_json(const std::vector<std::unique_ptr<IRepoInfo>> & repos);
} // namespace libdnf5::cli::output

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/repo.hpp"
#include "libdnf5-cli/defs.h"
#include <memory>
namespace libdnf5::cli::output {
@ -30,8 +32,9 @@ namespace libdnf5::cli::output {
// repository list table columns
enum { COL_REPO_ID, COL_REPO_NAME, COL_REPO_STATUS };
void print_repolist_table(const std::vector<std::unique_ptr<IRepo>> & repos, bool with_status, size_t sort_column);
void print_repolist_json(const std::vector<std::unique_ptr<IRepo>> & repos);
LIBDNF_CLI_API void print_repolist_table(
const std::vector<std::unique_ptr<IRepo>> & repos, bool with_status, size_t sort_column);
LIBDNF_CLI_API void print_repolist_json(const std::vector<std::unique_ptr<IRepo>> & repos);
} // namespace libdnf5::cli::output

View File

@ -21,21 +21,23 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_OUTPUT_REPOQUERY_HPP
#define LIBDNF5_CLI_OUTPUT_REPOQUERY_HPP
#include "libdnf5-cli/defs.h"
#include <libdnf5/rpm/package_set.hpp>
namespace libdnf5::cli::output {
bool requires_filelists(const std::string & queryformat);
LIBDNF_CLI_API bool requires_filelists(const std::string & queryformat);
void print_pkg_set_with_format(
LIBDNF_CLI_API void print_pkg_set_with_format(
std::FILE * target, const libdnf5::rpm::PackageSet & pkgs, const std::string & queryformat);
void print_pkg_attr_uniq_sorted(
LIBDNF_CLI_API void print_pkg_attr_uniq_sorted(
std::FILE * target, const libdnf5::rpm::PackageSet & pkgs, const std::string & getter_name);
void print_available_pkg_attrs(std::FILE * target);
LIBDNF_CLI_API void print_available_pkg_attrs(std::FILE * target);
libdnf5::rpm::ReldepList get_reldeplist_for_attr(
LIBDNF_CLI_API libdnf5::rpm::ReldepList get_reldeplist_for_attr(
const libdnf5::rpm::PackageSet & pkgs, const std::string & getter_name);
} // namespace libdnf5::cli::output

View File

@ -21,6 +21,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_OUTPUT_SEARCH_HPP
#define LIBDNF5_CLI_OUTPUT_SEARCH_HPP
#include "libdnf5-cli/defs.h"
#include <libdnf5/rpm/nevra.hpp>
#include <libdnf5/rpm/package.hpp>
@ -66,7 +68,7 @@ struct SearchResults {
/// @brief Write the search results to the standard output.
/// @param results Structure with already computed search results.
void print_search_results(const SearchResults & results);
LIBDNF_CLI_API void print_search_results(const SearchResults & results);
} // namespace libdnf5::cli::output

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "interfaces/transaction.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/common/impl_ptr.hpp>
#include <cstdio>
@ -30,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::output {
class TransactionTable {
class LIBDNF_CLI_API TransactionTable {
public:
explicit TransactionTable(ITransaction & transaction);
~TransactionTable();
@ -49,13 +51,13 @@ public:
void set_output_stream(std::FILE * fd);
private:
class Impl;
class LIBDNF_CLI_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
void print_resolve_logs(const ITransaction & transaction, std::ostream & stream = std::cerr);
LIBDNF_CLI_API void print_resolve_logs(const ITransaction & transaction, std::ostream & stream = std::cerr);
bool print_transaction_table(ITransaction & transaction);
LIBDNF_CLI_API bool print_transaction_table(ITransaction & transaction);
} // namespace libdnf5::cli::output

View File

@ -21,11 +21,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_OUTPUT_TRANSACTIONINFO_HPP
#define LIBDNF5_CLI_OUTPUT_TRANSACTIONINFO_HPP
#include "libdnf5-cli/defs.h"
#include <libdnf5/transaction/transaction.hpp>
namespace libdnf5::cli::output {
void print_transaction_info(libdnf5::transaction::Transaction & transaction);
LIBDNF_CLI_API void print_transaction_info(libdnf5::transaction::Transaction & transaction);
} // namespace libdnf5::cli::output

View File

@ -21,11 +21,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_OUTPUT_TRANSACTIONLIST_HPP
#define LIBDNF5_CLI_OUTPUT_TRANSACTIONLIST_HPP
#include "libdnf5-cli/defs.h"
#include <libdnf5/transaction/transaction.hpp>
namespace libdnf5::cli::output {
void print_transaction_list(std::vector<libdnf5::transaction::Transaction> & ts_list);
LIBDNF_CLI_API void print_transaction_list(std::vector<libdnf5::transaction::Transaction> & ts_list);
} // namespace libdnf5::cli::output

View File

@ -31,11 +31,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "widgets/speed.hpp"
#include "widgets/time.hpp"
#include "libdnf5-cli/defs.h"
namespace libdnf5::cli::progressbar {
class DownloadProgressBar : public ProgressBar {
class LIBDNF_CLI_API DownloadProgressBar : public ProgressBar {
public:
explicit DownloadProgressBar(int64_t download_size, const std::string & description);
@ -54,7 +56,7 @@ protected:
private:
// TODO(dmach): fix inconsistency - MultiProgresBar::operator<< erases previously printed lines, DownloadProgressBar::operator<< does not
friend std::ostream & operator<<(std::ostream & stream, DownloadProgressBar & bar);
LIBDNF_CLI_API friend std::ostream & operator<<(std::ostream & stream, DownloadProgressBar & bar);
// widgets
libdnf5::cli::progressbar::NumberWidget number_widget;

View File

@ -25,6 +25,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "download_progress_bar.hpp"
#include "progress_bar.hpp"
#include "libdnf5-cli/defs.h"
#include <iostream>
#include <memory>
#include <vector>
@ -33,7 +35,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::progressbar {
class MultiProgressBar {
class LIBDNF_CLI_API MultiProgressBar {
public:
static constexpr std::size_t NEVER_VISIBLE_LIMIT = static_cast<std::size_t>(-1);
@ -45,7 +47,7 @@ public:
std::cout << *this;
std::cout << std::flush;
}
friend std::ostream & operator<<(std::ostream & stream, MultiProgressBar & mbar);
LIBDNF_CLI_API friend std::ostream & operator<<(std::ostream & stream, MultiProgressBar & mbar);
/// Sets the minimum number of registered progress bars to show the total bar.
void set_total_bar_visible_limit(std::size_t value) noexcept { total_bar_visible_limit = value; }

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_PROGRESSBAR_PROGRESS_BAR_HPP
#define LIBDNF5_CLI_PROGRESSBAR_PROGRESS_BAR_HPP
#include "libdnf5-cli/defs.h"
#include <chrono>
#include <string>
@ -47,7 +48,7 @@ enum class MessageType : int {
};
class ProgressBar {
class LIBDNF_CLI_API ProgressBar {
public:
using Message = std::pair<MessageType, std::string>;
@ -110,7 +111,7 @@ public:
std::chrono::time_point<std::chrono::system_clock> get_begin() { return begin; }
friend std::ostream & operator<<(std::ostream & os, ProgressBar & bar);
LIBDNF_CLI_API friend std::ostream & operator<<(std::ostream & os, ProgressBar & bar);
protected:
virtual void to_stream(std::ostream & stream) = 0;

View File

@ -24,6 +24,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "argument_parser.hpp"
#include "libdnf5-cli/defs.h"
#include <libdnf5/common/impl_ptr.hpp>
#include <libdnf5/conf/option_bool.hpp>
#include <libdnf5/conf/option_string.hpp>
@ -36,7 +38,7 @@ namespace libdnf5::cli::session {
class Command;
class Session {
class LIBDNF_CLI_API Session {
public:
explicit Session();
~Session();
@ -79,12 +81,12 @@ public:
void clear();
private:
class Impl;
class LIBDNF_CLI_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
class Command : public libdnf5::cli::ArgumentParserUserData {
class LIBDNF_CLI_API Command : public libdnf5::cli::ArgumentParserUserData {
public:
explicit Command(Session & session, const std::string & name);
virtual ~Command();
@ -161,7 +163,7 @@ private:
};
class Option {
class LIBDNF_CLI_API Option {
public:
Option(const Option & src) = delete;
Option(Option && src) = delete;
@ -175,7 +177,7 @@ protected:
};
class BoolOption : public Option {
class LIBDNF_CLI_API BoolOption : public Option {
public:
explicit BoolOption(
libdnf5::cli::session::Command & command,
@ -208,7 +210,7 @@ protected:
/// AppendStringListOption is a wrapper around NamedArg and OptionStringList
/// which allows specifying the argument multiple times and merging their values.
/// E.g. --whatrequires=tree --whatrequires=plant -> option contains: "tree, plant"
class AppendStringListOption : public Option {
class LIBDNF_CLI_API AppendStringListOption : public Option {
public:
explicit AppendStringListOption(
libdnf5::cli::session::Command & command,
@ -241,7 +243,7 @@ protected:
};
class StringArgumentList : public Option {
class LIBDNF_CLI_API StringArgumentList : public Option {
public:
explicit StringArgumentList(
libdnf5::cli::session::Command & command, const std::string & name, const std::string & desc, int nargs);

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_CLI_TTY_HPP
#define LIBDNF5_CLI_TTY_HPP
#include "libdnf5-cli/defs.h"
#include <iostream>
@ -28,30 +29,30 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::tty {
std::ostream & reset(std::ostream & stream);
LIBDNF_CLI_API std::ostream & reset(std::ostream & stream);
std::ostream & bold(std::ostream & stream);
std::ostream & underline(std::ostream & stream);
std::ostream & blink(std::ostream & stream);
LIBDNF_CLI_API std::ostream & bold(std::ostream & stream);
LIBDNF_CLI_API std::ostream & underline(std::ostream & stream);
LIBDNF_CLI_API std::ostream & blink(std::ostream & stream);
std::ostream & black(std::ostream & stream);
std::ostream & red(std::ostream & stream);
std::ostream & green(std::ostream & stream);
std::ostream & yellow(std::ostream & stream);
std::ostream & blue(std::ostream & stream);
std::ostream & magenta(std::ostream & stream);
std::ostream & cyan(std::ostream & stream);
std::ostream & white(std::ostream & stream);
LIBDNF_CLI_API std::ostream & black(std::ostream & stream);
LIBDNF_CLI_API std::ostream & red(std::ostream & stream);
LIBDNF_CLI_API std::ostream & green(std::ostream & stream);
LIBDNF_CLI_API std::ostream & yellow(std::ostream & stream);
LIBDNF_CLI_API std::ostream & blue(std::ostream & stream);
LIBDNF_CLI_API std::ostream & magenta(std::ostream & stream);
LIBDNF_CLI_API std::ostream & cyan(std::ostream & stream);
LIBDNF_CLI_API std::ostream & white(std::ostream & stream);
std::ostream & clear_line(std::ostream & stream);
std::ostream & cursor_up(std::ostream & stream);
LIBDNF_CLI_API std::ostream & clear_line(std::ostream & stream);
LIBDNF_CLI_API std::ostream & cursor_up(std::ostream & stream);
std::ostream & cursor_hide(std::ostream & stream);
std::ostream & cursor_show(std::ostream & stream);
LIBDNF_CLI_API std::ostream & cursor_hide(std::ostream & stream);
LIBDNF_CLI_API std::ostream & cursor_show(std::ostream & stream);
int get_width();
bool is_interactive();
LIBDNF_CLI_API int get_width();
LIBDNF_CLI_API bool is_interactive();
} // namespace libdnf5::cli::tty

View File

@ -21,6 +21,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF_CLI_UTILS_UNITS
#define LIBDNF_CLI_UTILS_UNITS
#include "libdnf5-cli/defs.h"
#include <string>
#include <utility>
@ -28,9 +30,9 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::cli::utils::units {
std::pair<float, const char *> to_size(int64_t num);
LIBDNF_CLI_API std::pair<float, const char *> to_size(int64_t num);
std::string format_size_aligned(int64_t num);
LIBDNF_CLI_API std::string format_size_aligned(int64_t num);
} // namespace libdnf5::cli::utils::units

View File

@ -2,6 +2,7 @@ if(NOT WITH_LIBDNF5_CLI)
return()
endif()
add_definitions(-DLIBDNF_CLI_BUILD_LIBRARY)
set(GETTEXT_DOMAIN libdnf5-cli)
add_definitions(-DGETTEXT_DOMAIN=\"${GETTEXT_DOMAIN}\")
@ -22,6 +23,7 @@ add_library(libdnf5-cli SHARED ${LIBDNF5_CLI_SOURCES})
set(DNF_CLI_SO_VERSION 2)
set_target_properties(libdnf5-cli PROPERTIES OUTPUT_NAME "dnf5-cli")
set_target_properties(libdnf5-cli PROPERTIES SOVERSION ${DNF_CLI_SO_VERSION})
set_target_properties(libdnf5-cli PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden)
# required by clang
target_link_libraries(libdnf5-cli PUBLIC stdc++)

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF_CLI_UTILS_UTF8
#define LIBDNF_CLI_UTILS_UTF8
#include "libdnf5-cli/defs.h"
#include <string>
@ -29,20 +30,20 @@ namespace libdnf5::cli::utils::utf8 {
/// return length of an utf-8 encoded string
std::size_t length(const std::string & str);
LIBDNF_CLI_API std::size_t length(const std::string & str);
/// return printable width of an utf-8 encoded string (considers non-printable and wide characters)
std::size_t width(const std::string & str);
LIBDNF_CLI_API std::size_t width(const std::string & str);
/// return an utf-8 sub-string that matches specified character count
std::string substr_length(
LIBDNF_CLI_API std::string substr_length(
const std::string & str, std::string::size_type pos = 0, std::string::size_type len = std::string::npos);
/// return an utf-8 sub-string that matches specified printable width
std::string substr_width(
LIBDNF_CLI_API std::string substr_width(
const std::string & str, std::string::size_type pos = 0, std::string::size_type wid = std::string::npos);