8000 Interface full lockdown: mark implementation details private instead … · dok-net/arduino-esp8266@ee86f2e · GitHub
[go: up one dir, main page]

Skip to content

Commit ee86f2e

Browse files
committed
Interface full lockdown: mark implementation details private instead of protected.
1 parent 534d016 commit ee86f2e

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

cores/esp8266/Delegate.h

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ namespace detail
4444
class DelegatePImpl {
4545
public:
4646
using target_type = R(P...);
47-
using FunPtr = R(*)(P...);
47+
private:
48+
using FunPtr = target_type*;
4849
using FunAPtr = R(*)(A, P...);
4950
using FunctionType = std::function<target_type>;
50-
51+
public:
5152
DelegatePImpl()
5253
{
5354
fn = nullptr;
@@ -304,7 +305,7 @@ namespace detail
304305
}
305306
}
306307

307-
protected:
308+
private:
308309
enum { FUNC, FP, FPA } kind = FP;
309310
union {
310311
FunctionType functional;
@@ -320,9 +321,10 @@ namespace detail
320321
class DelegatePImpl {
321322
public:
322323
using target_type = R(P...);
323-
using FunPtr = R(*)(P...);
324+
private:
325+
using FunPtr = target_type*;
324326
using FunAPtr = R(*)(A, P...);
325-
327+
public:
326328
DelegatePImpl()
327329
{
328330
fn = nullptr;
@@ -473,7 +475,7 @@ namespace detail
473475
}
474476
}
475477

476-
protected:
478+
private:
477479
enum { FP, FPA } kind = FP;
478480
union {
479481
FunPtr fn;
@@ -488,9 +490,10 @@ namespace detail
488490
class DelegatePImpl<void, R, P...> {
489491
public:
490492
using target_type = R(P...);
491-
using FunPtr = R(*)(P...);
493+
private:
494+
using FunPtr = target_type*;
492495
using FunctionType = std::function<target_type>;
493-
496+
public:
494497
DelegatePImpl()
495498
{
496499
fn = nullptr;
@@ -665,7 +668,7 @@ namespace detail
665668
}
666669
}
667670

668-
protected:
671+
private:
669672
enum { FUNC, FP } kind = FP;
670673
union {
671674
FunctionType functional;
@@ -677,8 +680,9 @@ namespace detail
677680
class DelegatePImpl<void, R, P...> {
678681
public:
679682
using target_type = R(P...);
680-
using FunPtr = R(*)(P...);
681-
683+
private:
684+
using FunPtr = target_type*;
685+
public:
682686
DelegatePImpl()
683687
{
684688
fn = nullptr;
@@ -740,7 +744,7 @@ namespace detail
740744
return fn(std::forward<P...>(args...));
741745
}
742746

743-
protected:
747+
private:
744748
FunPtr fn;
745749
};
746750
#endif
@@ -750,10 +754,11 @@ namespace detail
750754
class DelegateImpl {
751755
public:
752756
using target_type = R();
753-
using FunPtr = R(*)();
757+
private:
758+
using FunPtr = target_type*;
754759
using FunAPtr = R(*)(A);
755760
using FunctionType = std::function<target_type>;
756-
761+
public:
757762
DelegateImpl()
758763
{
759764
fn = nullptr;
@@ -1010,7 +1015,7 @@ namespace detail
10101015
}
10111016
}
10121017

1013-
protected:
1018+
private:
10141019
enum { FUNC, FP, FPA } kind = FP;
10151020
union {
10161021
FunctionType functional;
@@ -1026,9 +1031,10 @@ namespace detail
10261031
class DelegateImpl {
10271032
public:
10281033
using target_type = R();
1029-
using FunPtr = R(*)();
1034+
private:
1035+
using FunPtr = target_type*;
10301036
using FunAPtr = R(*)(A);
1031-
1037+
public:
10321038
DelegateImpl()
10331039
{
10341040
fn = nullptr;
@@ -1179,7 +1185,7 @@ namespace detail
11791185
}
11801186
}
11811187

1182-
protected:
1188+
private:
11831189
enum { FP, FPA } kind = FP;
11841190
union {
11851191
FunPtr fn;
@@ -1194,9 +1200,10 @@ namespace detail
11941200
class DelegateImpl<void, R> {
11951201
public:
11961202
using target_type = R();
1197-
using FunPtr = R(*)();
1203+
private:
1204+
using FunPtr = target_type*;
11981205
using FunctionType = std::function<target_type>;
1199-
1206+
public:
12001207
DelegateImpl()
12011208
{
12021209
fn = nullptr;
@@ -1371,7 +1378,7 @@ namespace detail
13711378
}
13721379
}
13731380

1374-
protected:
1381+
private:
13751382
enum { FUNC, FP } kind = FP;
13761383
union {
13771384
FunctionType functional;
@@ -1383,8 +1390,9 @@ namespace detail
13831390
class DelegateImpl<void, R> {
13841391
public:
13851392
using target_type = R();
1386-
usi F438 ng FunPtr = R(*)();
1387-
1393+
private:
1394+
using FunPtr = target_type*;
1395+
public:
13881396
DelegateImpl()
13891397
{
13901398
fn = nullptr;
@@ -1446,20 +1454,22 @@ namespace detail
14461454
return fn();
14471455
}
14481456

1449-
protected:
1457+
private:
14501458
FunPtr fn;
14511459
};
14521460
#endif
14531461

14541462
template<typename R = void, typename A = void, typename... P>
14551463
class Delegate : public detail::DelegatePImpl<A, R, P...>
14561464
{
1465+
public:
14571466
using detail::DelegatePImpl<A, R, P...>::DelegatePImpl;
14581467
};
14591468

14601469
template<typename R, typename A>
14611470
class Delegate<R, A> : public detail::DelegateImpl<A, R>
14621471
{
1472+
public:
14631473
using detail::DelegateImpl<A, R>::DelegateImpl;
14641474
};
14651475

@@ -1468,10 +1478,12 @@ namespace detail
14681478
template<typename R, typename A = void, typename... P> class Delegate;
14691479
template<typename R, typename A, typename... P> class Delegate<R(P...), A> : public detail::Delegate<R, A, P...>
14701480
{
1481+
public:
14711482
using detail::Delegate<R, A, P...>::Delegate;
14721483
};
14731484
template<typename R, typename... P> class Delegate<R(P...)> : public detail::Delegate<R, void, P...>
14741485
{
1486+
public:
14751487
using detail::Delegate<R, void, P...>::Delegate;
14761488
};
14771489

0 commit comments

Comments
 (0)
0