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 коммит произвёл Facebook GitHub Bot
Родитель a9bed8e75d
Коммит e504141583
12 изменённых файлов: 23 добавлений и 35 удалений

Просмотреть файл

@ -17,6 +17,7 @@
#import <butter/map.h>
using namespace facebook;
using namespace facebook::react;
const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;

Просмотреть файл

@ -39,6 +39,7 @@
#import "PlatformRunLoopObserver.h"
#import "RCTConversions.h"
using namespace facebook;
using namespace facebook::react;
static dispatch_queue_t RCTGetBackgroundQueue()

Просмотреть файл

@ -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()) {

Просмотреть файл

@ -8,14 +8,8 @@
#pragma once
#include <fbjni/fbjni.h>
#include <jsi/jsi.h>
#include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
#include <react/renderer/scheduler/Scheduler.h>
#include <react/utils/ContextContainer.h>
#include <mutex>
#include <unordered_set>
using namespace facebook::jsi;
namespace facebook {
namespace react {

Просмотреть файл

@ -13,9 +13,7 @@
namespace facebook {
namespace react {
using namespace facebook::jni;
class JBackgroundExecutor : public JavaClass<JBackgroundExecutor> {
class JBackgroundExecutor : public jni::JavaClass<JBackgroundExecutor> {
public:
static auto constexpr kJavaDescriptor =
"Lcom/facebook/react/bridge/BackgroundExecutor;";

Просмотреть файл

@ -8,13 +8,12 @@
#pragma once
#include <fbjni/fbjni.h>
#include "Binding.h"
using namespace facebook::jni;
#include "Binding.h"
namespace facebook::react {
class JFabricUIManager : public JavaClass<JFabricUIManager> {
class JFabricUIManager : public jni::JavaClass<JFabricUIManager> {
public:
static constexpr auto kJavaDescriptor =
"Lcom/facebook/react/fabric/FabricUIManager;";

Просмотреть файл

@ -18,6 +18,8 @@
namespace facebook {
namespace react {
using namespace jni;
namespace {
struct JavaJSException : jni::JavaClass<JavaJSException, JThrowable> {

Просмотреть файл

@ -12,10 +12,7 @@
#include <cxxreact/MessageQueueThread.h>
#include <fbjni/fbjni.h>
using namespace facebook::jni;
namespace facebook {
namespace react {
namespace facebook::react {
class JavaMessageQueueThread : public jni::JavaClass<JavaMessageQueueThread> {
public:
@ -25,7 +22,7 @@ class JavaMessageQueueThread : public jni::JavaClass<JavaMessageQueueThread> {
class JMessageQueueThread : public MessageQueueThread {
public:
JMessageQueueThread(alias_ref<JavaMessageQueueThread::javaobject> jobj);
JMessageQueueThread(jni::alias_ref<JavaMessageQueueThread::javaobject> jobj);
/**
* Enqueues the given function to run on this MessageQueueThread.
@ -50,8 +47,7 @@ class JMessageQueueThread : public MessageQueueThread {
}
private:
global_ref<JavaMessageQueueThread::javaobject> m_jobj;
jni::global_ref<JavaMessageQueueThread::javaobject> m_jobj;
};
} // namespace react
} // namespace facebook
} // namespace facebook::react

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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}};

Просмотреть файл

@ -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