Remove 'using namespace' from header files

Summary:
Fix linter warning when pulling in some code into AR

Changelog: [Internal]

Reviewed By: NickGerleman, mdvacca

Differential Revision: D41269423

fbshipit-source-id: 4305d6c362a51e62b19b4d3590fb0823073dff9a
This commit is contained in:
Pieter De Baets
2022-11-17 06:19:07 -08:00
committed by Facebook GitHub Bot
parent 5a257aac85
commit eea87c3abc
5 changed files with 11 additions and 14 deletions

View File

@@ -11,9 +11,6 @@
#include <map>
#include "common.h"
using namespace facebook::yoga::vanillajni;
using namespace std;
class PtrJNodeMapVanilla {
std::map<YGNodeRef, size_t> ptrsToIdxs_;
jobjectArray javaNodes_;
@@ -22,6 +19,7 @@ public:
PtrJNodeMapVanilla() : ptrsToIdxs_{}, javaNodes_{} {}
PtrJNodeMapVanilla(jlongArray javaNativePointers, jobjectArray javaNodes)
: javaNodes_{javaNodes} {
using namespace facebook::yoga::vanillajni;
JNIEnv* env = getCurrentEnv();
size_t nativePointersSize = env->GetArrayLength(javaNativePointers);
@@ -34,7 +32,9 @@ public:
}
}
ScopedLocalRef<jobject> ref(YGNodeRef node) {
facebook::yoga::vanillajni::ScopedLocalRef<jobject> ref(YGNodeRef node) {
using namespace facebook::yoga::vanillajni;
JNIEnv* env = getCurrentEnv();
auto idx = ptrsToIdxs_.find(node);
if (idx == ptrsToIdxs_.end()) {

View File

@@ -74,7 +74,7 @@ YGFloatOptional YGFloatOptionalMax(YGFloatOptional op1, YGFloatOptional op2) {
return op1.isUndefined() ? op2 : op1;
}
void throwLogicalErrorWithMessage(const char* message) {
void yoga::throwLogicalErrorWithMessage(const char* message) {
#if defined(__cpp_exceptions)
throw std::logic_error(message);
#else // !defined(__cpp_exceptions)

View File

@@ -117,7 +117,7 @@ inline YGFloatOptional YGResolveValue(
}
inline YGFloatOptional YGResolveValue(
yoga::detail::CompactValue value,
facebook::yoga::detail::CompactValue value,
float ownerSize) {
return YGResolveValue((YGValue) value, ownerSize);
}
@@ -142,11 +142,9 @@ inline YGFlexDirection YGResolveFlexDirection(
}
inline YGFloatOptional YGResolveValueMargin(
yoga::detail::CompactValue value,
facebook::yoga::detail::CompactValue value,
const float ownerSize) {
return value.isAuto() ? YGFloatOptional{0} : YGResolveValue(value, ownerSize);
}
void throwLogicalErrorWithMessage(const char* message);
#endif

View File

@@ -13,8 +13,6 @@
#include "YGFloatOptional.h"
#include "Yoga-internal.h"
using namespace facebook::yoga;
struct YGLayout {
std::array<float, 4> position = {};
std::array<float, 2> dimensions = {{YGUndefined, YGUndefined}};

View File

@@ -40,11 +40,11 @@ inline bool isUndefined(double value) {
return std::isnan(value);
}
void throwLogicalErrorWithMessage(const char* message);
} // namespace yoga
} // namespace facebook
using namespace facebook;
extern const std::array<YGEdge, 4> trailing;
extern const std::array<YGEdge, 4> leading;
extern const YGValue YGValueUndefined;
@@ -69,6 +69,8 @@ struct YGCachedMeasurement {
computedHeight(-1) {}
bool operator==(YGCachedMeasurement measurement) const {
using namespace facebook;
bool isEqual = widthMeasureMode == measurement.widthMeasureMode &&
heightMeasureMode == measurement.heightMeasureMode;
@@ -141,7 +143,6 @@ public:
Values& operator=(const Values& other) = default;
};
} // namespace detail
} // namespace yoga
} // namespace facebook