Skip to content

Commit

Permalink
Unify export macros
Browse files Browse the repository at this point in the history
KDUtils was special because it used KDUTILS_EXPORT instead of
indirection through KDUTILS_API. Make it same as KDGui and KDFoundation.

Drive-by: Remove unnecessary export marking in url.cpp
  • Loading branch information
MiKom committed Oct 17, 2024
1 parent 6bc42af commit a0ed4d6
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ BraceWrapping:
IndentBraces: false

CommentPragmas: '/\*(.+\n.+)+\*/'
AttributeMacros: [KDFOUNDATION_API, KDGUI_API, KDUTILS_EXPORT]
AttributeMacros: [KDFOUNDATION_API, KDGUI_API, KDUTILS_API]
10 changes: 5 additions & 5 deletions src/KDUtils/bytearray.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#include <cstdint>
#include <string>

#include <KDUtils/kdutils_export.h>
#include <KDUtils/kdutils_global.h>

namespace KDUtils {

class KDUTILS_EXPORT ByteArray
class KDUTILS_API ByteArray
{
public:
ByteArray();
Expand Down Expand Up @@ -69,9 +69,9 @@ class KDUTILS_EXPORT ByteArray
std::vector<uint8_t> m_data;
};

KDUTILS_EXPORT bool operator==(const ByteArray &a, const ByteArray &b);
KDUTILS_EXPORT bool operator!=(const ByteArray &a, const ByteArray &b);
KDUTILS_EXPORT ByteArray operator+(const ByteArray &a, const ByteArray &b);
KDUTILS_API bool operator==(const ByteArray &a, const ByteArray &b);
KDUTILS_API bool operator!=(const ByteArray &a, const ByteArray &b);
KDUTILS_API ByteArray operator+(const ByteArray &a, const ByteArray &b);

} // namespace KDUtils

Expand Down
4 changes: 2 additions & 2 deletions src/KDUtils/dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#ifndef KDUTILS_DIR_H
#define KDUTILS_DIR_H

#include <KDUtils/kdutils_export.h>
#include <KDUtils/kdutils_global.h>
#include <string>
#include <filesystem>

namespace KDUtils {

class KDUTILS_EXPORT Dir
class KDUTILS_API Dir
{
public:
Dir();
Expand Down
4 changes: 2 additions & 2 deletions src/KDUtils/elapsedtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#ifndef KDUTILS_ELAPSEDTIMER_H
#define KDUTILS_ELAPSEDTIMER_H

#include <KDUtils/kdutils_export.h>
#include <KDUtils/kdutils_global.h>
#include <chrono>
#include <ratio>

namespace KDUtils {

class KDUTILS_EXPORT ElapsedTimer
class KDUTILS_API ElapsedTimer
{
public:
using Clock = std::chrono::high_resolution_clock;
Expand Down
6 changes: 3 additions & 3 deletions src/KDUtils/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef KDUTILS_FILE_H
#define KDUTILS_FILE_H

#include <KDUtils/kdutils_export.h>
#include <KDUtils/kdutils_global.h>
#include <KDUtils/bytearray.h>
#include <iostream>
#include <fstream>
Expand All @@ -23,7 +23,7 @@

namespace KDUtils {

class KDUTILS_EXPORT File
class KDUTILS_API File
{
public:
File(const std::string &path);
Expand Down Expand Up @@ -60,7 +60,7 @@ class KDUTILS_EXPORT File
};

#if defined(ANDROID)
KDUTILS_EXPORT void setAssetManager(AAssetManager *assetManager);
KDUTILS_API void setAssetManager(AAssetManager *assetManager);
#endif

} // namespace KDUtils
Expand Down
4 changes: 2 additions & 2 deletions src/KDUtils/file_mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#ifndef KDUTILS_FILE_MAPPER_H
#define KDUTILS_FILE_MAPPER_H
#include <KDUtils/file.h>
#include <KDUtils/kdutils_export.h>
#include <KDUtils/kdutils_global.h>

namespace KDUtils {
/// Provides memory mapping from a file.
class KDUTILS_EXPORT FileMapper
class KDUTILS_API FileMapper
{
public:
struct Map;
Expand Down
4 changes: 4 additions & 0 deletions src/KDUtils/kdutils_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@

#pragma once

#include <KDUtils/kdutils_export.h>

#define KDUTILS_API KDUTILS_EXPORT

#define KD_UNUSED(x) (void)x;
4 changes: 2 additions & 2 deletions src/KDUtils/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#pragma once

#include <KDUtils/kdutils_export.h>
#include <KDUtils/kdutils_global.h>

#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
Expand All @@ -19,7 +19,7 @@

namespace KDUtils {

class KDUTILS_EXPORT Logger
class KDUTILS_API Logger
{
public:
static std::shared_ptr<spdlog::logger> logger(const std::string &name, spdlog::level::level_enum defaultLevel = spdlog::level::warn);
Expand Down
4 changes: 2 additions & 2 deletions src/KDUtils/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ Url Url::fromLocalFile(const std::string &url)
return Url(std::string("file://") + path);
}

KDUTILS_EXPORT bool operator==(const Url &a, const Url &b)
bool operator==(const Url &a, const Url &b)
{
return a.url() == b.url();
}

KDUTILS_EXPORT bool operator!=(const Url &a, const Url &b)
bool operator!=(const Url &a, const Url &b)
{
return !(a == b);
}
Expand Down
8 changes: 4 additions & 4 deletions src/KDUtils/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
#ifndef KDUTILS_URL_H
#define KDUTILS_URL_H

#include <KDUtils/kdutils_export.h>
#include <KDUtils/kdutils_global.h>
#include <string>

namespace KDUtils {

class KDUTILS_EXPORT Url
class KDUTILS_API Url
{
public:
Url() = default;
Expand All @@ -41,8 +41,8 @@ class KDUTILS_EXPORT Url
std::string m_path;
};

KDUTILS_EXPORT bool operator==(const Url &a, const Url &b);
KDUTILS_EXPORT bool operator!=(const Url &a, const Url &b);
KDUTILS_API bool operator==(const Url &a, const Url &b);
KDUTILS_API bool operator!=(const Url &a, const Url &b);

} // namespace KDUtils

Expand Down

0 comments on commit a0ed4d6

Please sign in to comment.