Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C++17 namespace format everywhere #36987

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/react-native/Libraries/Blob/RCTBlobCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

@class RCTBlobManager;

namespace facebook {
namespace react {
namespace facebook::react {

class JSI_EXPORT RCTBlobCollector : public jsi::HostObject {
public:
Expand All @@ -24,5 +23,4 @@ class JSI_EXPORT RCTBlobCollector : public jsi::HostObject {
RCTBlobManager *blobManager_;
};

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/Libraries/Blob/RCTBlobCollector.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#import <React/RCTBlobManager.h>
#import <React/RCTBridge+Private.h>

namespace facebook {
namespace react {
namespace facebook::react {

RCTBlobCollector::RCTBlobCollector(RCTBlobManager *blobManager, const std::string &blobId)
: blobId_(blobId), blobManager_(blobManager)
Expand Down Expand Up @@ -52,5 +51,4 @@
queue:RCTJSThread];
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

// TODO (T61325135): Remove C++ checks
#ifdef __cplusplus
namespace facebook {
namespace react {
namespace facebook::react {

struct ImageURLLoaderAttribution {
int32_t nativeViewTag = 0;
Expand All @@ -21,8 +20,7 @@ struct ImageURLLoaderAttribution {
NSString *analyticTag;
};

} // namespace react
} // namespace facebook
} // namespace facebook::react
#endif

@interface RCTImageURLLoaderRequest : NSObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@

#import <FBLazyVector/FBLazyVector.h>

namespace facebook {
namespace react {
namespace facebook::react {
template <typename T>
using LazyVector = FB::LazyVector<T, id>;
}
}
} // namespace facebook::react

template <typename ContainerT>
NSArray *RCTConvertVecToArray(const ContainerT &vec, id (^convertor)(typename ContainerT::value_type element))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@

@end

namespace facebook {
namespace react {
namespace facebook::react {

// Objective-C doesn't allow arbitrary types in its lightweight generics, only object and block types. We can work
// around that by having the struct type we care about be a block-argument. The block never exists at runtime.
Expand All @@ -45,5 +44,4 @@ ModuleConstants<T> typedConstants(typename T::Builder::Input &&value)
return [_RCTTypedModuleConstants newWithUnsafeDictionary:builder.buildUnsafeRawValue()];
}

}
}
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/Base/RCTManagedPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

@end

namespace facebook {
namespace react {
namespace facebook::react {

template <typename T, typename P>
RCTManagedPointer *managedPointer(P initializer)
Expand All @@ -34,7 +33,6 @@ RCTManagedPointer *managedPointer(P initializer)
return [[RCTManagedPointer alloc] initWithPointer:std::move(ptr)];
}

}
}
} // namespace facebook::react

#endif
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/JSCExecutorFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include <jsireact/JSIExecutor.h>

namespace facebook {
namespace react {
namespace facebook::react {

class JSCExecutorFactory : public JSExecutorFactory {
public:
Expand All @@ -25,5 +24,4 @@ class JSCExecutorFactory : public JSExecutorFactory {
JSIExecutor::RuntimeInstaller runtimeInstaller_;
};

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/JSCExecutorFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

#import <memory>

namespace facebook {
namespace react {
namespace facebook::react {

std::unique_ptr<JSExecutor> JSCExecutorFactory::createJSExecutor(
std::shared_ptr<ExecutorDelegate> delegate,
Expand All @@ -22,5 +21,4 @@
facebook::jsc::makeJSCRuntime(), delegate, JSIExecutor::defaultTimeoutInvoker, runtimeInstaller_);
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/NSDataBigString.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include <cxxreact/JSBigString.h>

namespace facebook {
namespace react {
namespace facebook::react {

class NSDataBigString : public JSBigString {
public:
Expand Down Expand Up @@ -38,5 +37,4 @@ class NSDataBigString : public JSBigString {
size_t m_length;
};

}
}
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/NSDataBigString.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#import "NSDataBigString.h"

namespace facebook {
namespace react {
namespace facebook::react {

static NSData *ensureNullTerminated(NSData *source)
{
Expand Down Expand Up @@ -39,5 +38,4 @@
m_data = ensureNullTerminated(data);
}

}
}
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/RCTCxxBridgeDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@

#import <React/RCTBridgeDelegate.h>

namespace facebook {
namespace react {
namespace facebook::react {

class JSExecutorFactory;

}
}
} // namespace facebook::react

// This is a separate class so non-C++ implementations don't need to
// take a C++ dependency.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include <jsireact/JSIExecutor.h>

namespace facebook {
namespace react {
namespace facebook::react {

/**
* Creates a lambda used to bind a JSIRuntime in the context of
Expand All @@ -19,5 +18,4 @@ namespace react {
JSIExecutor::RuntimeInstaller RCTJSIExecutorRuntimeInstaller(
JSIExecutor::RuntimeInstaller runtimeInstallerToWrap);

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#import <React/RCTLog.h>
#include <chrono>

namespace facebook {
namespace react {
namespace facebook::react {

JSIExecutor::RuntimeInstaller RCTJSIExecutorRuntimeInstaller(JSIExecutor::RuntimeInstaller runtimeInstallerToWrap)
{
Expand All @@ -29,5 +28,4 @@
};
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/RCTMessageThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#import <React/RCTJavaScriptExecutor.h>
#import <cxxreact/MessageQueueThread.h>

namespace facebook {
namespace react {
namespace facebook::react {

class RCTMessageThread : public MessageQueueThread,
public std::enable_shared_from_this<RCTMessageThread> {
Expand All @@ -36,5 +35,4 @@ class RCTMessageThread : public MessageQueueThread,
std::atomic_bool m_shutdown;
};

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/RCTMessageThread.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
// particular, the sync functions are only used for bridge setup and
// teardown, and quitSynchronous is guaranteed to be called.

namespace facebook {
namespace react {
namespace facebook::react {

RCTMessageThread::RCTMessageThread(NSRunLoop *runLoop, RCTJavaScriptCompleteBlock errorBlock)
: m_cfRunLoop([runLoop getCFRunLoop]), m_errorBlock(errorBlock), m_shutdown(false)
Expand Down Expand Up @@ -110,5 +109,4 @@
CFRetain(m_cfRunLoop);
}

}
}
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/RCTObjcExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#import <React/RCTJavaScriptExecutor.h>
#import <cxxreact/JSExecutor.h>

namespace facebook {
namespace react {
namespace facebook::react {

class RCTObjcExecutorFactory : public JSExecutorFactory {
public:
Expand All @@ -29,5 +28,4 @@ class RCTObjcExecutorFactory : public JSExecutorFactory {
RCTJavaScriptCompleteBlock m_errorBlock;
};

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxBridge/RCTObjcExecutor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#import <cxxreact/RAMBundleRegistry.h>
#import <folly/json.h>

namespace facebook {
namespace react {
namespace facebook::react {

namespace {

Expand Down Expand Up @@ -144,5 +143,4 @@ virtual void setGlobalVariable(std::string propName, std::unique_ptr<const JSBig
return std::unique_ptr<JSExecutor>(new RCTObjcExecutor(m_jse, m_errorBlock, jsQueue, delegate));
}

}
}
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

#import <logger/react_native_log.h>

namespace facebook {
namespace react {
namespace facebook::react {

void RCTDefaultCxxLogFunction(ReactNativeLogLevel level, const char *message);

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#import <React/RCTLog.h>
#import <glog/logging.h>

namespace facebook {
namespace react {
namespace facebook::react {

void RCTDefaultCxxLogFunction(ReactNativeLogLevel level, const char *message)
{
Expand All @@ -35,5 +34,4 @@ void RCTDefaultCxxLogFunction(ReactNativeLogLevel level, const char *message)
}
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <React/RCTLog.h>
#include <cxxreact/MessageQueueThread.h>

namespace facebook {
namespace react {
namespace facebook::react {

// RCTNativeModule arranges for native methods to be invoked on a queue which
// is not the JS thread. C++ modules don't use RCTNativeModule, so this little
Expand Down Expand Up @@ -43,5 +42,4 @@ class DispatchMessageQueueThread : public MessageQueueThread {
RCTModuleData *moduleData_;
};

}
}
} // namespace facebook::react
8 changes: 2 additions & 6 deletions packages/react-native/React/CxxModule/RCTCxxModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@

#import <React/RCTBridgeModule.h>

namespace facebook {
namespace xplat {
namespace module {
namespace facebook::xplat::module {
class CxxModule;
}
}
}
} // namespace facebook::react::module

/**
* Subclass RCTCxxModule to use cross-platform CxxModule on iOS.
Expand Down
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxModule/RCTCxxUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
@class RCTBridge;
@class RCTModuleData;

namespace facebook {
namespace react {
namespace facebook::react {

class Instance;
class NativeModule;
Expand All @@ -25,5 +24,4 @@ createNativeModules(NSArray<RCTModuleData *> *modules, RCTBridge *bridge, const
NSError *tryAndReturnError(const std::function<void()> &func);
NSString *deriveSourceURL(NSURL *url);

}
}
} // namespace facebook::react
6 changes: 2 additions & 4 deletions packages/react-native/React/CxxModule/RCTCxxUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#import "RCTCxxModule.h"
#import "RCTNativeModule.h"

namespace facebook {
namespace react {
namespace facebook::react {

using facebook::jsi::JSError;

Expand Down Expand Up @@ -101,5 +100,4 @@
return sourceUrl ?: @"";
}

}
}
} // namespace facebook::react
Loading