Skip to content

Commit 7b36b84

Browse files
committed
Don't include fmt.h in text_types.h
1 parent 958641d commit 7b36b84

40 files changed

+85
-39
lines changed

gframe/Android/COSAndroidOperator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static inline int android_get_device_api_level() {
2020
#endif
2121
#include "COSAndroidOperator.h"
2222
#include "porting_android.h"
23+
#include "../fmt.h"
2324

2425
namespace irr {
2526

gframe/CGUISkinSystem/CGUISkinSystem.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <string>
99
#include <set>
1010
#include "../utils.h"
11+
#include "../fmt.h"
1112

1213
using namespace irr;
1314

@@ -119,7 +120,7 @@ gui::CImageGUISkin* CGUISkinSystem::loadSkinFromFile(const fschar_t *skinname) {
119120
// is to make the registry write out the root node and see what comes out.
120121
//registry->writeFile("Skin",".");
121122

122-
// To switch on the fly, we have to set the skin to the fallback skin first
123+
// To switch on the fly, we have to set the skin to the fallback skin first
123124
tmp = registry->getValueAsCStr(L"skin", L"Skin/Properties/Fallback");
124125
// Always default to metalic
125126
fallbackType = gui::EGST_WINDOWS_METALLIC;
@@ -156,7 +157,7 @@ gui::CImageGUISkin* CGUISkinSystem::loadSkinFromFile(const fschar_t *skinname) {
156157
skinConfig.CheckBoxColor = registry->getValueAsColor(L"Skin/Global/CheckBoxColor");
157158

158159
// If there was no progress bar colors set, set them in the config to the defaults
159-
// otherwise their 0,0,0,0. This is neccicary for the old klagui.
160+
// otherwise their 0,0,0,0. This is neccicary for the old klagui.
160161

161162
if(skinConfig.ProgressBarFilled.Color == 0)
162163
skinConfig.ProgressBarFilled.Color = video::SColor(255, 255, 0, 0);
@@ -380,10 +381,10 @@ bool CGUISkinSystem::applySkin(const fschar_t *skinname) {
380381
}
381382
device->getGUIEnvironment()->setSkin(skin);
382383
loaded_skin = skin;
383-
// If we're going to switch skin we need to find all the progress bars and overwrite their colors
384+
// If we're going to switch skin we need to find all the progress bars and overwrite their colors
384385
skin->drop();
385386
registry = nullptr;
386387
//fs->changeWorkingDirectoryTo(oldpath);
387388

388389
return true;
389-
}
390+
}

gframe/CGUITTFont/CGUITTFont.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <IMeshSceneNode.h>
4141
#include <unordered_set>
4242
#include <climits>
43+
#include "../fmt.h"
4344
#ifdef YGOPRO_USE_BUNDLED_FONT
4445
extern const char* bundled_font_name;
4546
extern const size_t bundled_font_len;

gframe/address.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "address.h"
33
#include "bufferio.h"
44
#include "config.h"
5+
#include "fmt.h"
56
#if EDOPRO_ANDROID
67
#include <netinet/in.h>
78
#endif
@@ -42,19 +43,17 @@ void Address::toIn6Addr(in6_addr& sin6_addr) const {
4243
memcpy(sin6_addr.s6_addr, buffer, sizeof(in6_addr::s6_addr));
4344
}
4445

45-
template<>
46-
std::basic_string<char> Address::format() const {
47-
if(family == UNK)
46+
std::string format_address(const Address& address) {
47+
if(address.family == address.UNK)
4848
return "";
4949
char ret[50]{};
50-
if(evutil_inet_ntop(family == INET ? AF_INET : AF_INET6, buffer, ret, sizeof(ret)) == nullptr)
50+
if(evutil_inet_ntop(address.family == address.INET ? AF_INET : AF_INET6, address.buffer, ret, sizeof(ret)) == nullptr)
5151
return "";
5252
return ret;
5353
}
5454

55-
template<>
56-
std::basic_string<wchar_t> Address::format() const {
57-
return BufferIO::DecodeUTF8(format<char>());
55+
std::wstring wformat_address(const Address& address) {
56+
return BufferIO::DecodeUTF8(format_address(address));
5857
}
5958

6059
bool Host::operator==(const Host& other) const {

gframe/address.h

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <cstdint>
55
#include <string>
6-
#include "fmt.h"
76
#include "bufferio.h"
87
#include "text_types.h"
98

@@ -16,6 +15,7 @@ namespace epro {
1615

1716
struct Address {
1817
friend struct Host;
18+
friend std::string format_address(const Address& address);
1919
private:
2020
uint8_t buffer[32]{}; //buffer big enough to store an ipv6
2121
public:
@@ -30,8 +30,6 @@ struct Address {
3030
AF family;
3131
void setIP4(const uint32_t* ip);
3232
void setIP6(const void* ip);
33-
template<typename T>
34-
std::basic_string<T> format() const;
3533
void toInAddr(in_addr& sin_addr) const;
3634
void toIn6Addr(in6_addr& sin6_addr) const;
3735
};
@@ -46,22 +44,9 @@ struct Host {
4644
static Host resolve(epro::stringview address, uint16_t port);
4745
};
4846

49-
template<>
50-
std::basic_string<char> Address::format() const;
51-
template<>
52-
std::basic_string<wchar_t> Address::format() const;
53-
}
54-
55-
template<typename T>
56-
struct fmt::formatter<epro::Address, T> {
57-
template<typename ParseContext>
58-
constexpr auto parse(ParseContext& ctx) const { return ctx.begin(); }
47+
std::string format_address(const Address&);
48+
std::wstring wformat_address(const Address&);
5949

60-
template<typename FormatContext>
61-
auto format(const epro::Address& address, FormatContext& ctx) const {
62-
static constexpr auto format_str = CHAR_T_STRINGVIEW(T, "{}");
63-
return format_to(ctx.out(), format_str, address.format<T>());
64-
}
65-
};
50+
}
6651

6752
#endif //ADDRESS_H

gframe/bufferio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef BUFFERIO_H
22
#define BUFFERIO_H
33

4+
#include <algorithm>
45
#include <string>
56
#include <vector>
67
#include <cstring>

gframe/client_card.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "data_manager.h"
33
#include "common.h"
44
#include "client_card.h"
5+
#include "fmt.h"
56

67
namespace ygo {
78

gframe/client_field.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "CGUIImageButton/CGUIImageButton.h"
2222
#include "CGUITTFont/CGUITTFont.h"
2323
#include "custom_skin_enum.h"
24+
#include "fmt.h"
2425

2526
namespace ygo {
2627

gframe/client_updater.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "utils.h"
2121
#include "porting.h"
2222
#include "game_config.h"
23+
#include "fmt.h"
2324

2425
#define LOCKFILE EPRO_TEXT("./.edopro_lock")
2526
#define UPDATES_FOLDER EPRO_TEXT("./updates/{}")

gframe/data_handler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "utils_gui.h"
77
#include "deck_manager.h"
88
#include "logging.h"
9+
#include "fmt.h"
910
#include "utils.h"
1011
#include "windbot.h"
1112
#include "windbot_panel.h"

0 commit comments

Comments
 (0)