diff --git a/native/cocos/3d/assets/MorphRendering.cpp b/native/cocos/3d/assets/MorphRendering.cpp index 36076b8819..4c0ce11be9 100644 --- a/native/cocos/3d/assets/MorphRendering.cpp +++ b/native/cocos/3d/assets/MorphRendering.cpp @@ -160,7 +160,7 @@ private: }; struct GpuMorphAttribute { - ccstd::string attributeName; + ccstd::string attributeName; IntrusivePtr morphTexture; }; @@ -171,7 +171,7 @@ struct CpuMorphAttributeTarget { using CpuMorphAttributeTargetList = ccstd::vector; struct CpuMorphAttribute { - ccstd::string name; + ccstd::string name; CpuMorphAttributeTargetList targets; }; diff --git a/native/cocos/3d/assets/Skeleton.cpp b/native/cocos/3d/assets/Skeleton.cpp index b9801ed4c9..03bff171db 100644 --- a/native/cocos/3d/assets/Skeleton.cpp +++ b/native/cocos/3d/assets/Skeleton.cpp @@ -54,7 +54,7 @@ uint64_t Skeleton::getHash() { << ibm.m[12] << " " << ibm.m[13] << " " << ibm.m[14] << " " << ibm.m[15] << "\n"; } ccstd::string str{sstr.str()}; - std::size_t seed = 666; + std::size_t seed = 666; boost::hash_range(seed, str.begin(), str.end()); _hash = static_cast(seed); } diff --git a/native/cocos/3d/assets/Skeleton.h b/native/cocos/3d/assets/Skeleton.h index 8dcc4ce044..18c93542e8 100644 --- a/native/cocos/3d/assets/Skeleton.h +++ b/native/cocos/3d/assets/Skeleton.h @@ -83,7 +83,7 @@ public: bool validate() const override; private: - ccstd::vector _joints; + ccstd::vector _joints; ccstd::vector _bindposes; cc::optional> _invBindposes; uint64_t _hash{0}; diff --git a/native/cocos/3d/misc/Buffer.cpp b/native/cocos/3d/misc/Buffer.cpp index cf29d91515..165b9f4c56 100644 --- a/native/cocos/3d/misc/Buffer.cpp +++ b/native/cocos/3d/misc/Buffer.cpp @@ -40,7 +40,7 @@ Record typeMap{ ccstd::string getDataViewType(const gfx::FormatInfo &info) { ccstd::string type; - auto iter = typeMap.find(info.type); + auto iter = typeMap.find(info.type); if (iter != typeMap.end()) { type = iter->second; } else { diff --git a/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.cpp b/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.cpp index c0b289e255..55ecf34d10 100644 --- a/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.cpp +++ b/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.cpp @@ -178,10 +178,10 @@ cc::optional JointTexturePool::getDefaultPoseTexture(Skel } const ccstd::vector &joints = skeleton->getJoints(); - const ccstd::vector & bindPoses = skeleton->getBindposes(); - Float32Array textureBuffer; - bool buildTexture = false; - auto jointCount = static_cast(joints.size()); + const ccstd::vector & bindPoses = skeleton->getBindposes(); + Float32Array textureBuffer; + bool buildTexture = false; + auto jointCount = static_cast(joints.size()); if (!texture.has_value()) { uint32_t bufSize = jointCount * 12; ITextureBufferHandle handle; diff --git a/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h b/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h index 9548349bea..3a04336b4e 100644 --- a/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h +++ b/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h @@ -147,7 +147,7 @@ public: private: ccstd::unordered_map _pool; // pre node - gfx::Device * _device{nullptr}; + gfx::Device * _device{nullptr}; CC_DISALLOW_COPY_MOVE_ASSIGN(JointAnimationInfo); }; diff --git a/native/cocos/audio/AudioEngine.cpp b/native/cocos/audio/AudioEngine.cpp index 9274af79ae..68dfd79ae9 100644 --- a/native/cocos/audio/AudioEngine.cpp +++ b/native/cocos/audio/AudioEngine.cpp @@ -62,10 +62,10 @@ const float AudioEngine::TIME_UNKNOWN = -1.0F; ccstd::unordered_map> AudioEngine::sAudioPathIDMap; //profileName,ProfileHelper ccstd::unordered_map AudioEngine::sAudioPathProfileHelperMap; -unsigned int AudioEngine::sMaxInstances = MAX_AUDIOINSTANCES; -AudioEngine::ProfileHelper * AudioEngine::sDefaultProfileHelper = nullptr; -ccstd::unordered_map AudioEngine::sAudioIDInfoMap; -AudioEngineImpl * AudioEngine::sAudioEngineImpl = nullptr; +unsigned int AudioEngine::sMaxInstances = MAX_AUDIOINSTANCES; +AudioEngine::ProfileHelper * AudioEngine::sDefaultProfileHelper = nullptr; +ccstd::unordered_map AudioEngine::sAudioIDInfoMap; +AudioEngineImpl * AudioEngine::sAudioEngineImpl = nullptr; float AudioEngine::sVolumeFactor = 1.0F; uint32_t AudioEngine::sOnPauseListenerID = 0; diff --git a/native/cocos/audio/android/AudioDecoder.h b/native/cocos/audio/android/AudioDecoder.h index 2712745d02..d8ba5f8594 100644 --- a/native/cocos/audio/android/AudioDecoder.h +++ b/native/cocos/audio/android/AudioDecoder.h @@ -43,19 +43,19 @@ public: protected: virtual bool decodeToPcm() = 0; - bool resample(); - bool interleave(); + bool resample(); + bool interleave(); static size_t fileRead(void *ptr, size_t size, size_t nmemb, void *datasource); - static int fileSeek(void *datasource, int64_t offset, int whence); - static int fileClose(void *datasource); - static long fileTell(void *datasource); + static int fileSeek(void *datasource, int64_t offset, int whence); + static int fileClose(void *datasource); + static long fileTell(void *datasource); ccstd::string _url; - PcmData _result; - int _sampleRate; - Data _fileData; - size_t _fileCurrPos; + PcmData _result; + int _sampleRate; + Data _fileData; + size_t _fileCurrPos; }; } // namespace cc diff --git a/native/cocos/audio/android/AudioDecoderMp3.cpp b/native/cocos/audio/android/AudioDecoderMp3.cpp index b41ad9c13c..e18e2b69a2 100644 --- a/native/cocos/audio/android/AudioDecoderMp3.cpp +++ b/native/cocos/audio/android/AudioDecoderMp3.cpp @@ -44,24 +44,24 @@ bool AudioDecoderMp3::decodeToPcm() { } mp3_callbacks callbacks; - callbacks.read = AudioDecoder::fileRead; - callbacks.seek = AudioDecoder::fileSeek; + callbacks.read = AudioDecoder::fileRead; + callbacks.seek = AudioDecoder::fileSeek; callbacks.close = AudioDecoder::fileClose; - callbacks.tell = AudioDecoder::fileTell; + callbacks.tell = AudioDecoder::fileTell; int numChannels = 0; - int sampleRate = 0; - int numFrames = 0; + int sampleRate = 0; + int numFrames = 0; if (EXIT_SUCCESS == decodeMP3(&callbacks, this, *_result.pcmBuffer, &numChannels, &sampleRate, &numFrames) && numChannels > 0 && sampleRate > 0 && numFrames > 0) { - _result.numChannels = numChannels; - _result.sampleRate = sampleRate; + _result.numChannels = numChannels; + _result.sampleRate = sampleRate; _result.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16; _result.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16; - _result.channelMask = numChannels == 1 ? SL_SPEAKER_FRONT_CENTER : (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT); - _result.endianness = SL_BYTEORDER_LITTLEENDIAN; - _result.numFrames = numFrames; - _result.duration = 1.0f * numFrames / sampleRate; + _result.channelMask = numChannels == 1 ? SL_SPEAKER_FRONT_CENTER : (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT); + _result.endianness = SL_BYTEORDER_LITTLEENDIAN; + _result.numFrames = numFrames; + _result.duration = 1.0f * numFrames / sampleRate; ccstd::string info = _result.toString(); ALOGI("Original audio info: %s, total size: %d", info.c_str(), (int)_result.pcmBuffer->size()); diff --git a/native/cocos/audio/android/AudioDecoderProvider.cpp b/native/cocos/audio/android/AudioDecoderProvider.cpp index d4c8e57073..2daab343e8 100644 --- a/native/cocos/audio/android/AudioDecoderProvider.cpp +++ b/native/cocos/audio/android/AudioDecoderProvider.cpp @@ -26,16 +26,16 @@ #define LOG_TAG "AudioDecoderProvider" #include "audio/android/AudioDecoderProvider.h" -#include "audio/android/AudioDecoderSLES.h" -#include "audio/android/AudioDecoderOgg.h" #include "audio/android/AudioDecoderMp3.h" +#include "audio/android/AudioDecoderOgg.h" +#include "audio/android/AudioDecoderSLES.h" #include "audio/android/AudioDecoderWav.h" #include "platform/FileUtils.h" namespace cc { AudioDecoder *AudioDecoderProvider::createAudioDecoder(SLEngineItf engineItf, const ccstd::string &url, int bufferSizeInFrames, int sampleRate, const FdGetterCallback &fdGetterCallback) { - AudioDecoder *decoder = nullptr; + AudioDecoder *decoder = nullptr; ccstd::string extension = FileUtils::getInstance()->getFileExtension(url); ALOGV("url:%s, extension:%s", url.c_str(), extension.c_str()); if (extension == ".ogg") { diff --git a/native/cocos/audio/android/AudioDecoderProvider.h b/native/cocos/audio/android/AudioDecoderProvider.h index e525fed75a..bff43d7af4 100644 --- a/native/cocos/audio/android/AudioDecoderProvider.h +++ b/native/cocos/audio/android/AudioDecoderProvider.h @@ -34,7 +34,7 @@ class AudioDecoder; class AudioDecoderProvider { public: static AudioDecoder *createAudioDecoder(SLEngineItf engineItf, const ccstd::string &url, int bufferSizeInFrames, int sampleRate, const FdGetterCallback &fdGetterCallback); - static void destroyAudioDecoder(AudioDecoder **decoder); + static void destroyAudioDecoder(AudioDecoder **decoder); }; } // namespace cc \ No newline at end of file diff --git a/native/cocos/audio/android/AudioDecoderSLES.cpp b/native/cocos/audio/android/AudioDecoderSLES.cpp index f84639229c..c7c81e031b 100644 --- a/native/cocos/audio/android/AudioDecoderSLES.cpp +++ b/native/cocos/audio/android/AudioDecoderSLES.cpp @@ -28,8 +28,8 @@ THE SOFTWARE. #include "audio/android/AudioDecoderSLES.h" #include "platform/FileUtils.h" -#include #include +#include namespace cc { @@ -111,12 +111,12 @@ AudioDecoderSLES::~AudioDecoderSLES() { bool AudioDecoderSLES::init(SLEngineItf engineItf, const ccstd::string &url, int bufferSizeInFrames, int sampleRate, const FdGetterCallback &fdGetterCallback) { if (AudioDecoder::init(url, sampleRate)) { - _engineItf = engineItf; + _engineItf = engineItf; _bufferSizeInFrames = bufferSizeInFrames; - _fdGetterCallback = fdGetterCallback; + _fdGetterCallback = fdGetterCallback; BUFFER_SIZE_IN_BYTES = toBufferSizeInBytes(bufferSizeInFrames, 2, 2); - _pcmData = (char *)malloc(NB_BUFFERS_IN_QUEUE * BUFFER_SIZE_IN_BYTES); + _pcmData = (char *)malloc(NB_BUFFERS_IN_QUEUE * BUFFER_SIZE_IN_BYTES); memset(_pcmData, 0x00, NB_BUFFERS_IN_QUEUE * BUFFER_SIZE_IN_BYTES); return true; } @@ -132,23 +132,23 @@ bool AudioDecoderSLES::decodeToPcm() { /* Interfaces for the audio player */ SLAndroidSimpleBufferQueueItf decBuffQueueItf; - SLPrefetchStatusItf prefetchItf; - SLPlayItf playItf; - SLMetadataExtractionItf mdExtrItf; + SLPrefetchStatusItf prefetchItf; + SLPlayItf playItf; + SLMetadataExtractionItf mdExtrItf; /* Source of audio data for the decoding */ SLDataSource decSource; // decUri & locFd should be defined here - SLDataLocator_URI decUri; + SLDataLocator_URI decUri; SLDataLocator_AndroidFD locFd; /* Data sink for decoded audio */ - SLDataSink decDest; + SLDataSink decDest; SLDataLocator_AndroidSimpleBufferQueue decBuffQueue; - SLDataFormat_PCM pcm; + SLDataFormat_PCM pcm; - SLboolean required[NUM_EXPLICIT_INTERFACES_FOR_PLAYER]; + SLboolean required[NUM_EXPLICIT_INTERFACES_FOR_PLAYER]; SLInterfaceID iidArray[NUM_EXPLICIT_INTERFACES_FOR_PLAYER]; /* Initialize arrays required[] and iidArray[] */ @@ -171,12 +171,12 @@ bool AudioDecoderSLES::decodeToPcm() { iidArray[2] = SL_IID_METADATAEXTRACTION; SLDataFormat_MIME formatMime = {SL_DATAFORMAT_MIME, nullptr, SL_CONTAINERTYPE_UNSPECIFIED}; - decSource.pFormat = &formatMime; + decSource.pFormat = &formatMime; if (_url[0] != '/') { - off_t start = 0, length = 0; + off_t start = 0, length = 0; ccstd::string relativePath; - size_t position = _url.find("@assets/"); + size_t position = _url.find("@assets/"); if (0 == position) { // "@assets/" is at the beginning of the path and we don't want it @@ -197,25 +197,25 @@ bool AudioDecoderSLES::decodeToPcm() { decSource.pLocator = &locFd; } else { - decUri = {SL_DATALOCATOR_URI, (SLchar *)_url.c_str()}; + decUri = {SL_DATALOCATOR_URI, (SLchar *)_url.c_str()}; decSource.pLocator = &decUri; } /* Setup the data sink */ decBuffQueue.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; - decBuffQueue.numBuffers = NB_BUFFERS_IN_QUEUE; + decBuffQueue.numBuffers = NB_BUFFERS_IN_QUEUE; /* set up the format of the data in the buffer queue */ pcm.formatType = SL_DATAFORMAT_PCM; // IDEA: valid value required but currently ignored - pcm.numChannels = 2; + pcm.numChannels = 2; pcm.samplesPerSec = SL_SAMPLINGRATE_44_1; pcm.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16; pcm.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16; - pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; - pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; + pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; + pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; decDest.pLocator = (void *)&decBuffQueue; - decDest.pFormat = (void *)&pcm; + decDest.pFormat = (void *)&pcm; { std::lock_guard lk(__SLPlayerMutex); @@ -264,11 +264,11 @@ bool AudioDecoderSLES::decodeToPcm() { /* ------------------------------------------------------ */ /* Initialize the callback and its context for the decoding buffer queue */ - _decContext.playItf = playItf; - _decContext.metaItf = mdExtrItf; + _decContext.playItf = playItf; + _decContext.metaItf = mdExtrItf; _decContext.pDataBase = (int8_t *)_pcmData; - _decContext.pData = _decContext.pDataBase; - _decContext.size = NB_BUFFERS_IN_QUEUE * BUFFER_SIZE_IN_BYTES; + _decContext.pData = _decContext.pDataBase; + _decContext.size = NB_BUFFERS_IN_QUEUE * BUFFER_SIZE_IN_BYTES; result = (*decBuffQueueItf)->RegisterCallback(decBuffQueueItf, SLAudioDecoderCallbackProxy::decPlayCallback, this); SL_RETURN_VAL_IF_FAILED(result, false, "decBuffQueueItf RegisterCallback failed"); @@ -299,7 +299,7 @@ bool AudioDecoderSLES::decodeToPcm() { /* 2/ block until data has been prefetched */ SLuint32 prefetchStatus = SL_PREFETCHSTATUS_UNDERFLOW; - SLuint32 timeOutIndex = 1000; //cjh time out prefetching after 2s + SLuint32 timeOutIndex = 1000; //cjh time out prefetching after 2s while ((prefetchStatus != SL_PREFETCHSTATUS_SUFFICIENTDATA) && (timeOutIndex > 0) && !_prefetchError) { std::this_thread::sleep_for(std::chrono::milliseconds(2)); @@ -315,7 +315,7 @@ bool AudioDecoderSLES::decodeToPcm() { /* ------------------------------------------------------ */ /* Display duration */ SLmillisecond durationInMsec = SL_TIME_UNKNOWN; - result = (*playItf)->GetDuration(playItf, &durationInMsec); + result = (*playItf)->GetDuration(playItf, &durationInMsec); SL_RETURN_VAL_IF_FAILED(result, false, "GetDuration failed"); if (durationInMsec == SL_TIME_UNKNOWN) { @@ -331,14 +331,14 @@ bool AudioDecoderSLES::decodeToPcm() { // can make assumptions about the size of the keys and their matching values (all SLuint32) SLuint32 itemCount; result = (*mdExtrItf)->GetItemCount(mdExtrItf, &itemCount); - SLuint32 i, keySize, valueSize; + SLuint32 i, keySize, valueSize; SLMetadataInfo *keyInfo, *value; for (i = 0; i < itemCount; i++) { - keyInfo = nullptr; - keySize = 0; - value = nullptr; + keyInfo = nullptr; + keySize = 0; + value = nullptr; valueSize = 0; - result = (*mdExtrItf)->GetKeySize(mdExtrItf, i, &keySize); + result = (*mdExtrItf)->GetKeySize(mdExtrItf, i, &keySize); SL_RETURN_VAL_IF_FAILED(result, false, "GetKeySize(%d) failed", (int)i); result = (*mdExtrItf)->GetValueSize(mdExtrItf, i, &valueSize); @@ -433,7 +433,7 @@ void AudioDecoderSLES::queryAudioInfo() { SLresult result; /* Get duration in callback where we use the callback context for the SLPlayItf*/ SLmillisecond durationInMsec = SL_TIME_UNKNOWN; - result = (*_decContext.playItf)->GetDuration(_decContext.playItf, &durationInMsec); + result = (*_decContext.playItf)->GetDuration(_decContext.playItf, &durationInMsec); SL_RETURN_IF_FAILED(result, "decodeProgressCallback,GetDuration failed"); if (durationInMsec == SL_TIME_UNKNOWN) { @@ -455,7 +455,7 @@ void AudioDecoderSLES::queryAudioInfo() { // but the call was successful for the PCM format keys, so those conditions are implied _result.sampleRate = *((SLuint32 *)pcmMetaData.data); - result = (*_decContext.metaItf)->GetValue(_decContext.metaItf, _numChannelsKeyIndex, PCM_METADATA_VALUE_SIZE, &pcmMetaData); + result = (*_decContext.metaItf)->GetValue(_decContext.metaItf, _numChannelsKeyIndex, PCM_METADATA_VALUE_SIZE, &pcmMetaData); SL_RETURN_IF_FAILED(result, "%s GetValue _numChannelsKeyIndex failed", __FUNCTION__); _result.numChannels = *((SLuint32 *)pcmMetaData.data); @@ -481,7 +481,7 @@ void AudioDecoderSLES::queryAudioInfo() { void AudioDecoderSLES::prefetchCallback(SLPrefetchStatusItf caller, SLuint32 event) { SLpermille level = 0; - SLresult result; + SLresult result; result = (*caller)->GetFillLevel(caller, &level); SL_RETURN_IF_FAILED(result, "GetFillLevel failed"); diff --git a/native/cocos/audio/android/AudioDecoderSLES.h b/native/cocos/audio/android/AudioDecoderSLES.h index db64a4a32d..bcf1d3d59c 100644 --- a/native/cocos/audio/android/AudioDecoderSLES.h +++ b/native/cocos/audio/android/AudioDecoderSLES.h @@ -25,9 +25,9 @@ THE SOFTWARE. #pragma once -#include "audio/android/AudioDecoder.h" -#include #include +#include +#include "audio/android/AudioDecoder.h" namespace cc { @@ -36,7 +36,7 @@ protected: AudioDecoderSLES(); virtual ~AudioDecoderSLES(); - bool init(SLEngineItf engineItf, const ccstd::string &url, int bufferSizeInFrames, int sampleRate, const FdGetterCallback &fdGetterCallback); + bool init(SLEngineItf engineItf, const ccstd::string &url, int bufferSizeInFrames, int sampleRate, const FdGetterCallback &fdGetterCallback); virtual bool decodeToPcm() override; private: @@ -69,24 +69,24 @@ private: int _endiannessKeyIndex; /* to signal to the test app the end of the stream to decode has been reached */ - bool _eos; - std::mutex _eosLock; + bool _eos; + std::mutex _eosLock; std::condition_variable _eosCondition; /* Structure for passing information to callback function */ typedef struct CallbackCntxt_ { - SLPlayItf playItf; + SLPlayItf playItf; SLMetadataExtractionItf metaItf; - SLuint32 size; - SLint8 *pDataBase; // Base address of local audio data storage - SLint8 *pData; // Current address of local audio data storage + SLuint32 size; + SLint8 * pDataBase; // Base address of local audio data storage + SLint8 * pData; // Current address of local audio data storage } CallbackCntxt; - CallbackCntxt _decContext; - int _bufferSizeInFrames; - int _assetFd; + CallbackCntxt _decContext; + int _bufferSizeInFrames; + int _assetFd; FdGetterCallback _fdGetterCallback; - bool _isDecodingCallbackInvoked; + bool _isDecodingCallbackInvoked; friend class SLAudioDecoderCallbackProxy; friend class AudioDecoderProvider; diff --git a/native/cocos/audio/android/AudioEngine-inl.h b/native/cocos/audio/android/AudioEngine-inl.h index 2f3ead5acd..98851f5dc5 100644 --- a/native/cocos/audio/android/AudioEngine-inl.h +++ b/native/cocos/audio/android/AudioEngine-inl.h @@ -27,9 +27,9 @@ #include #include #include -#include "base/std/container/string.h" #include "base/RefCounted.h" #include "base/Utils.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #define MAX_AUDIOINSTANCES 13 @@ -82,7 +82,7 @@ private: SLObjectItf _outputMixObject; //audioID,AudioInfo - ccstd::unordered_map _audioPlayers; + ccstd::unordered_map _audioPlayers; ccstd::unordered_map> _callbackMap; // UrlAudioPlayers which need to resumed while entering foreground diff --git a/native/cocos/audio/android/AudioPlayerProvider.cpp b/native/cocos/audio/android/AudioPlayerProvider.cpp index 9f35404b6f..c4295b7f91 100644 --- a/native/cocos/audio/android/AudioPlayerProvider.cpp +++ b/native/cocos/audio/android/AudioPlayerProvider.cpp @@ -61,7 +61,7 @@ static int getSystemAPILevel() { struct AudioFileIndicator { ccstd::string extension; - int smallSizeIndicator; + int smallSizeIndicator; }; static AudioFileIndicator gAudioFileIndicator[] = { @@ -131,7 +131,7 @@ IAudioPlayer *AudioPlayerProvider::getAudioPlayer(const ccstd::string &audioFile std::thread::id threadId = std::this_thread::get_id(); - void * infoPtr = &info; + void * infoPtr = &info; ccstd::string url = info.url; preloadEffect( info, [infoPtr, url, threadId, pcmData, isSucceed, isReturnFromCache, isPreloadFinished](bool succeed, PcmData data) { @@ -310,7 +310,7 @@ AudioPlayerProvider::AudioFileInfo AudioPlayerProvider::getFileInfo( if (audioFilePath[0] != '/') { ccstd::string relativePath; - size_t position = audioFilePath.find("@assets/"); + size_t position = audioFilePath.find("@assets/"); if (0 == position) { // "@assets/" is at the beginning of the path and we don't want it @@ -350,9 +350,9 @@ AudioPlayerProvider::AudioFileInfo AudioPlayerProvider::getFileInfo( bool AudioPlayerProvider::isSmallFile(const AudioFileInfo &info) { //NOLINT(readability-convert-member-functions-to-static) //REFINE: If file size is smaller than 100k, we think it's a small file. This value should be set by developers. - auto & audioFileInfo = const_cast(info); - size_t judgeCount = sizeof(gAudioFileIndicator) / sizeof(gAudioFileIndicator[0]); - size_t pos = audioFileInfo.url.rfind('.'); + auto & audioFileInfo = const_cast(info); + size_t judgeCount = sizeof(gAudioFileIndicator) / sizeof(gAudioFileIndicator[0]); + size_t pos = audioFileInfo.url.rfind('.'); ccstd::string extension; if (pos != ccstd::string::npos) { extension = audioFileInfo.url.substr(pos); @@ -397,7 +397,7 @@ void AudioPlayerProvider::clearAllPcmCaches() { } PcmAudioPlayer *AudioPlayerProvider::obtainPcmAudioPlayer(const ccstd::string &url, - const PcmData & pcmData) { + const PcmData & pcmData) { PcmAudioPlayer *pcmPlayer = nullptr; if (pcmData.isValid()) { pcmPlayer = new (std::nothrow) PcmAudioPlayer(_mixController, _callerThreadUtils); diff --git a/native/cocos/audio/android/AudioPlayerProvider.h b/native/cocos/audio/android/AudioPlayerProvider.h index 7fc91760f0..ddf06e05fb 100644 --- a/native/cocos/audio/android/AudioPlayerProvider.h +++ b/native/cocos/audio/android/AudioPlayerProvider.h @@ -68,7 +68,7 @@ public: private: struct AudioFileInfo { - ccstd::string url; + ccstd::string url; std::shared_ptr assetFd; off_t start{}; off_t length; @@ -100,7 +100,7 @@ private: ICallerThreadUtils *_callerThreadUtils; ccstd::unordered_map _pcmCache; - std::mutex _pcmCacheMutex; + std::mutex _pcmCacheMutex; struct PreloadCallbackParam { PreloadCallback callback; @@ -108,7 +108,7 @@ private: }; ccstd::unordered_map> _preloadCallbackMap; - std::mutex _preloadCallbackMutex; + std::mutex _preloadCallbackMutex; std::mutex _preloadWaitMutex; std::condition_variable _preloadWaitCond; diff --git a/native/cocos/audio/android/PcmAudioPlayer.cpp b/native/cocos/audio/android/PcmAudioPlayer.cpp index b3aa98e2b8..0b1ee2d662 100644 --- a/native/cocos/audio/android/PcmAudioPlayer.cpp +++ b/native/cocos/audio/android/PcmAudioPlayer.cpp @@ -25,10 +25,10 @@ THE SOFTWARE. #define LOG_TAG "PcmAudioPlayer" -#include "audio/android/cutils/log.h" #include "audio/android/PcmAudioPlayer.h" #include "audio/android/AudioMixerController.h" #include "audio/android/ICallerThreadUtils.h" +#include "audio/android/cutils/log.h" namespace cc { @@ -43,7 +43,7 @@ PcmAudioPlayer::~PcmAudioPlayer() { } bool PcmAudioPlayer::prepare(const ccstd::string &url, const PcmData &decResult) { - _url = url; + _url = url; _decResult = decResult; _track = new (std::nothrow) Track(_decResult); @@ -63,7 +63,7 @@ bool PcmAudioPlayer::prepare(const ccstd::string &url, const PcmData &decResult) _track->onStateChanged = [this, callerThreadId](Track::State state) { // It maybe in sub thread Track::State prevState = _track->getPrevState(); - auto func = [this, state, prevState]() { + auto func = [this, state, prevState]() { // It's in caller's thread if (state == Track::State::OVER && prevState != Track::State::STOPPED) { if (_playEventCallback != nullptr) { diff --git a/native/cocos/audio/android/PcmAudioPlayer.h b/native/cocos/audio/android/PcmAudioPlayer.h index 8ba5e62372..e2444082a9 100644 --- a/native/cocos/audio/android/PcmAudioPlayer.h +++ b/native/cocos/audio/android/PcmAudioPlayer.h @@ -82,13 +82,13 @@ private: virtual ~PcmAudioPlayer(); private: - int _id; - ccstd::string _url; - PcmData _decResult; - Track *_track; - PlayEventCallback _playEventCallback; + int _id; + ccstd::string _url; + PcmData _decResult; + Track * _track; + PlayEventCallback _playEventCallback; AudioMixerController *_controller; - ICallerThreadUtils *_callerThreadUtils; + ICallerThreadUtils * _callerThreadUtils; friend class AudioPlayerProvider; }; diff --git a/native/cocos/audio/android/PcmData.cpp b/native/cocos/audio/android/PcmData.cpp index c6c7b9b446..fe5b11fc57 100644 --- a/native/cocos/audio/android/PcmData.cpp +++ b/native/cocos/audio/android/PcmData.cpp @@ -25,8 +25,8 @@ THE SOFTWARE. #define LOG_TAG "PcmData" -#include "audio/android/OpenSLHelper.h" #include "audio/android/PcmData.h" +#include "audio/android/OpenSLHelper.h" namespace cc { @@ -41,70 +41,70 @@ PcmData::~PcmData() { PcmData::PcmData(const PcmData &o) { // ALOGV("In the copy constructor of PcmData (%p)", this); - numChannels = o.numChannels; - sampleRate = o.sampleRate; + numChannels = o.numChannels; + sampleRate = o.sampleRate; bitsPerSample = o.bitsPerSample; containerSize = o.containerSize; - channelMask = o.channelMask; - endianness = o.endianness; - numFrames = o.numFrames; - duration = o.duration; - pcmBuffer = std::move(o.pcmBuffer); + channelMask = o.channelMask; + endianness = o.endianness; + numFrames = o.numFrames; + duration = o.duration; + pcmBuffer = std::move(o.pcmBuffer); } PcmData::PcmData(PcmData &&o) { // ALOGV("In the move constructor of PcmData (%p)", this); - numChannels = o.numChannels; - sampleRate = o.sampleRate; + numChannels = o.numChannels; + sampleRate = o.sampleRate; bitsPerSample = o.bitsPerSample; containerSize = o.containerSize; - channelMask = o.channelMask; - endianness = o.endianness; - numFrames = o.numFrames; - duration = o.duration; - pcmBuffer = std::move(o.pcmBuffer); + channelMask = o.channelMask; + endianness = o.endianness; + numFrames = o.numFrames; + duration = o.duration; + pcmBuffer = std::move(o.pcmBuffer); o.reset(); } PcmData &PcmData::operator=(const PcmData &o) { // ALOGV("In the copy assignment of PcmData"); - numChannels = o.numChannels; - sampleRate = o.sampleRate; + numChannels = o.numChannels; + sampleRate = o.sampleRate; bitsPerSample = o.bitsPerSample; containerSize = o.containerSize; - channelMask = o.channelMask; - endianness = o.endianness; - numFrames = o.numFrames; - duration = o.duration; - pcmBuffer = o.pcmBuffer; + channelMask = o.channelMask; + endianness = o.endianness; + numFrames = o.numFrames; + duration = o.duration; + pcmBuffer = o.pcmBuffer; return *this; } PcmData &PcmData::operator=(PcmData &&o) { // ALOGV("In the move assignment of PcmData"); - numChannels = o.numChannels; - sampleRate = o.sampleRate; + numChannels = o.numChannels; + sampleRate = o.sampleRate; bitsPerSample = o.bitsPerSample; containerSize = o.containerSize; - channelMask = o.channelMask; - endianness = o.endianness; - numFrames = o.numFrames; - duration = o.duration; - pcmBuffer = std::move(o.pcmBuffer); + channelMask = o.channelMask; + endianness = o.endianness; + numFrames = o.numFrames; + duration = o.duration; + pcmBuffer = std::move(o.pcmBuffer); o.reset(); return *this; } void PcmData::reset() { - numChannels = -1; - sampleRate = -1; + numChannels = -1; + sampleRate = -1; bitsPerSample = -1; containerSize = -1; - channelMask = -1; - endianness = -1; - numFrames = -1; - duration = -1.0f; - pcmBuffer = nullptr; + channelMask = -1; + endianness = -1; + numFrames = -1; + duration = -1.0f; + pcmBuffer = nullptr; } bool PcmData::isValid() const { @@ -113,7 +113,7 @@ bool PcmData::isValid() const { ccstd::string PcmData::toString() const { ccstd::string ret; - char buf[256] = {0}; + char buf[256] = {0}; snprintf(buf, sizeof(buf), "numChannels: %d, sampleRate: %d, bitPerSample: %d, containerSize: %d, " diff --git a/native/cocos/audio/android/UrlAudioPlayer.h b/native/cocos/audio/android/UrlAudioPlayer.h index 9bb053a533..21a325809a 100644 --- a/native/cocos/audio/android/UrlAudioPlayer.h +++ b/native/cocos/audio/android/UrlAudioPlayer.h @@ -99,7 +99,7 @@ private: SLObjectItf _outputMixObj; ICallerThreadUtils *_callerThreadUtils; - int _id; + int _id; ccstd::string _url; std::shared_ptr _assetFd; diff --git a/native/cocos/audio/apple/AudioCache.h b/native/cocos/audio/apple/AudioCache.h index d8288edaf9..ba471af319 100644 --- a/native/cocos/audio/apple/AudioCache.h +++ b/native/cocos/audio/apple/AudioCache.h @@ -94,7 +94,7 @@ protected: State _state; std::shared_ptr _isDestroyed; - ccstd::string _fileFullPath; + ccstd::string _fileFullPath; unsigned int _id; bool _isLoadingFinished; bool _isSkipReadDataTask; diff --git a/native/cocos/audio/apple/AudioPlayer.h b/native/cocos/audio/apple/AudioPlayer.h index 2cd4d0b948..5ed93a21b8 100644 --- a/native/cocos/audio/apple/AudioPlayer.h +++ b/native/cocos/audio/apple/AudioPlayer.h @@ -32,8 +32,8 @@ #include #include #include -#include "base/std/container/string.h" #include +#include "base/std/container/string.h" namespace cc { class AudioCache; @@ -59,8 +59,8 @@ protected: AudioCache *_audioCache; - float _volume; - bool _loop; + float _volume; + bool _loop; std::function _finishCallbak; bool _isDestroyed; diff --git a/native/cocos/audio/include/AudioEngine.h b/native/cocos/audio/include/AudioEngine.h index 2e29834264..419becbf60 100644 --- a/native/cocos/audio/include/AudioEngine.h +++ b/native/cocos/audio/include/AudioEngine.h @@ -335,7 +335,7 @@ protected: struct AudioInfo { const ccstd::string *filePath; - ProfileHelper * profileHelper; + ProfileHelper * profileHelper; float volume; bool loop; diff --git a/native/cocos/audio/oalsoft/AudioCache.h b/native/cocos/audio/oalsoft/AudioCache.h index d94e1737a5..2de51a7f4b 100644 --- a/native/cocos/audio/oalsoft/AudioCache.h +++ b/native/cocos/audio/oalsoft/AudioCache.h @@ -102,7 +102,7 @@ protected: State _state; std::shared_ptr _isDestroyed; - ccstd::string _fileFullPath; + ccstd::string _fileFullPath; unsigned int _id; bool _isLoadingFinished; bool _isSkipReadDataTask; diff --git a/native/cocos/audio/oalsoft/AudioPlayer.h b/native/cocos/audio/oalsoft/AudioPlayer.h index 52afe647ff..b41fda1f36 100644 --- a/native/cocos/audio/oalsoft/AudioPlayer.h +++ b/native/cocos/audio/oalsoft/AudioPlayer.h @@ -29,8 +29,8 @@ #include #include #include -#include "base/std/container/string.h" #include +#include "base/std/container/string.h" #ifdef OPENAL_PLAIN_INCLUDES #include #elif CC_PLATFORM == CC_PLATFORM_WINDOWS @@ -66,8 +66,8 @@ protected: AudioCache *_audioCache; - float _volume; - bool _loop; + float _volume; + bool _loop; std::function _finishCallbak; bool _isDestroyed; diff --git a/native/cocos/base/CoreStd.h b/native/cocos/base/CoreStd.h index fc5075cd2e..8bbde61faf 100644 --- a/native/cocos/base/CoreStd.h +++ b/native/cocos/base/CoreStd.h @@ -46,8 +46,8 @@ #include #include #include -#include "base/std/container/string.h" #include +#include "base/std/container/string.h" #include "base/CachedArray.h" #include "base/Log.h" diff --git a/native/cocos/base/Data.h b/native/cocos/base/Data.h index 9dd8ce5e8d..6ddf58def7 100644 --- a/native/cocos/base/Data.h +++ b/native/cocos/base/Data.h @@ -28,8 +28,8 @@ #pragma once #include // for ssize_t on android -#include "base/std/container/string.h" // for ssize_t on linux #include "base/Macros.h" +#include "base/std/container/string.h" // for ssize_t on linux /** * @addtogroup base diff --git a/native/cocos/base/DeferredReleasePool.h b/native/cocos/base/DeferredReleasePool.h index d423bec754..f20414c8df 100644 --- a/native/cocos/base/DeferredReleasePool.h +++ b/native/cocos/base/DeferredReleasePool.h @@ -27,8 +27,8 @@ #pragma once -#include "base/std/container/string.h" #include "base/RefCounted.h" +#include "base/std/container/string.h" #include "base/std/container/vector.h" namespace cc { diff --git a/native/cocos/base/Log.cpp b/native/cocos/base/Log.cpp index 30cf3a2b8b..3c0d7369b0 100644 --- a/native/cocos/base/Log.cpp +++ b/native/cocos/base/Log.cpp @@ -60,7 +60,7 @@ LogLevel Log::slogLevel = LogLevel::LEVEL_DEBUG; LogLevel Log::slogLevel = LogLevel::INFO; #endif -FILE * Log::slogFile = nullptr; +FILE * Log::slogFile = nullptr; const ccstd::vector LOG_LEVEL_DESCS{"FATAL", "ERROR", "WARN", "INFO", "DEBUG"}; void Log::setLogFile(const ccstd::string &filename) { diff --git a/native/cocos/base/Log.h b/native/cocos/base/Log.h index 0f0f063fc6..0b1ede3edf 100644 --- a/native/cocos/base/Log.h +++ b/native/cocos/base/Log.h @@ -25,8 +25,8 @@ #pragma once -#include "base/std/container/string.h" #include "Macros.h" +#include "base/std/container/string.h" namespace cc { diff --git a/native/cocos/base/Scheduler.h b/native/cocos/base/Scheduler.h index 411b7de2fb..be75a37152 100644 --- a/native/cocos/base/Scheduler.h +++ b/native/cocos/base/Scheduler.h @@ -83,7 +83,7 @@ public: bool initWithCallback(Scheduler *scheduler, const ccSchedulerFunc &callback, void *target, const ccstd::string &key, float seconds, unsigned int repeat, float delay); inline const ccSchedulerFunc &getCallback() const { return _callback; }; - inline const ccstd::string & getKey() const { return _key; }; + inline const ccstd::string & getKey() const { return _key; }; void trigger(float dt) override; void cancel() override; @@ -91,7 +91,7 @@ public: private: void * _target = nullptr; ccSchedulerFunc _callback = nullptr; - ccstd::string _key; + ccstd::string _key; }; /** diff --git a/native/cocos/base/StringUtil.cpp b/native/cocos/base/StringUtil.cpp index ffbf648b7b..7b3721b60b 100644 --- a/native/cocos/base/StringUtil.cpp +++ b/native/cocos/base/StringUtil.cpp @@ -28,9 +28,9 @@ #include #include #include -#include "base/std/container/string.h" #include "base/ZipUtils.h" #include "base/base64.h" +#include "base/std/container/string.h" #include "memory/Memory.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) @@ -164,11 +164,11 @@ ccstd::string &StringUtil::toupper(ccstd::string &str) { } ccstd::string GzipedString::value() const { // NOLINT(readability-convert-member-functions-to-static) - uint8_t * outGzip{nullptr}; - uint8_t * outBase64{nullptr}; - auto * input = reinterpret_cast(const_cast(_str.c_str())); - auto lenOfBase64 = base64Decode(input, static_cast(_str.size()), &outBase64); - auto lenofUnzip = ZipUtils::inflateMemory(outBase64, static_cast(lenOfBase64), &outGzip); + uint8_t * outGzip{nullptr}; + uint8_t * outBase64{nullptr}; + auto * input = reinterpret_cast(const_cast(_str.c_str())); + auto lenOfBase64 = base64Decode(input, static_cast(_str.size()), &outBase64); + auto lenofUnzip = ZipUtils::inflateMemory(outBase64, static_cast(lenOfBase64), &outGzip); ccstd::string ret(outGzip, outGzip + lenofUnzip); free(outGzip); free(outBase64); diff --git a/native/cocos/base/StringUtil.h b/native/cocos/base/StringUtil.h index 9f91fe4f54..9649c4fb78 100644 --- a/native/cocos/base/StringUtil.h +++ b/native/cocos/base/StringUtil.h @@ -36,14 +36,14 @@ namespace cc { class CC_DLL StringUtil { public: - static int vprintf(char *buf, const char *last, const char *fmt, va_list args); - static int printf(char *buf, const char *last, const char *fmt, ...); - static ccstd::string format(const char *fmt, ...); + static int vprintf(char *buf, const char *last, const char *fmt, va_list args); + static int printf(char *buf, const char *last, const char *fmt, ...); + static ccstd::string format(const char *fmt, ...); static ccstd::vector split(const ccstd::string &str, const ccstd::string &delims, uint maxSplits = 0); - static ccstd::string & replace(ccstd::string &str, const ccstd::string &findStr, const ccstd::string &replaceStr); - static ccstd::string & replaceAll(ccstd::string &str, const ccstd::string &findStr, const ccstd::string &replaceStr); - static ccstd::string & tolower(ccstd::string &str); - static ccstd::string & toupper(ccstd::string &str); + static ccstd::string & replace(ccstd::string &str, const ccstd::string &findStr, const ccstd::string &replaceStr); + static ccstd::string & replaceAll(ccstd::string &str, const ccstd::string &findStr, const ccstd::string &replaceStr); + static ccstd::string & tolower(ccstd::string &str); + static ccstd::string & toupper(ccstd::string &str); }; /** diff --git a/native/cocos/base/UTF8.cpp b/native/cocos/base/UTF8.cpp index b84678e79b..ede81e78b2 100644 --- a/native/cocos/base/UTF8.cpp +++ b/native/cocos/base/UTF8.cpp @@ -237,7 +237,7 @@ bool UTF32ToUTF16(const std::u32string &utf32, std::u16string &outUtf16) { //NOL #if (CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_OHOS) ccstd::string getStringUTFCharsJNI(JNIEnv *env, jstring srcjStr, bool *ret) { - ccstd::string utf8Str; + ccstd::string utf8Str; auto * unicodeChar = static_cast(env->GetStringChars(srcjStr, nullptr)); size_t unicodeCharLength = env->GetStringLength(srcjStr); const std::u16string unicodeStr(reinterpret_cast(unicodeChar), unicodeCharLength); diff --git a/native/cocos/base/UTF8.h b/native/cocos/base/UTF8.h index 194fb963aa..18edbcf3df 100644 --- a/native/cocos/base/UTF8.h +++ b/native/cocos/base/UTF8.h @@ -28,8 +28,8 @@ #pragma once #include -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" #include "base/std/container/vector.h" #if (CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_OHOS) @@ -189,7 +189,7 @@ class CC_DLL StringUTF8 { public: struct CharUTF8 { ccstd::string _char; - bool isAnsi() { return _char.size() == 1; } + bool isAnsi() { return _char.size() == 1; } }; using CharUTF8Store = ccstd::vector; diff --git a/native/cocos/base/Utils.h b/native/cocos/base/Utils.h index 3c43b4d297..de0bb89f63 100644 --- a/native/cocos/base/Utils.h +++ b/native/cocos/base/Utils.h @@ -32,9 +32,9 @@ #include #include #include -#include "base/std/container/string.h" #include "base/Macros.h" #include "base/TypeDef.h" +#include "base/std/container/string.h" #include "base/std/container/vector.h" /** @file ccUtils.h Misc free functions diff --git a/native/cocos/base/Value.h b/native/cocos/base/Value.h index 5329146f31..f0856808c8 100644 --- a/native/cocos/base/Value.h +++ b/native/cocos/base/Value.h @@ -227,7 +227,7 @@ private: double doubleVal; bool boolVal; - ccstd::string * strVal; + ccstd::string * strVal; ValueVector * vectorVal; ValueMap * mapVal; ValueMapIntKey *intKeyMapVal; diff --git a/native/cocos/base/ZipUtils.cpp b/native/cocos/base/ZipUtils.cpp index 959c14e22c..339732edb6 100644 --- a/native/cocos/base/ZipUtils.cpp +++ b/native/cocos/base/ZipUtils.cpp @@ -616,7 +616,7 @@ bool ZipFile::getFileData(const ccstd::string &fileName, ResizableBuffer *buffer ccstd::string ZipFile::getFirstFilename() { auto zipFile = _data->zipFile.lock(); if (unzGoToFirstFile(*zipFile) != UNZ_OK) return EMPTY_FILE_NAME; - ccstd::string path; + ccstd::string path; unz_file_info info; getCurrentFileInfo(&path, &info); return path; @@ -625,7 +625,7 @@ ccstd::string ZipFile::getFirstFilename() { ccstd::string ZipFile::getNextFilename() { auto zipFile = _data->zipFile.lock(); if (unzGoToNextFile(*zipFile) != UNZ_OK) return EMPTY_FILE_NAME; - ccstd::string path; + ccstd::string path; unz_file_info info; getCurrentFileInfo(&path, &info); return path; diff --git a/native/cocos/base/ZipUtils.h b/native/cocos/base/ZipUtils.h index d7c14fe79c..71491314c1 100644 --- a/native/cocos/base/ZipUtils.h +++ b/native/cocos/base/ZipUtils.h @@ -27,8 +27,8 @@ #pragma once -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" #include "platform/FileUtils.h" #if (CC_PLATFORM == CC_PLATFORM_ANDROID) diff --git a/native/cocos/base/csscolorparser.cpp b/native/cocos/base/csscolorparser.cpp index 928a336fe6..d29a93dc04 100644 --- a/native/cocos/base/csscolorparser.cpp +++ b/native/cocos/base/csscolorparser.cpp @@ -269,7 +269,7 @@ float cssHueToRgb(float m1, float m2, float h) { ccstd::vector split(const ccstd::string &s, char delim) { ccstd::vector elems; - std::stringstream ss(s); + std::stringstream ss(s); ccstd::string item; while (std::getline(ss, item, delim)) { elems.push_back(item); diff --git a/native/cocos/base/memory/CallStack.h b/native/cocos/base/memory/CallStack.h index a3ea04d575..8291e95c44 100644 --- a/native/cocos/base/memory/CallStack.h +++ b/native/cocos/base/memory/CallStack.h @@ -32,8 +32,8 @@ #include #endif #include - #include "base/std/container/string.h" #include "../Macros.h" + #include "base/std/container/string.h" namespace cc { @@ -47,7 +47,7 @@ struct CC_DLL StackFrame { ccstd::string module; ccstd::string file; ccstd::string function; - uint32_t line{0}; + uint32_t line{0}; ccstd::string toString(); }; diff --git a/native/cocos/bindings/event/EventDispatcher.cpp b/native/cocos/bindings/event/EventDispatcher.cpp index df6f7fa8ab..5a18c483c3 100644 --- a/native/cocos/bindings/event/EventDispatcher.cpp +++ b/native/cocos/bindings/event/EventDispatcher.cpp @@ -45,7 +45,7 @@ bool inited = false; namespace cc { ccstd::unordered_map EventDispatcher::listeners; -uint32_t EventDispatcher::hashListenerId = 1; +uint32_t EventDispatcher::hashListenerId = 1; bool EventDispatcher::initialized() { return inited && se::ScriptEngine::getInstance()->isValid(); diff --git a/native/cocos/bindings/event/EventDispatcher.h b/native/cocos/bindings/event/EventDispatcher.h index 76139893d9..482b0fc0f5 100644 --- a/native/cocos/bindings/event/EventDispatcher.h +++ b/native/cocos/bindings/event/EventDispatcher.h @@ -301,7 +301,7 @@ private: struct Node * next = nullptr; }; static ccstd::unordered_map listeners; - static uint32_t hashListenerId; //simple increment hash + static uint32_t hashListenerId; //simple increment hash }; } // end of namespace cc diff --git a/native/cocos/bindings/jswrapper/Value.h b/native/cocos/bindings/jswrapper/Value.h index 6891c39636..7e3ba27867 100644 --- a/native/cocos/bindings/jswrapper/Value.h +++ b/native/cocos/bindings/jswrapper/Value.h @@ -26,9 +26,9 @@ #pragma once -#include "base/std/container/string.h" #include "HandleObject.h" #include "base/Macros.h" +#include "base/std/container/string.h" #include "base/std/container/vector.h" namespace se { @@ -473,11 +473,11 @@ private: void reset(Type type); union { - bool _boolean; - double _number; + bool _boolean; + double _number; ccstd::string *_string; - Object * _object; - int64_t _bigint; + Object * _object; + int64_t _bigint; } _u; Type _type; diff --git a/native/cocos/bindings/jswrapper/chakracore/Base.h b/native/cocos/bindings/jswrapper/chakracore/Base.h index 6fd90a2cea..8663ae528e 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Base.h +++ b/native/cocos/bindings/jswrapper/chakracore/Base.h @@ -32,8 +32,8 @@ #include #include #include -#include "base/std/container/string.h" #include #include +#include "base/std/container/string.h" #include "HelperMacros.h" diff --git a/native/cocos/bindings/jswrapper/jsc/Base.h b/native/cocos/bindings/jswrapper/jsc/Base.h index f4e491542f..6bfa214683 100644 --- a/native/cocos/bindings/jswrapper/jsc/Base.h +++ b/native/cocos/bindings/jswrapper/jsc/Base.h @@ -30,8 +30,8 @@ #include #include -#include "base/std/container/string.h" #include +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include diff --git a/native/cocos/bindings/jswrapper/sm/Base.h b/native/cocos/bindings/jswrapper/sm/Base.h index 4a10032dcd..8b96bbbadf 100644 --- a/native/cocos/bindings/jswrapper/sm/Base.h +++ b/native/cocos/bindings/jswrapper/sm/Base.h @@ -33,22 +33,22 @@ #include "jsapi.h" #include "jsfriendapi.h" -#include "js/Initialization.h" -#include "js/Conversions.h" -#include "js/ArrayBuffer.h" -#include "js/JSON.h" -#include "js/Equality.h" -#include "js/Warnings.h" -#include "js/LocaleSensitive.h" -#include "js/ContextOptions.h" -#include "js/CompilationAndEvaluation.h" -#include "js/SourceText.h" -#include "js/GCAPI.h" -#include "js/BuildId.h" -#include "js/MemoryMetrics.h" #include "js/Array.h" -#include "js/experimental/TypedData.h" +#include "js/ArrayBuffer.h" #include "js/BigInt.h" +#include "js/BuildId.h" +#include "js/CompilationAndEvaluation.h" +#include "js/ContextOptions.h" +#include "js/Conversions.h" +#include "js/Equality.h" +#include "js/GCAPI.h" +#include "js/Initialization.h" +#include "js/JSON.h" +#include "js/LocaleSensitive.h" +#include "js/MemoryMetrics.h" +#include "js/SourceText.h" +#include "js/Warnings.h" +#include "js/experimental/TypedData.h" #include "mozilla/Unused.h" @@ -58,7 +58,7 @@ #include #include #include -#include "base/std/container/string.h" +#include #include #include -#include +#include "base/std/container/string.h" diff --git a/native/cocos/bindings/jswrapper/v8/Base.h b/native/cocos/bindings/jswrapper/v8/Base.h index b176283fb6..b94fb5d97b 100644 --- a/native/cocos/bindings/jswrapper/v8/Base.h +++ b/native/cocos/bindings/jswrapper/v8/Base.h @@ -39,8 +39,8 @@ #include // for std::find #include #include -#include "base/std/container/string.h" #include "../PrivateObject.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "HelperMacros.h" diff --git a/native/cocos/bindings/jswrapper/v8/Class.h b/native/cocos/bindings/jswrapper/v8/Class.h index 3912af1838..c8c6f49a1c 100644 --- a/native/cocos/bindings/jswrapper/v8/Class.h +++ b/native/cocos/bindings/jswrapper/v8/Class.h @@ -135,9 +135,9 @@ private: static void setIsolate(v8::Isolate *isolate); ccstd::string _name; - Object * _parent; - Object * _parentProto; - Object * _proto; + Object * _parent; + Object * _parentProto; + Object * _proto; v8::FunctionCallback _ctor; v8::UniquePersistent _ctorTemplate; diff --git a/native/cocos/bindings/jswrapper/v8/HelperMacros.h b/native/cocos/bindings/jswrapper/v8/HelperMacros.h index b4cc62c4e9..1b2a2ef339 100644 --- a/native/cocos/bindings/jswrapper/v8/HelperMacros.h +++ b/native/cocos/bindings/jswrapper/v8/HelperMacros.h @@ -29,13 +29,13 @@ #include #include #include -#include "base/std/container/string.h" #include #include #include #include "../ValueArrayPool.h" #include "../config.h" #include "base/Log.h" +#include "base/std/container/string.h" //#define RECORD_JSB_INVOKING diff --git a/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp b/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp index 6b50778673..be7ead5fdb 100644 --- a/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp +++ b/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp @@ -52,7 +52,7 @@ const unsigned int JSB_STACK_FRAME_LIMIT = 20; #ifdef CC_DEBUG -unsigned int jsbInvocationCount = 0; +unsigned int jsbInvocationCount = 0; ccstd::map jsbFunctionInvokedRecords; #endif @@ -85,13 +85,13 @@ ccstd::string stackTraceToString(v8::Local stack) { for (int i = 0, e = stack->GetFrameCount(); i < e; ++i) { v8::Local frame = stack->GetFrame(v8::Isolate::GetCurrent(), i); v8::Local script = frame->GetScriptName(); - ccstd::string scriptName; + ccstd::string scriptName; if (!script.IsEmpty()) { scriptName = *v8::String::Utf8Value(v8::Isolate::GetCurrent(), script); } v8::Local func = frame->GetFunctionName(); - ccstd::string funcName; + ccstd::string funcName; if (!func.IsEmpty()) { funcName = *v8::String::Utf8Value(v8::Isolate::GetCurrent(), func); } @@ -134,7 +134,7 @@ bool jsbConsoleFormatLog(State &state, const char *prefix, int msgIndex = 0) { SE_LOGD("JS: %s%s\n", prefix, msg.c_str()); } else if (argc > 1) { ccstd::string msg = args[msgIndex].toStringForce(); - size_t pos; + size_t pos; for (int i = (msgIndex + 1); i < argc; ++i) { pos = msg.find('%'); if (pos != ccstd::string::npos && pos != (msg.length() - 1) && (msg[pos + 1] == 'd' || msg[pos + 1] == 's' || msg[pos + 1] == 'f')) { @@ -805,7 +805,7 @@ bool ScriptEngine::evalString(const char *script, ssize_t length /* = -1 */, Val // Fix the source url is too long displayed in Chrome debugger. ccstd::string sourceUrl = fileName; static const ccstd::string PREFIX_KEY = "/temp/quick-scripts/"; - size_t prefixPos = sourceUrl.find(PREFIX_KEY); + size_t prefixPos = sourceUrl.find(PREFIX_KEY); if (prefixPos != ccstd::string::npos) { sourceUrl = sourceUrl.substr(prefixPos + PREFIX_KEY.length()); } @@ -813,7 +813,7 @@ bool ScriptEngine::evalString(const char *script, ssize_t length /* = -1 */, Val // It is needed, or will crash if invoked from non C++ context, such as invoked from objective-c context(for example, handler of UIKit). v8::HandleScope handleScope(_isolate); - ccstd::string scriptStr(script, length); + ccstd::string scriptStr(script, length); v8::MaybeLocal source = v8::String::NewFromUtf8(_isolate, scriptStr.c_str(), v8::NewStringType::kNormal); if (source.IsEmpty()) { return false; @@ -902,7 +902,7 @@ bool ScriptEngine::saveByteCodeToFile(const ccstd::string &path, const ccstd::st return false; } ccstd::string pathBcDir = pathBc.substr(0, lastSep); - success = fu->createDirectory(pathBcDir); + success = fu->createDirectory(pathBcDir); if (!success) { SE_LOGE("ScriptEngine::generateByteCode failed to create bytecode for %s\n", path.c_str()); return success; @@ -910,7 +910,7 @@ bool ScriptEngine::saveByteCodeToFile(const ccstd::string &path, const ccstd::st } // load script file - ccstd::string scriptBuffer = _fileOperationDelegate.onGetStringFromFile(path); + ccstd::string scriptBuffer = _fileOperationDelegate.onGetStringFromFile(path); v8::Local code = v8::String::NewFromUtf8(_isolate, scriptBuffer.c_str(), v8::NewStringType::kNormal, static_cast(scriptBuffer.length())).ToLocalChecked(); v8::Local scriptPath = v8::String::NewFromUtf8(_isolate, path.data(), v8::NewStringType::kNormal).ToLocalChecked(); // create unbound script diff --git a/native/cocos/bindings/jswrapper/v8/ScriptEngine.h b/native/cocos/bindings/jswrapper/v8/ScriptEngine.h index d2daab7ec0..e2854c70d8 100644 --- a/native/cocos/bindings/jswrapper/v8/ScriptEngine.h +++ b/native/cocos/bindings/jswrapper/v8/ScriptEngine.h @@ -401,8 +401,8 @@ private: VMStringPool _stringPool; std::thread::id _engineThreadId; - ccstd::string _lastStackTrace; - ccstd::string _debuggerServerAddr; + ccstd::string _lastStackTrace; + ccstd::string _debuggerServerAddr; uint32_t _debuggerServerPort; bool _isWaitForConnect; diff --git a/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp b/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp index f21f921312..dc267f0eef 100644 --- a/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp +++ b/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp @@ -71,10 +71,10 @@ public: using ValueTypes = ccstd::vector; using ReturnValue = union { - int intValue; - int64_t longValue; - float floatValue; - int boolValue; + int intValue; + int64_t longValue; + float floatValue; + int boolValue; ccstd::string *stringValue; }; @@ -155,9 +155,9 @@ public: ccstd::string _mClassName; ccstd::string _mMethodName; ccstd::string _mMethodSig; - int _mArgumentsCount{0}; - ValueTypes _mArgumentsType; - ValueType _mReturnType{ValueType::VOID}; + int _mArgumentsCount{0}; + ValueTypes _mArgumentsType; + ValueType _mReturnType{ValueType::VOID}; ReturnValue _mRet; jstring _mRetjstring{nullptr}; @@ -196,7 +196,7 @@ JNIEXPORT jint JNICALL JNI_JSJAVABRIDGE(evalString)(JNIEnv *env, jclass /*cls*/, se::AutoHandleScope hs; bool strFlag = false; - ccstd::string strValue = cc::StringUtils::getStringUTFCharsJNI(env, value, &strFlag); + ccstd::string strValue = cc::StringUtils::getStringUTFCharsJNI(env, value, &strFlag); if (!strFlag) { CC_LOG_DEBUG("JavaScriptJavaBridge_evalString error, invalid string code"); return 0; @@ -251,7 +251,7 @@ bool JavaScriptJavaBridge::CallInfo::execute() { _mRetjstring = static_cast(_mEnv->CallStaticObjectMethod(_mClassID, _mMethodID)); if (_mRetjstring) { ccstd::string strValue = cc::StringUtils::getStringUTFCharsJNI(_mEnv, _mRetjstring); - _mRet.stringValue = new ccstd::string(strValue); + _mRet.stringValue = new ccstd::string(strValue); } else { _mRet.stringValue = nullptr; } @@ -301,7 +301,7 @@ bool JavaScriptJavaBridge::CallInfo::executeWithArgs(jvalue *args) { _mRetjstring = static_cast(_mEnv->CallStaticObjectMethodA(_mClassID, _mMethodID, args)); if (_mRetjstring) { ccstd::string strValue = cc::StringUtils::getStringUTFCharsJNI(_mEnv, _mRetjstring); - _mRet.stringValue = new ccstd::string(strValue); + _mRet.stringValue = new ccstd::string(strValue); } else { _mRet.stringValue = nullptr; } @@ -495,7 +495,7 @@ static bool JavaScriptJavaBridge_callStaticMethod(se::State &s) { //NOLINT(reada auto argc = static_cast(args.size()); if (argc == 3) { - bool ok = false; + bool ok = false; ccstd::string clsName; ccstd::string methodName; ccstd::string methodSig; @@ -526,7 +526,7 @@ static bool JavaScriptJavaBridge_callStaticMethod(se::State &s) { //NOLINT(reada } if (argc > 3) { - bool ok = false; + bool ok = false; ccstd::string clsName; ccstd::string methodName; ccstd::string methodSig; @@ -649,7 +649,7 @@ static bool ScriptNativeBridge_sendToNative(se::State &s) { //NOLINT(readability const auto &args = s.args(); size_t argc = args.size(); if (argc >= 1 && argc < 3) { - bool ok = false; + bool ok = false; ccstd::string arg0; ok = sevalue_to_native(args[0], &arg0); SE_PRECONDITION2(ok, false, "Converting arg0 failed!"); diff --git a/native/cocos/bindings/manual/JavaScriptJavaBridge.h b/native/cocos/bindings/manual/JavaScriptJavaBridge.h index b121ab06c6..c2334d4792 100644 --- a/native/cocos/bindings/manual/JavaScriptJavaBridge.h +++ b/native/cocos/bindings/manual/JavaScriptJavaBridge.h @@ -31,6 +31,6 @@ namespace se { class Object; } -bool register_javascript_java_bridge(se::Object *obj); // NOLINT(readability-identifier-naming) -bool register_script_native_bridge(se::Object *obj); // NOLINT(readability-identifier-naming) +bool register_javascript_java_bridge(se::Object *obj); // NOLINT(readability-identifier-naming) +bool register_script_native_bridge(se::Object *obj); // NOLINT(readability-identifier-naming) void callPlatformStringMethod(const ccstd::string &arg0, const ccstd::string &arg1); // NOLINT(readability-identifier-naming) diff --git a/native/cocos/bindings/manual/jsb_classtype.h b/native/cocos/bindings/manual/jsb_classtype.h index d3e40a5d83..5f4431649e 100644 --- a/native/cocos/bindings/manual/jsb_classtype.h +++ b/native/cocos/bindings/manual/jsb_classtype.h @@ -40,9 +40,9 @@ public: template static se::Class *findClass(const T *nativeObj) { - bool found = false; + bool found = false; ccstd::string typeName = typeid(*nativeObj).name(); - auto iter = jsbClassTypeMap.find(typeName); + auto iter = jsbClassTypeMap.find(typeName); if (iter == jsbClassTypeMap.end()) { typeName = typeid(T).name(); iter = jsbClassTypeMap.find(typeName); diff --git a/native/cocos/bindings/manual/jsb_cocos_manual.cpp b/native/cocos/bindings/manual/jsb_cocos_manual.cpp index 86a7f82be2..9b6d45c27b 100644 --- a/native/cocos/bindings/manual/jsb_cocos_manual.cpp +++ b/native/cocos/bindings/manual/jsb_cocos_manual.cpp @@ -63,9 +63,9 @@ public: private: cc::SAXParser _parser; - ccstd::string _result; + ccstd::string _result; bool _isStoringCharacters; - ccstd::string _currentValue; + ccstd::string _currentValue; }; // cc.PlistParser.getInstance() @@ -204,7 +204,7 @@ static bool JSB_localStorageGetItem(se::State &s) { // NOLINT(readability-identi const auto &args = s.args(); size_t argc = args.size(); if (argc == 1) { - bool ok = true; + bool ok = true; ccstd::string key; ok = sevalue_to_native(args[0], &key); SE_PRECONDITION2(ok, false, "Error processing arguments"); @@ -228,7 +228,7 @@ static bool JSB_localStorageRemoveItem(const se::State &s) { // NOLINT(readabili const auto &args = s.args(); size_t argc = args.size(); if (argc == 1) { - bool ok = true; + bool ok = true; ccstd::string key; ok = sevalue_to_native(args[0], &key); SE_PRECONDITION2(ok, false, "Error processing arguments"); @@ -245,7 +245,7 @@ static bool JSB_localStorageSetItem(const se::State &s) { // NOLINT(readability- const auto &args = s.args(); size_t argc = args.size(); if (argc == 2) { - bool ok = true; + bool ok = true; ccstd::string key; ok = sevalue_to_native(args[0], &key); SE_PRECONDITION2(ok, false, "Error processing arguments"); @@ -489,9 +489,9 @@ static bool js_engine_CanvasRenderingContext2D_fillText(const se::State &s) { // CC_UNUSED bool ok = true; if (argc == 5) { ccstd::string arg0; - float arg1 = 0; - float arg2 = 0; - float arg3 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; ok &= sevalue_to_native(args[0], &arg0); ok &= sevalue_to_native(args[1], &arg1); ok &= sevalue_to_native(args[2], &arg2); @@ -520,9 +520,9 @@ static bool js_engine_CanvasRenderingContext2D_strokeText(const se::State &s) { bool ok = true; if (argc == 5) { ccstd::string arg0; - float arg1 = 0; - float arg2 = 0; - float arg3 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; ok &= sevalue_to_native(args[0], &arg0); ok &= sevalue_to_native(args[1], &arg1); ok &= sevalue_to_native(args[2], &arg2); diff --git a/native/cocos/bindings/manual/jsb_conversions.h b/native/cocos/bindings/manual/jsb_conversions.h index 272e974a66..e1511f3e0c 100644 --- a/native/cocos/bindings/manual/jsb_conversions.h +++ b/native/cocos/bindings/manual/jsb_conversions.h @@ -103,8 +103,8 @@ } #if CC_ENABLE_CACHE_JSB_FUNC_RESULT - #define SE_HOLD_RETURN_VALUE(retCXXValue, thisObject, jsValue) \ - if (is_jsb_object_v::type>) { \ + #define SE_HOLD_RETURN_VALUE(retCXXValue, thisObject, jsValue) \ + if (is_jsb_object_v::type>) { \ (thisObject)->setProperty(ccstd::string("__cache") + __FUNCTION__, (jsValue)); \ } #else @@ -302,7 +302,7 @@ bool seval_to_Map_string_key(const se::Value &v, cc::RefMap *r se::Object *obj = v.toObject(); ccstd::vector allKeys; - bool ok = obj->getAllKeys(&allKeys); + bool ok = obj->getAllKeys(&allKeys); if (!ok) { ret->clear(); return false; @@ -1108,7 +1108,7 @@ bool sevalue_to_native(const se::Value &from, std::tuple *to, se::Objec ////////////// ccstd::unordered_map template bool sevalue_to_native(const se::Value &from, ccstd::unordered_map *to, se::Object *ctx) { //NOLINT - se::Object * jsmap = from.toObject(); + se::Object * jsmap = from.toObject(); ccstd::vector allKeys; jsmap->getAllKeys(&allKeys); bool ret = true; diff --git a/native/cocos/bindings/manual/jsb_conversions_spec.cpp b/native/cocos/bindings/manual/jsb_conversions_spec.cpp index 553f7c172f..b3e2b655aa 100644 --- a/native/cocos/bindings/manual/jsb_conversions_spec.cpp +++ b/native/cocos/bindings/manual/jsb_conversions_spec.cpp @@ -505,8 +505,8 @@ bool sevalue_to_native(const se::Value &from, cc::Mat3 *to, se::Object * /*unuse memcpy(to->m, ptr, length); } else { - bool ok = false; - se::Value tmp; + bool ok = false; + se::Value tmp; ccstd::string prefix = "m"; for (uint32_t i = 0; i < 9; ++i) { ccstd::string name; @@ -548,8 +548,8 @@ bool sevalue_to_native(const se::Value &from, cc::Mat4 *to, se::Object * /*unuse memcpy(to->m, ptr, length); } else { - bool ok = false; - se::Value tmp; + bool ok = false; + se::Value tmp; ccstd::string prefix = "m"; for (uint32_t i = 0; i < 16; ++i) { ccstd::string name; @@ -809,7 +809,7 @@ bool sevalue_to_native(const se::Value &from, ccstd::vector *to if (!ok || !arrElement.isObject()) { continue; } - cc::MacroRecord macroRecord; + cc::MacroRecord macroRecord; ccstd::vector keys; ok = arrElement.toObject()->getAllKeys(&keys); if (ok) { @@ -1204,7 +1204,7 @@ bool seval_to_Map_string_key(const se::Value &v, cc::RefMap allKeys; - bool ok = obj->getAllKeys(&allKeys); + bool ok = obj->getAllKeys(&allKeys); if (!ok) { ret->clear(); return false; @@ -1287,7 +1287,7 @@ bool ccvaluemap_to_seval(const cc::ValueMap &v, se::Value *ret) { // NOLINT bool ok = true; for (const auto &e : v) { const ccstd::string &key = e.first; - const cc::Value & value = e.second; + const cc::Value & value = e.second; if (key.empty()) { continue; @@ -1318,7 +1318,7 @@ bool ccvaluemapintkey_to_seval(const cc::ValueMapIntKey &v, se::Value *ret) { // for (const auto &e : v) { std::stringstream keyss; keyss << e.first; - ccstd::string key = keyss.str(); + ccstd::string key = keyss.str(); const cc::Value &value = e.second; if (key.empty()) { diff --git a/native/cocos/bindings/manual/jsb_conversions_spec.h b/native/cocos/bindings/manual/jsb_conversions_spec.h index bfc9e4b431..a9c73b85f3 100644 --- a/native/cocos/bindings/manual/jsb_conversions_spec.h +++ b/native/cocos/bindings/manual/jsb_conversions_spec.h @@ -333,9 +333,9 @@ inline bool sevalue_to_native(const se::Value &from, cc::ValueMap *to, se::Objec bool sevalue_to_native(const se::Value &from, ccstd::vector *to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming) -bool sevalue_to_native(const se::Value &from, ccstd::vector *to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming) +bool sevalue_to_native(const se::Value &from, ccstd::vector *to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming) bool sevalue_to_native(const se::Value &from, cc::variant, ccstd::string> *to, se::Object *ctx); // NOLINT(readability-identifier-naming) -inline bool sevalue_to_native(const se::Value & /*from*/, cc::monostate * /*to*/, se::Object * /*ctx*/) { // NOLINT(readability-identifier-naming) +inline bool sevalue_to_native(const se::Value & /*from*/, cc::monostate * /*to*/, se::Object * /*ctx*/) { // NOLINT(readability-identifier-naming) // nothing todo return false; } @@ -534,7 +534,7 @@ inline bool nativevalue_to_se(const se_object_ptr &from, se::Value &to, se::Obje return true; } bool seval_to_Map_string_key(const se::Value &v, cc::RefMap *ret); // NOLINT(readability-identifier-naming) -#endif //USE_MIDDLEWARE +#endif //USE_MIDDLEWARE #if USE_PHYSICS_PHYSX diff --git a/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp b/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp index 0369f77427..32f17adef9 100644 --- a/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp +++ b/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp @@ -355,8 +355,8 @@ static bool js_cocos2dx_dragonbones_BaseFactory_parseTextureAtlasData(se::State size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 2) { - const char *arg0 = nullptr; - void * arg1 = nullptr; + const char * arg0 = nullptr; + void * arg1 = nullptr; ccstd::string arg0_tmp; ok &= sevalue_to_native(args[0], &arg0_tmp); arg0 = arg0_tmp.c_str(); @@ -368,8 +368,8 @@ static bool js_cocos2dx_dragonbones_BaseFactory_parseTextureAtlasData(se::State return true; } if (argc == 3) { - const char *arg0 = nullptr; - void * arg1 = nullptr; + const char * arg0 = nullptr; + void * arg1 = nullptr; ccstd::string arg2; ccstd::string arg0_tmp; ok &= sevalue_to_native(args[0], &arg0_tmp); @@ -384,10 +384,10 @@ static bool js_cocos2dx_dragonbones_BaseFactory_parseTextureAtlasData(se::State return true; } if (argc == 4) { - const char *arg0 = nullptr; - void * arg1 = nullptr; + const char * arg0 = nullptr; + void * arg1 = nullptr; ccstd::string arg2; - float arg3 = 0; + float arg3 = 0; ccstd::string arg0_tmp; ok &= sevalue_to_native(args[0], &arg0_tmp); arg0 = arg0_tmp.c_str(); diff --git a/native/cocos/bindings/manual/jsb_extension_manual.cpp b/native/cocos/bindings/manual/jsb_extension_manual.cpp index bd6252decf..dff750a94d 100644 --- a/native/cocos/bindings/manual/jsb_extension_manual.cpp +++ b/native/cocos/bindings/manual/jsb_extension_manual.cpp @@ -41,7 +41,7 @@ static bool js_cocos2dx_extension_loadRemoteImage(se::State &s) { int argc = (int)args.size(); if (argc == 2) { - bool ok = false; + bool ok = false; ccstd::string url; ok = seval_to_std_string(args[0], &url); SE_PRECONDITION2(ok, false, "Converting 'url' failed!"); diff --git a/native/cocos/bindings/manual/jsb_global.cpp b/native/cocos/bindings/manual/jsb_global.cpp index 50e3459a09..528e677937 100644 --- a/native/cocos/bindings/manual/jsb_global.cpp +++ b/native/cocos/bindings/manual/jsb_global.cpp @@ -52,9 +52,9 @@ using namespace cc; //NOLINT static LegacyThreadPool *gThreadPool = nullptr; -static std::shared_ptr gLocalDownloader = nullptr; +static std::shared_ptr gLocalDownloader = nullptr; static ccstd::map> gLocalDownloaderHandlers; -static uint64_t gLocalDownloaderTaskId = 1000000; +static uint64_t gLocalDownloaderTaskId = 1000000; static cc::network::Downloader *localDownloader() { if (!gLocalDownloader) { @@ -82,7 +82,7 @@ static cc::network::Downloader *localDownloader() { gLocalDownloader->onTaskError = [=](const cc::network::DownloadTask &task, int errorCode, //NOLINT int errorCodeInternal, //NOLINT - const ccstd::string & errorStr) { //NOLINT + const ccstd::string & errorStr) { //NOLINT SE_REPORT_ERROR("Getting image from (%s) failed!", task.requestURL.c_str()); gLocalDownloaderHandlers.erase(task.identifier); }; @@ -94,7 +94,7 @@ static void localDownloaderCreateTask(const ccstd::string &url, const std::funct std::stringstream ss; ss << "jsb_loadimage_" << (gLocalDownloaderTaskId++); ccstd::string key = ss.str(); - auto task = localDownloader()->createDownloadDataTask(url, key); + auto task = localDownloader()->createDownloadDataTask(url, key); gLocalDownloaderHandlers.emplace(std::make_pair(task->identifier, callback)); } @@ -420,7 +420,7 @@ static bool JSB_saveByteCode(se::State &s) { //NOLINT const auto &args = s.args(); int argc = static_cast(args.size()); SE_PRECONDITION2(argc == 2, false, "Invalid number of arguments"); - bool ok = true; + bool ok = true; ccstd::string srcfile; ccstd::string dstfile; ok &= sevalue_to_native(args[0], &srcfile); @@ -905,8 +905,8 @@ static bool JSB_zipUtils_inflateMemory(se::State &s) { //NOLINT size_t arg1 = 0; if (args[0].isString()) { const ccstd::string &str = args[0].toString(); - arg0 = const_cast(reinterpret_cast(str.c_str())); - arg1 = str.size(); + arg0 = const_cast(reinterpret_cast(str.c_str())); + arg1 = str.size(); } else if (args[0].isObject()) { se::Object *obj = args[0].toObject(); if (obj->isArrayBuffer()) { @@ -958,7 +958,7 @@ static bool JSB_zipUtils_inflateGZipFile(se::State &s) { //NOLINT size_t argc = args.size(); if (argc == 1) { SE_PRECONDITION2(args[0].isString(), false, "path is invalid!"); - ccstd::string arg0 = args[0].toString(); + ccstd::string arg0 = args[0].toString(); unsigned char * arg1 = nullptr; int32_t len = ZipUtils::inflateGZipFile(arg0.c_str(), &arg1); se::HandleObject seObj(se::Object::createArrayBufferObject(arg1, len)); @@ -981,7 +981,7 @@ static bool JSB_zipUtils_isGZipFile(se::State &s) { //NOLINT if (argc == 1) { SE_PRECONDITION2(args[0].isString(), false, "path is invalid!"); ccstd::string arg0 = args[0].toString(); - bool flag = ZipUtils::isGZipFile(arg0.c_str()); + bool flag = ZipUtils::isGZipFile(arg0.c_str()); s.rval().setBoolean(flag); return true; } @@ -999,8 +999,8 @@ static bool JSB_zipUtils_isGZipBuffer(se::State &s) { //NOLINT size_t arg1 = 0; if (args[0].isString()) { const ccstd::string &str = args[0].toString(); - arg0 = const_cast(reinterpret_cast(str.c_str())); - arg1 = str.size(); + arg0 = const_cast(reinterpret_cast(str.c_str())); + arg1 = str.size(); } else if (args[0].isObject()) { se::Object *obj = args[0].toObject(); if (obj->isArrayBuffer()) { @@ -1030,7 +1030,7 @@ static bool JSB_zipUtils_inflateCCZFile(se::State &s) { //NOLINT size_t argc = args.size(); if (argc == 1) { SE_PRECONDITION2(args[0].isString(), false, "path is invalid!"); - ccstd::string arg0 = args[0].toString(); + ccstd::string arg0 = args[0].toString(); unsigned char * arg1 = nullptr; int32_t len = ZipUtils::inflateCCZFile(arg0.c_str(), &arg1); se::HandleObject seObj(se::Object::createArrayBufferObject(arg1, len)); @@ -1056,8 +1056,8 @@ static bool JSB_zipUtils_inflateCCZBuffer(se::State &s) { //NOLINT size_t arg1 = 0; if (args[0].isString()) { const ccstd::string &str = args[0].toString(); - arg0 = const_cast(reinterpret_cast(str.c_str())); - arg1 = str.size(); + arg0 = const_cast(reinterpret_cast(str.c_str())); + arg1 = str.size(); } else if (args[0].isObject()) { se::Object *obj = args[0].toObject(); if (obj->isArrayBuffer()) { @@ -1114,8 +1114,8 @@ static bool JSB_zipUtils_isCCZBuffer(se::State &s) { //NOLINT size_t arg1 = 0; if (args[0].isString()) { const ccstd::string &str = args[0].toString(); - arg0 = const_cast(reinterpret_cast(str.c_str())); - arg1 = str.size(); + arg0 = const_cast(reinterpret_cast(str.c_str())); + arg1 = str.size(); } else if (args[0].isObject()) { se::Object *obj = args[0].toObject(); if (obj->isArrayBuffer()) { diff --git a/native/cocos/bindings/manual/jsb_global.h b/native/cocos/bindings/manual/jsb_global.h index db0de6937b..d9fc52c5d9 100644 --- a/native/cocos/bindings/manual/jsb_global.h +++ b/native/cocos/bindings/manual/jsb_global.h @@ -64,7 +64,7 @@ class Value; bool jsb_register_global_variables(se::Object *global); //NOLINT(readability-identifier-naming) -bool jsb_set_extend_property(const char *ns, const char *clsName); //NOLINT(readability-identifier-naming) +bool jsb_set_extend_property(const char *ns, const char *clsName); //NOLINT(readability-identifier-naming) bool jsb_run_script(const ccstd::string &filePath, se::Value *rval = nullptr); //NOLINT(readability-identifier-naming) bool jsb_run_script_module(const ccstd::string &filePath, se::Value *rval = nullptr); //NOLINT(readability-identifier-naming) diff --git a/native/cocos/bindings/manual/jsb_global_init.h b/native/cocos/bindings/manual/jsb_global_init.h index 29f12a08a8..9aa74044af 100644 --- a/native/cocos/bindings/manual/jsb_global_init.h +++ b/native/cocos/bindings/manual/jsb_global_init.h @@ -35,6 +35,6 @@ class Object; extern se::Object *__jsbObj; //NOLINT extern se::Object *__glObj; //NOLINT -void jsb_init_file_operation_delegate(); //NOLINT +void jsb_init_file_operation_delegate(); //NOLINT void jsb_set_xxtea_key(const ccstd::string &key); //NOLINT bool jsb_enable_debugger(const ccstd::string &debuggerServerAddr, uint32_t port, bool isWaitForConnect = false); //NOLINT \ No newline at end of file diff --git a/native/cocos/bindings/manual/jsb_platform.h b/native/cocos/bindings/manual/jsb_platform.h index 67d0b68190..79e9ab4695 100644 --- a/native/cocos/bindings/manual/jsb_platform.h +++ b/native/cocos/bindings/manual/jsb_platform.h @@ -31,5 +31,5 @@ namespace se { class Object; } -bool register_platform_bindings(se::Object *obj); // NOLINT[readability-identifier-naming] +bool register_platform_bindings(se::Object *obj); // NOLINT[readability-identifier-naming] const ccstd::unordered_map &getFontFamilyNameMap(); diff --git a/native/cocos/bindings/manual/jsb_platform_android.cpp b/native/cocos/bindings/manual/jsb_platform_android.cpp index 6f74f9172a..7577911e4f 100644 --- a/native/cocos/bindings/manual/jsb_platform_android.cpp +++ b/native/cocos/bindings/manual/jsb_platform_android.cpp @@ -61,7 +61,7 @@ static bool JSB_loadFont(se::State &s) { SE_PRECONDITION2(ok, false, "JSB_loadFont : Error processing argument: source"); ccstd::string fontFilePath; - std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); + std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); std::match_results results; if (std::regex_search(source.cbegin(), source.cend(), results, re)) { fontFilePath = results[1].str(); diff --git a/native/cocos/bindings/manual/jsb_platform_ohos.cpp b/native/cocos/bindings/manual/jsb_platform_ohos.cpp index f7477a4b8f..5249d4efce 100644 --- a/native/cocos/bindings/manual/jsb_platform_ohos.cpp +++ b/native/cocos/bindings/manual/jsb_platform_ohos.cpp @@ -61,7 +61,7 @@ static bool JSB_loadFont(se::State &s) { //NOLINT SE_PRECONDITION2(ok, false, "JSB_loadFont : Error processing argument: source"); ccstd::string fontFilePath; - std::regex re(R"(url\(\s*'\s*(.*?)\s*'\s*\))"); + std::regex re(R"(url\(\s*'\s*(.*?)\s*'\s*\))"); std::match_results results; if (std::regex_search(source.cbegin(), source.cend(), results, re)) { fontFilePath = results[1].str(); diff --git a/native/cocos/bindings/manual/jsb_platfrom_linux.cpp b/native/cocos/bindings/manual/jsb_platfrom_linux.cpp index 99fca70154..e416761785 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_linux.cpp +++ b/native/cocos/bindings/manual/jsb_platfrom_linux.cpp @@ -56,7 +56,7 @@ static bool JSB_loadFont(se::State &s) { SE_PRECONDITION2(ok, false, "JSB_loadFont : Error processing argument: source"); ccstd::string fontFilePath; - std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); + std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); std::match_results results; if (std::regex_search(source.cbegin(), source.cend(), results, re)) { fontFilePath = results[1].str(); diff --git a/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp b/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp index 3a81102673..35df8751d8 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp +++ b/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp @@ -56,7 +56,7 @@ static bool JSB_loadFont(se::State &s) { SE_PRECONDITION2(ok, false, "JSB_loadFont : Error processing argument: source"); ccstd::string fontFilePath; - std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); + std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); std::match_results results; if (std::regex_search(source.cbegin(), source.cend(), results, re)) { fontFilePath = results[1].str(); diff --git a/native/cocos/bindings/manual/jsb_platfrom_win32.cpp b/native/cocos/bindings/manual/jsb_platfrom_win32.cpp index afc1afa491..49d7c232f8 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_win32.cpp +++ b/native/cocos/bindings/manual/jsb_platfrom_win32.cpp @@ -56,7 +56,7 @@ static bool JSB_loadFont(se::State &s) { SE_PRECONDITION2(ok, false, "JSB_loadFont : Error processing argument: source"); ccstd::string fontFilePath; - std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); + std::regex re("url\\(\\s*'\\s*(.*?)\\s*'\\s*\\)"); std::match_results results; if (std::regex_search(source.cbegin(), source.cend(), results, re)) { fontFilePath = results[1].str(); diff --git a/native/cocos/bindings/manual/jsb_socketio.cpp b/native/cocos/bindings/manual/jsb_socketio.cpp index 9ea2ce3aea..fcfc46897d 100644 --- a/native/cocos/bindings/manual/jsb_socketio.cpp +++ b/native/cocos/bindings/manual/jsb_socketio.cpp @@ -169,7 +169,7 @@ static bool SocketIO_send(se::State &s) { // NOLINT(readability-identifier-namin if (argc == 1) { ccstd::string payload; - bool ok = sevalue_to_native(args[0], &payload); + bool ok = sevalue_to_native(args[0], &payload); SE_PRECONDITION2(ok, false, "Converting payload failed!"); cobj->send(payload); @@ -187,7 +187,7 @@ static bool SocketIO_emit(se::State &s) { // NOLINT(readability-identifier-namin auto * cobj = static_cast(s.nativeThisObject()); if (argc >= 1) { - bool ok = false; + bool ok = false; ccstd::string eventName; ok = sevalue_to_native(args[0], &eventName); SE_PRECONDITION2(ok, false, "Converting eventName failed!"); @@ -235,7 +235,7 @@ static bool SocketIO_on(se::State &s) { // NOLINT(readability-identifier-naming) auto * cobj = static_cast(s.nativeThisObject()); if (argc == 2) { - bool ok = false; + bool ok = false; ccstd::string eventName; ok = sevalue_to_native(args[0], &eventName); SE_PRECONDITION2(ok, false, "Converting eventName failed!"); @@ -260,7 +260,7 @@ static bool SocketIO_connect(se::State &s) { // NOLINT(readability-identifier-na if (argc >= 1 && argc <= 3) { ccstd::string url; ccstd::string caFilePath; - bool ok = false; + bool ok = false; ok = sevalue_to_native(args[0], &url); SE_PRECONDITION2(ok, false, "Error processing arguments"); diff --git a/native/cocos/bindings/manual/jsb_spine_manual.cpp b/native/cocos/bindings/manual/jsb_spine_manual.cpp index 599cbdfe96..8ea04c2236 100644 --- a/native/cocos/bindings/manual/jsb_spine_manual.cpp +++ b/native/cocos/bindings/manual/jsb_spine_manual.cpp @@ -46,9 +46,9 @@ using namespace cc; -static spine::Cocos2dTextureLoader textureLoader; +static spine::Cocos2dTextureLoader textureLoader; static cc::RefMap *_preloadedAtlasTextures = nullptr; -static middleware::Texture2D * _getPreloadedAtlasTexture(const char *path) { +static middleware::Texture2D * _getPreloadedAtlasTexture(const char *path) { assert(_preloadedAtlasTextures); auto it = _preloadedAtlasTextures->find(path); return it != _preloadedAtlasTextures->end() ? it->second : nullptr; diff --git a/native/cocos/bindings/manual/jsb_websocket.cpp b/native/cocos/bindings/manual/jsb_websocket.cpp index ce222f48a6..d24fd38eee 100644 --- a/native/cocos/bindings/manual/jsb_websocket.cpp +++ b/native/cocos/bindings/manual/jsb_websocket.cpp @@ -413,7 +413,7 @@ static bool webSocketClose(se::State &s) { } else if (argc == 2) { assert(args[0].isNumber()); assert(args[1].isString()); - int reasonCode{0}; + int reasonCode{0}; ccstd::string reasonString; sevalue_to_native(args[0], &reasonCode); sevalue_to_native(args[1], &reasonString); diff --git a/native/cocos/bindings/manual/jsb_websocket_server.cpp b/native/cocos/bindings/manual/jsb_websocket_server.cpp index 10eebdcabe..3a6bfdd263 100644 --- a/native/cocos/bindings/manual/jsb_websocket_server.cpp +++ b/native/cocos/bindings/manual/jsb_websocket_server.cpp @@ -93,8 +93,8 @@ static bool WebSocketServer_listen(se::State &s) { return false; } - WSSPTR cobj = (WSSPTR)s.nativeThisObject(); - int arg_port = 0; + WSSPTR cobj = (WSSPTR)s.nativeThisObject(); + int arg_port = 0; ccstd::string arg_host = ""; std::function arg_callback; @@ -222,9 +222,9 @@ static bool WebSocketServer_onclose(se::State &s) { SE_REPORT_ERROR("argument type error, function expected!"); } - WSSPTR cobj = (WSSPTR)s.nativeThisObject(); + WSSPTR cobj = (WSSPTR)s.nativeThisObject(); std::function callback; - std::weak_ptr serverWeak = *cobj; + std::weak_ptr serverWeak = *cobj; s.thisObject()->setProperty("__onclose", args[0]); callback = [serverWeak](const ccstd::string &err) { @@ -267,7 +267,7 @@ static bool WebSocketServer_close(se::State &s) { return false; } - WSSPTR cobj = (WSSPTR)s.nativeThisObject(); + WSSPTR cobj = (WSSPTR)s.nativeThisObject(); std::function callback; if (argc == 1) { @@ -449,9 +449,9 @@ static bool WebSocketServer_Connection_close(se::State &s) { } std::function callback; - int arg_code = -1; + int arg_code = -1; ccstd::string arg_reason; - bool ok; + bool ok; if (argc >= 1) { ok = sevalue_to_native(args[0], &arg_code); diff --git a/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp b/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp index be44589bfc..2b97321081 100644 --- a/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp +++ b/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp @@ -34,8 +34,8 @@ #include #include #include -#include "base/std/container/string.h" #include "base/Config.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "cocos/base/Data.h" #include "cocos/base/DeferredReleasePool.h" @@ -150,19 +150,19 @@ public: void sendString(const ccstd::string &str); void sendBinary(const cc::Data &data); - void setRequestHeader(const ccstd::string &key, const ccstd::string &value); + void setRequestHeader(const ccstd::string &key, const ccstd::string &value); ccstd::string getAllResponseHeaders() const; ccstd::string getResponseHeader(const ccstd::string &key) const; - ReadyState getReadyState() const { return _readyState; } - uint16_t getStatus() const { return _status; } + ReadyState getReadyState() const { return _readyState; } + uint16_t getStatus() const { return _status; } const ccstd::string &getStatusText() const { return _statusText; } const ccstd::string &getResponseText() const { return _responseText; } - const cc::Data & getResponseData() const { return _responseData; } - ResponseType getResponseType() const { return _responseType; } - void setResponseType(ResponseType type) { _responseType = type; } + const cc::Data & getResponseData() const { return _responseData; } + ResponseType getResponseType() const { return _responseType; } + void setResponseType(ResponseType type) { _responseType = type; } - void overrideMimeType(const ccstd::string &mimeType); + void overrideMimeType(const ccstd::string &mimeType); ccstd::string getMimeType() const; void setTimeout(uint32_t timeoutInMilliseconds); @@ -429,7 +429,7 @@ void XMLHttpRequest::onResponse(HttpClient * /*client*/, HttpResponse *response) ccstd::string header(headers->begin(), headers->end()); std::istringstream stream(header); - ccstd::string line; + ccstd::string line; while (std::getline(stream, line)) { getHeader(line); } @@ -509,7 +509,7 @@ void XMLHttpRequest::setHttpRequestData(const char *data, size_t len) { void XMLHttpRequest::setRequestHeader(const ccstd::string &key, const ccstd::string &value) { std::stringstream header_s; // NOLINT(readability-identifier-naming) std::stringstream value_s; // NOLINT(readability-identifier-naming) - ccstd::string header; + ccstd::string header; auto iter = _requestHeader.find(key); @@ -525,7 +525,7 @@ void XMLHttpRequest::setRequestHeader(const ccstd::string &key, const ccstd::str ccstd::string XMLHttpRequest::getAllResponseHeaders() const { std::stringstream responseheaders; - ccstd::string responseheader; + ccstd::string responseheader; for (const auto &it : _httpHeader) { responseheaders << it.first << ": " << it.second << "\n"; @@ -647,8 +647,8 @@ static bool XMLHttpRequest_open(se::State &s) { //NOLINT(readability-identifier- const auto &args = s.args(); int argc = static_cast(args.size()); if (argc >= 2) { - auto * request = static_cast(s.nativeThisObject()); - bool ok = false; + auto * request = static_cast(s.nativeThisObject()); + bool ok = false; ccstd::string method; ok = sevalue_to_native(args[0], &method); SE_PRECONDITION2(ok, false, "args[0] isn't a string."); @@ -736,9 +736,9 @@ static bool XMLHttpRequest_setRequestHeader(se::State &s) { //NOLINT(readability size_t argc = args.size(); if (argc >= 2) { - auto * xhr = static_cast(s.nativeThisObject()); + auto * xhr = static_cast(s.nativeThisObject()); ccstd::string key; - bool ok = sevalue_to_native(args[0], &key); + bool ok = sevalue_to_native(args[0], &key); SE_PRECONDITION2(ok, false, "args[0] couldn't be converted to string."); ccstd::string value; ok = sevalue_to_native(args[1], &value); @@ -753,7 +753,7 @@ static bool XMLHttpRequest_setRequestHeader(se::State &s) { //NOLINT(readability SE_BIND_FUNC(XMLHttpRequest_setRequestHeader) static bool XMLHttpRequest_getAllResponseHeaders(se::State &s) { //NOLINT(readability-identifier-naming, google-runtime-references) - auto * xhr = static_cast(s.nativeThisObject()); + auto * xhr = static_cast(s.nativeThisObject()); ccstd::string headers = xhr->getAllResponseHeaders(); s.rval().setString(headers); return true; @@ -764,9 +764,9 @@ static bool XMLHttpRequest_getResonpseHeader(se::State &s) { //NOLINT(readabilit const auto &args = s.args(); size_t argc = args.size(); if (argc > 0) { - auto * xhr = static_cast(s.nativeThisObject()); + auto * xhr = static_cast(s.nativeThisObject()); ccstd::string key; - bool ok = sevalue_to_native(args[0], &key); + bool ok = sevalue_to_native(args[0], &key); SE_PRECONDITION2(ok, false, "args[0] couldn't be converted to string."); ccstd::string header = xhr->getResponseHeader(key); s.rval().setString(header); @@ -848,7 +848,7 @@ static bool XMLHttpRequest_getResponse(se::State &s) { //NOLINT(readability-iden } else { if (xhr->getResponseType() == XMLHttpRequest::ResponseType::JSON) { const ccstd::string &jsonText = xhr->getResponseText(); - se::HandleObject seObj(se::Object::createJSONObject(jsonText)); + se::HandleObject seObj(se::Object::createJSONObject(jsonText)); if (!seObj.isEmpty()) { s.rval().setObject(seObj); } else { @@ -923,7 +923,7 @@ static bool XMLHttpRequest_setResponseType(se::State &s) { //NOLINT(readability- if (argc > 0) { ccstd::string type; - bool ok = sevalue_to_native(args[0], &type); + bool ok = sevalue_to_native(args[0], &type); SE_PRECONDITION2(ok, false, "args[0] couldn't be converted to string!"); auto *xhr = static_cast(s.nativeThisObject()); diff --git a/native/cocos/core/DataView.h b/native/cocos/core/DataView.h index 0da5cdb41c..5dcb28f3d1 100644 --- a/native/cocos/core/DataView.h +++ b/native/cocos/core/DataView.h @@ -75,7 +75,7 @@ public: using UInt8Reader = uint8_t (DataView::*)(uint32_t) const; using ReaderVariant = cc::variant; static ccstd::unordered_map intReaderMap; - int32_t readInt(ReaderVariant &readerVariant, uint32_t offset); + int32_t readInt(ReaderVariant &readerVariant, uint32_t offset); using IntWritter = void (DataView::*)(uint32_t, uint32_t); static ccstd::unordered_map intWritterMap; diff --git a/native/cocos/core/System.h b/native/cocos/core/System.h index 5ad579b474..1a57142468 100644 --- a/native/cocos/core/System.h +++ b/native/cocos/core/System.h @@ -24,8 +24,8 @@ ****************************************************************************/ #pragma once -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" namespace cc { @@ -67,7 +67,7 @@ public: virtual ~System() = default; inline const ccstd::string &getId() { return id; } - inline void setId(ccstd::string &s) { id = s; } + inline void setId(ccstd::string &s) { id = s; } inline Priority getPriority() const { return _priority; } inline void setPriority(Priority i) { _priority = i; } diff --git a/native/cocos/core/Types.h b/native/cocos/core/Types.h index 427ea2ea41..b3e909a61f 100644 --- a/native/cocos/core/Types.h +++ b/native/cocos/core/Types.h @@ -25,8 +25,8 @@ #pragma once -#include "base/std/container/string.h" #include +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "cocos/base/Optional.h" @@ -57,7 +57,7 @@ struct VertexIdChannel { struct NativeDep { ccstd::string uuid; ccstd::string ext; - bool __isNative__{false}; // NOLINT(bugprone-reserved-identifier) + bool __isNative__{false}; // NOLINT(bugprone-reserved-identifier) explicit NativeDep() = default; diff --git a/native/cocos/core/animation/SkeletalAnimationUtils.cpp b/native/cocos/core/animation/SkeletalAnimationUtils.cpp index f775dd1297..5c6bcc6f5f 100644 --- a/native/cocos/core/animation/SkeletalAnimationUtils.cpp +++ b/native/cocos/core/animation/SkeletalAnimationUtils.cpp @@ -29,7 +29,7 @@ namespace cc { namespace { -ccstd::vector stack; //cjh TODO: how to release ? +ccstd::vector stack; //cjh TODO: how to release ? ccstd::unordered_map pool; } // namespace @@ -68,7 +68,7 @@ IJointTransform *getTransform(Node *node, Node *root) { uint32_t i = 0; while (node != root) { const ccstd::string &id = node->getUuid(); - auto iter = pool.find(id); + auto iter = pool.find(id); if (iter != pool.end()) { joint = iter->second; break; diff --git a/native/cocos/core/assets/Asset.cpp b/native/cocos/core/assets/Asset.cpp index 9b8335b19b..867326ffed 100644 --- a/native/cocos/core/assets/Asset.cpp +++ b/native/cocos/core/assets/Asset.cpp @@ -57,7 +57,7 @@ ccstd::string Asset::getNativeUrl() const { } return _nativeUrl; } -Asset::Asset() = default; +Asset::Asset() = default; Asset::~Asset() = default; NativeDep Asset::getNativeDep() const { diff --git a/native/cocos/core/assets/Asset.h b/native/cocos/core/assets/Asset.h index aab96227b6..861bbd27fd 100644 --- a/native/cocos/core/assets/Asset.h +++ b/native/cocos/core/assets/Asset.h @@ -57,7 +57,7 @@ public: NativeDep getNativeDep() const; inline const ccstd::string &getUuid() const { return _uuid; } - inline void setUuid(const ccstd::string &uuid) { _uuid = uuid; } + inline void setUuid(const ccstd::string &uuid) { _uuid = uuid; } /** * @en diff --git a/native/cocos/core/assets/BitmapFont.cpp b/native/cocos/core/assets/BitmapFont.cpp index f0d4869ccf..fcec95c150 100644 --- a/native/cocos/core/assets/BitmapFont.cpp +++ b/native/cocos/core/assets/BitmapFont.cpp @@ -92,7 +92,7 @@ void BitmapFontFace::doInit(const FontFaceInfo & /*info*/) { _textures.resize(pages, nullptr); ccstd::string path = fontPath; - auto pos = fontPath.rfind('/'); + auto pos = fontPath.rfind('/'); if (pos == ccstd::string::npos) { pos = fontPath.rfind('\\'); @@ -103,9 +103,9 @@ void BitmapFontFace::doInit(const FontFaceInfo & /*info*/) { } while (pageNode) { - uint32_t id = pageNode->UnsignedAttribute("id"); + uint32_t id = pageNode->UnsignedAttribute("id"); ccstd::string file = pageNode->Attribute("file"); - _textures[id] = loadTexture(path + file); + _textures[id] = loadTexture(path + file); pageNode = pageNode->NextSiblingElement(); } diff --git a/native/cocos/core/assets/EffectAsset.cpp b/native/cocos/core/assets/EffectAsset.cpp index f5db3fb308..9e6e73fc6c 100644 --- a/native/cocos/core/assets/EffectAsset.cpp +++ b/native/cocos/core/assets/EffectAsset.cpp @@ -219,7 +219,7 @@ ccstd::vector EffectAsset::doCombine(const ccstd::vectorsecond; - const ccstd::string & key = iter->first; + const ccstd::string & key = iter->first; ccstd::vector records; if (cur.empty()) { @@ -259,7 +259,7 @@ ccstd::vector EffectAsset::generateRecords(const ccstd::string &key } ccstd::vector EffectAsset::insertInfoValue(const ccstd::vector &records, - const ccstd::string & key, + const ccstd::string & key, const IPreCompileInfoValueType & value) { ccstd::vector ret; for (const auto &record : records) { diff --git a/native/cocos/core/assets/EffectAsset.h b/native/cocos/core/assets/EffectAsset.h index e4fd0e8b3a..569ea81a1f 100644 --- a/native/cocos/core/assets/EffectAsset.h +++ b/native/cocos/core/assets/EffectAsset.h @@ -25,8 +25,8 @@ #pragma once -#include "base/std/container/string.h" #include +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "cocos/base/Optional.h" @@ -338,7 +338,7 @@ struct IPassStates { cc::optional depthStencilState; cc::optional blendState; cc::optional dynamicStates; - cc::optional phase; + cc::optional phase; IPassStates() = default; explicit IPassStates(const IPassInfoFull &o); @@ -358,12 +358,12 @@ struct IPassInfoFull final { //cjh } : public IPassInfo { cc::optional depthStencilState; cc::optional blendState; cc::optional dynamicStates; - cc::optional phase; + cc::optional phase; // IPassInfo - ccstd::string program; // auto-generated from 'vert' and 'frag' + ccstd::string program; // auto-generated from 'vert' and 'frag' cc::optional embeddedMacros; index_t propertyIndex{CC_INVALID_INDEX}; - cc::optional switch_; + cc::optional switch_; cc::optional properties; // IPassInfoFull @@ -393,19 +393,19 @@ using IPassInfo = IPassInfoFull; struct ITechniqueInfo { ccstd::vector passes; - cc::optional name; + cc::optional name; }; struct IBlockInfo { int32_t binding{-1}; - ccstd::string name; + ccstd::string name; ccstd::vector members; gfx::ShaderStageFlags stageFlags{gfx::ShaderStageFlags::NONE}; }; struct ISamplerTextureInfo { int32_t binding{-1}; - ccstd::string name; + ccstd::string name; gfx::Type type{gfx::Type::UNKNOWN}; uint32_t count{0}; gfx::ShaderStageFlags stageFlags{gfx::ShaderStageFlags::NONE}; @@ -414,7 +414,7 @@ struct ISamplerTextureInfo { struct ITextureInfo { uint32_t set{0}; int32_t binding{-1}; - ccstd::string name; + ccstd::string name; gfx::Type type{gfx::Type::UNKNOWN}; uint32_t count{0}; gfx::ShaderStageFlags stageFlags{gfx::ShaderStageFlags::NONE}; @@ -423,21 +423,21 @@ struct ITextureInfo { struct ISamplerInfo { uint32_t set{0}; int32_t binding{-1}; - ccstd::string name; + ccstd::string name; uint32_t count{0}; gfx::ShaderStageFlags stageFlags{gfx::ShaderStageFlags::NONE}; }; struct IBufferInfo { int32_t binding{-1}; - ccstd::string name; + ccstd::string name; gfx::MemoryAccess memoryAccess{gfx::MemoryAccess::NONE}; gfx::ShaderStageFlags stageFlags{gfx::ShaderStageFlags::NONE}; }; struct IImageInfo { int32_t binding{-1}; - ccstd::string name; + ccstd::string name; gfx::Type type{gfx::Type::UNKNOWN}; uint32_t count{0}; gfx::MemoryAccess memoryAccess{gfx::MemoryAccess::NONE}; @@ -447,18 +447,18 @@ struct IImageInfo { struct IInputAttachmentInfo { uint32_t set{0}; int32_t binding{-1}; - ccstd::string name; + ccstd::string name; uint32_t count{0}; gfx::ShaderStageFlags stageFlags{gfx::ShaderStageFlags::NONE}; }; struct IAttributeInfo { ccstd::string name; - gfx::Format format{gfx::Format::UNKNOWN}; - bool isNormalized{false}; - uint32_t stream{0U}; - bool isInstanced{false}; - uint32_t location{0U}; + gfx::Format format{gfx::Format::UNKNOWN}; + bool isNormalized{false}; + uint32_t stream{0U}; + bool isInstanced{false}; + uint32_t location{0U}; ccstd::vector defines; }; @@ -466,7 +466,7 @@ struct IAttributeInfo { struct IDefineInfo { ccstd::string name; ccstd::string type; - cc::optional> range; //cjh number is float? ?: number[]; + cc::optional> range; //cjh number is float? ?: number[]; cc::optional> options; cc::optional defaultVal; }; @@ -497,7 +497,7 @@ struct IShaderSource { }; struct IShaderInfo { - ccstd::string name; + ccstd::string name; uint64_t hash{0xFFFFFFFFFFFFFFFFULL}; //cjh hash is 64 bit? IShaderSource glsl4; IShaderSource glsl3; @@ -583,7 +583,7 @@ protected: static ccstd::vector doCombine(const ccstd::vector &cur, const IPreCompileInfo &info, IPreCompileInfo::iterator iter); static ccstd::vector generateRecords(const ccstd::string &key, const IPreCompileInfoValueType &value); static ccstd::vector insertInfoValue(const ccstd::vector &records, - const ccstd::string & key, + const ccstd::string & key, const IPreCompileInfoValueType & value); void precompile(); diff --git a/native/cocos/core/assets/Font.h b/native/cocos/core/assets/Font.h index 1e481f382d..87ff0d5773 100644 --- a/native/cocos/core/assets/Font.h +++ b/native/cocos/core/assets/Font.h @@ -141,7 +141,7 @@ public: virtual FontFace *createFace(const FontFaceInfo &info) = 0; inline FontType getType() const { return _type; } - inline const ccstd::string & getPath() const { return _path; } + inline const ccstd::string & getPath() const { return _path; } inline const ccstd::vector &getData() const { return _data; } inline FontFace * getFace(uint32_t fontSize) { return _faces[fontSize]; } void releaseFaces(); @@ -150,7 +150,7 @@ protected: void load(const ccstd::string &path); FontType _type{FontType::INVALID}; - ccstd::string _path; + ccstd::string _path; ccstd::vector _data; ccstd::unordered_map _faces; }; diff --git a/native/cocos/core/assets/FreeTypeFont.h b/native/cocos/core/assets/FreeTypeFont.h index 20eea61e37..9f5893e2ad 100644 --- a/native/cocos/core/assets/FreeTypeFont.h +++ b/native/cocos/core/assets/FreeTypeFont.h @@ -28,8 +28,8 @@ #pragma once #include -#include "base/std/container/string.h" #include "Font.h" +#include "base/std/container/string.h" namespace cc { diff --git a/native/cocos/core/assets/ImageAsset.h b/native/cocos/core/assets/ImageAsset.h index 479ab098f8..08350af45c 100644 --- a/native/cocos/core/assets/ImageAsset.h +++ b/native/cocos/core/assets/ImageAsset.h @@ -112,7 +112,7 @@ private: uint8_t * _data{nullptr}; bool _needFreeData{false}; // Should free data if the data is assigned in C++. ArrayBuffer::Ptr _arrayBuffer; //minggo: hold the data from ImageSource. - ccstd::string _url; + ccstd::string _url; CC_DISALLOW_COPY_MOVE_ASSIGN(ImageAsset); }; diff --git a/native/cocos/core/assets/Material.cpp b/native/cocos/core/assets/Material.cpp index d1d7028206..39662c46d6 100644 --- a/native/cocos/core/assets/Material.cpp +++ b/native/cocos/core/assets/Material.cpp @@ -160,9 +160,9 @@ void Material::setProperty(const ccstd::string &name, const MaterialPropertyVari } } -#define CC_MATERIAL_SETPROPERTY_IMPL(funcNameSuffix, type) \ +#define CC_MATERIAL_SETPROPERTY_IMPL(funcNameSuffix, type) \ void Material::setProperty##funcNameSuffix(const ccstd::string &name, type val, index_t passIdx /* = CC_INVALID_INDEX*/) { \ - setProperty(name, val, passIdx); \ + setProperty(name, val, passIdx); \ } CC_MATERIAL_SETPROPERTY_IMPL(Float32, float) @@ -179,14 +179,14 @@ CC_MATERIAL_SETPROPERTY_IMPL(GFXTexture, gfx::Texture *) #undef CC_MATERIAL_SETPROPERTY_IMPL -#define CC_MATERIAL_SETPROPERTY_ARRAY_IMPL(funcNameSuffix, type) \ +#define CC_MATERIAL_SETPROPERTY_ARRAY_IMPL(funcNameSuffix, type) \ void Material::setProperty##funcNameSuffix##Array(const ccstd::string &name, const ccstd::vector &val, index_t /*passIdx = CC_INVALID_INDEX*/) { \ - MaterialPropertyList propertyArr; \ - propertyArr.reserve(val.size()); \ - for (const auto &e : val) { \ - propertyArr.emplace_back(e); \ - } \ - setProperty(name, propertyArr); \ + MaterialPropertyList propertyArr; \ + propertyArr.reserve(val.size()); \ + for (const auto &e : val) { \ + propertyArr.emplace_back(e); \ + } \ + setProperty(name, propertyArr); \ } CC_MATERIAL_SETPROPERTY_ARRAY_IMPL(Float32, float) diff --git a/native/cocos/core/assets/Material.h b/native/cocos/core/assets/Material.h index f524ebe42b..4f7562ad83 100644 --- a/native/cocos/core/assets/Material.h +++ b/native/cocos/core/assets/Material.h @@ -25,8 +25,8 @@ #pragma once -#include "base/std/container/string.h" #include "base/Ptr.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "cocos/base/Optional.h" #include "cocos/base/Variant.h" diff --git a/native/cocos/core/assets/RenderTexture.h b/native/cocos/core/assets/RenderTexture.h index 1fe64787be..fe916b95ca 100644 --- a/native/cocos/core/assets/RenderTexture.h +++ b/native/cocos/core/assets/RenderTexture.h @@ -31,7 +31,7 @@ namespace cc { struct IRenderTextureCreateInfo { - cc::optional name; + cc::optional name; uint32_t width; uint32_t height; cc::optional passInfo; diff --git a/native/cocos/core/assets/Texture2D.cpp b/native/cocos/core/assets/Texture2D.cpp index 98e37654e4..9b140f34fc 100644 --- a/native/cocos/core/assets/Texture2D.cpp +++ b/native/cocos/core/assets/Texture2D.cpp @@ -123,7 +123,7 @@ bool Texture2D::destroy() { ccstd::string Texture2D::description() const { std::stringstream ret; - ccstd::string url; + ccstd::string url; if (!_mipmaps.empty()) { url = _mipmaps[0]->getUrl(); } diff --git a/native/cocos/core/assets/TextureBase.cpp b/native/cocos/core/assets/TextureBase.cpp index f0b3e9b3e5..63e0349a26 100644 --- a/native/cocos/core/assets/TextureBase.cpp +++ b/native/cocos/core/assets/TextureBase.cpp @@ -25,9 +25,9 @@ #include "core/assets/TextureBase.h" #include "base/StringUtil.h" +#include "cocos/core/platform/Debug.h" #include "core/event/EventTypesToJS.h" #include "core/utils/IDGenerator.h" -#include "cocos/core/platform/Debug.h" #include "renderer/gfx-base/GFXDevice.h" #include "renderer/pipeline/Define.h" @@ -120,7 +120,7 @@ gfx::Sampler *TextureBase::getGFXSampler() const { if (_gfxDevice != nullptr) { const_cast(this)->_gfxSampler = _gfxDevice->getSampler(_samplerInfo); } else { - debug::errorID(9302); + debug::errorID(9302); } } return _gfxSampler; @@ -141,7 +141,7 @@ void TextureBase::deserialize(const cc::any &serializedData, const cc::any & /*h return; } const ccstd::string &data = *pData; - auto fields = StringUtil::split(data, ","); + auto fields = StringUtil::split(data, ","); fields.insert(fields.begin(), ""); if (fields.size() >= 5) { diff --git a/native/cocos/core/assets/TextureBase.h b/native/cocos/core/assets/TextureBase.h index 88f53047f7..da6d1f1fdc 100644 --- a/native/cocos/core/assets/TextureBase.h +++ b/native/cocos/core/assets/TextureBase.h @@ -248,7 +248,7 @@ public: uint32_t _height{1}; protected: - ccstd::string _id; + ccstd::string _id; gfx::SamplerInfo _samplerInfo; gfx::Sampler * _gfxSampler{nullptr}; gfx::Device * _gfxDevice{nullptr}; diff --git a/native/cocos/core/assets/TextureCube.h b/native/cocos/core/assets/TextureCube.h index acdf1081fb..bba6bed573 100644 --- a/native/cocos/core/assets/TextureCube.h +++ b/native/cocos/core/assets/TextureCube.h @@ -59,7 +59,7 @@ struct ITextureCubeSerializeMipmapData { }; struct ITextureCubeSerializeData { - ccstd::string base; + ccstd::string base; bool rgbe{false}; ccstd::vector mipmaps; }; diff --git a/native/cocos/core/builtin/BuiltinResMgr.h b/native/cocos/core/builtin/BuiltinResMgr.h index 240fe3636c..1be7c7c0c9 100644 --- a/native/cocos/core/builtin/BuiltinResMgr.h +++ b/native/cocos/core/builtin/BuiltinResMgr.h @@ -66,10 +66,10 @@ private: static BuiltinResMgr *instance; - gfx::Device * _device{nullptr}; + gfx::Device * _device{nullptr}; Record> _resources; - ccstd::vector> _materialsToBeCompiled; - bool _isInitialized{false}; + ccstd::vector> _materialsToBeCompiled; + bool _isInitialized{false}; CC_DISALLOW_COPY_MOVE_ASSIGN(BuiltinResMgr); }; diff --git a/native/cocos/core/builtin/ShaderSourceAssembly.h b/native/cocos/core/builtin/ShaderSourceAssembly.h index be54d06ef7..39fd55e0c2 100644 --- a/native/cocos/core/builtin/ShaderSourceAssembly.h +++ b/native/cocos/core/builtin/ShaderSourceAssembly.h @@ -25,8 +25,8 @@ #pragma once -#include "base/std/container/string.h" #include "base/StringUtil.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" namespace cc { diff --git a/native/cocos/core/data/Object.h b/native/cocos/core/data/Object.h index 027db4ec5d..203c598b2e 100644 --- a/native/cocos/core/data/Object.h +++ b/native/cocos/core/data/Object.h @@ -119,7 +119,7 @@ public: //cjh public declare [editorExtrasTag]: unknown; - Flags _objFlags{Flags::ZERO}; + Flags _objFlags{Flags::ZERO}; ccstd::string _name; protected: @@ -139,7 +139,7 @@ public: * ``` */ inline const ccstd::string &getName() const { return _name; } - inline void setName(const ccstd::string &value) { _name = value; } + inline void setName(const ccstd::string &value) { _name = value; } /** * @en After inheriting CCObject objects, control whether you need to hide, lock, serialize, and other functions. diff --git a/native/cocos/core/data/deserializer/EffectAssetDeserializer.cpp b/native/cocos/core/data/deserializer/EffectAssetDeserializer.cpp index 32652dfd70..0fe2b89c39 100644 --- a/native/cocos/core/data/deserializer/EffectAssetDeserializer.cpp +++ b/native/cocos/core/data/deserializer/EffectAssetDeserializer.cpp @@ -100,9 +100,9 @@ static IPropertyHandleInfo jsonToPropertyHandleInfo(const rapidjson::Value &hand if (handleInfoVal.IsArray()) { // using IPropertyHandleInfo = std::tuple; ccstd::string t0; - uint32_t t1 = 0; - gfx::Type t2 = gfx::Type::UNKNOWN; - int32_t i = 0; + uint32_t t1 = 0; + gfx::Type t2 = gfx::Type::UNKNOWN; + int32_t i = 0; for (const auto &e : handleInfoVal.GetArray()) { switch (i) { diff --git a/native/cocos/core/event/CallbacksInvoker.h b/native/cocos/core/event/CallbacksInvoker.h index bf0ec3f50e..f51ef610b3 100644 --- a/native/cocos/core/event/CallbacksInvoker.h +++ b/native/cocos/core/event/CallbacksInvoker.h @@ -26,8 +26,8 @@ #include #include -#include "base/std/container/string.h" #include +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "base/Log.h" diff --git a/native/cocos/core/platform/Debug.cpp b/native/cocos/core/platform/Debug.cpp index e3ebc6e796..4cf0b35019 100644 --- a/native/cocos/core/platform/Debug.cpp +++ b/native/cocos/core/platform/Debug.cpp @@ -60,7 +60,7 @@ LogLevel getLogLevel(DebugMode mode) { ccstd::string getTypedFormatter(DebugMode mode, uint32_t id) { const ccstd::string &tag = getPrefixTag(mode); - ccstd::string msg; + ccstd::string msg; #if CC_DEBUG > 0 if (debugInfos.find(id) == debugInfos.end()) { msg = "unknown id"; @@ -79,7 +79,7 @@ ccstd::string getTypedFormatter(DebugMode mode, uint32_t id) { void printLog(DebugMode mode, const ccstd::string &fmt, cc::any *arr, int paramsLength) { ccstd::string msg = fmt; const ccstd::string &prefix = getPrefixTag(mode); - LogLevel logLevel = getLogLevel(mode); + LogLevel logLevel = getLogLevel(mode); size_t pos; for (int i = 1; i <= paramsLength; i++) { diff --git a/native/cocos/core/platform/Debug.h b/native/cocos/core/platform/Debug.h index 3a67202a39..d432581d5e 100644 --- a/native/cocos/core/platform/Debug.h +++ b/native/cocos/core/platform/Debug.h @@ -25,15 +25,15 @@ THE SOFTWARE. #pragma once -#include "base/std/container/string.h" #include "base/Any.h" #include "base/Log.h" +#include "base/std/container/string.h" #include "core/builtin/DebugInfos.h" namespace cc { namespace debug { -const ccstd::string ERROR_MAP_URL{"https://github.com/cocos-creator/engine/blob/3d/EngineErrorMap.md"}; +const ccstd::string ERROR_MAP_URL{"https://github.com/cocos-creator/engine/blob/3d/EngineErrorMap.md"}; enum class DebugMode { @@ -187,33 +187,33 @@ void printLog(DebugMode mode, const ccstd::string &fmt, cc::any *arr, int params template void logID(uint32_t id, Args... optionalParams) { - ccstd::string msg = getTypedFormatter(DebugMode::VERBOSE, id); - int size = sizeof...(optionalParams); - cc::any arr[] = {0, unpackParams(optionalParams)...}; + ccstd::string msg = getTypedFormatter(DebugMode::VERBOSE, id); + int size = sizeof...(optionalParams); + cc::any arr[] = {0, unpackParams(optionalParams)...}; printLog(DebugMode::VERBOSE, msg, arr, size); } template void warnID(uint32_t id, Args... optionalParams) { - ccstd::string msg = getTypedFormatter(DebugMode::WARN, id); - int size = sizeof...(optionalParams); - cc::any arr[] = {0, unpackParams(optionalParams)...}; + ccstd::string msg = getTypedFormatter(DebugMode::WARN, id); + int size = sizeof...(optionalParams); + cc::any arr[] = {0, unpackParams(optionalParams)...}; printLog(DebugMode::WARN, msg, arr, size); } template void errorID(uint32_t id, Args... optionalParams) { ccstd::string msg = getTypedFormatter(DebugMode::ERROR_MODE, id); - int size = sizeof...(optionalParams); - cc::any arr[] = {0, unpackParams(optionalParams)...}; + int size = sizeof...(optionalParams); + cc::any arr[] = {0, unpackParams(optionalParams)...}; printLog(DebugMode::ERROR_MODE, msg, arr, size); } template void assertID(uint32_t id, Args... optionalParams) { ccstd::string msg = getTypedFormatter(DebugMode::INFO, id); - int size = sizeof...(optionalParams); - cc::any arr[] = {0, unpackParams(optionalParams)...}; + int size = sizeof...(optionalParams); + cc::any arr[] = {0, unpackParams(optionalParams)...}; printLog(DebugMode::INFO, msg, arr, size); } diff --git a/native/cocos/core/scene-graph/Node.cpp b/native/cocos/core/scene-graph/Node.cpp index fd7720a682..ca986e1a71 100644 --- a/native/cocos/core/scene-graph/Node.cpp +++ b/native/cocos/core/scene-graph/Node.cpp @@ -54,7 +54,7 @@ ccstd::vector> Node::stacks; namespace { CachedArray allNodes{128}; //cjh how to clear ? -const ccstd::string EMPTY_NODE_NAME; +const ccstd::string EMPTY_NODE_NAME; IDGenerator idGenerator("Node"); ccstd::vector dirtyNodes; @@ -519,9 +519,9 @@ void Node::setSiblingIndex(index_t index) { } Node *Node::getChildByPath(const ccstd::string &path) const { - size_t end = 0; + size_t end = 0; ccstd::vector segments = StringUtil::split(path, "/"); - auto * lastNode = const_cast(this); + auto * lastNode = const_cast(this); for (const ccstd::string &segment : segments) { if (segment.empty()) { continue; diff --git a/native/cocos/core/scene-graph/Node.h b/native/cocos/core/scene-graph/Node.h index 50f2285c26..0c86905856 100644 --- a/native/cocos/core/scene-graph/Node.h +++ b/native/cocos/core/scene-graph/Node.h @@ -681,7 +681,7 @@ public: std::function onSiblingIndexChanged{nullptr}; index_t _siblingIndex{0}; // For deserialization - ccstd::string _id; + ccstd::string _id; ccstd::vector> _children; Node * _parent{nullptr}; bool _active{true}; diff --git a/native/cocos/core/utils/IDGenerator.cpp b/native/cocos/core/utils/IDGenerator.cpp index c67a42746e..462ed2d62c 100644 --- a/native/cocos/core/utils/IDGenerator.cpp +++ b/native/cocos/core/utils/IDGenerator.cpp @@ -1,7 +1,7 @@ #include "core/utils/IDGenerator.h" #include "base/Random.h" #include "boost/uuid/uuid.hpp" -#include "boost/uuid/uuid_generators.hpp" +#include "boost/uuid/uuid_generators.hpp" #include "boost/uuid/uuid_io.hpp" namespace cc { diff --git a/native/cocos/core/utils/Path.cpp b/native/cocos/core/utils/Path.cpp index 43ac47036a..1e8dbd11d8 100644 --- a/native/cocos/core/utils/Path.cpp +++ b/native/cocos/core/utils/Path.cpp @@ -65,7 +65,7 @@ ccstd::string extname(const ccstd::string &path) { } ccstd::string newPath = path; - size_t index = path.find_first_of('?'); + size_t index = path.find_first_of('?'); if (index != ccstd::string::npos && index > 0) { newPath = newPath.substr(0, index); } @@ -91,7 +91,7 @@ ccstd::string mainFileName(const ccstd::string &fileName) { ccstd::string basename(const ccstd::string &path, const ccstd::string &extName /* = ""*/) { ccstd::string newPath = path; - size_t index = path.find_first_of('?'); + size_t index = path.find_first_of('?'); if (index != ccstd::string::npos && index > 0) { newPath = newPath.substr(0, index); } @@ -128,7 +128,7 @@ ccstd::string dirname(const ccstd::string &path) { } ccstd::string changeExtname(const ccstd::string &path, const ccstd::string &extName /* = ""*/) { - size_t index = path.find_first_of('?'); + size_t index = path.find_first_of('?'); ccstd::string newPath = path; ccstd::string tempStr; if (index != ccstd::string::npos && index > 0) { @@ -149,7 +149,7 @@ ccstd::string changeBasename(const ccstd::string &path, const ccstd::string &bas return changeExtname(path, baseName); } - size_t index = path.find_last_of('?'); + size_t index = path.find_last_of('?'); ccstd::string tempStr; ccstd::string newPath = path; const ccstd::string ext = isSameExt ? extname(path) : ""; diff --git a/native/cocos/math/MathBase.h b/native/cocos/math/MathBase.h index 53b1e6b5f7..f59a62f376 100644 --- a/native/cocos/math/MathBase.h +++ b/native/cocos/math/MathBase.h @@ -27,8 +27,8 @@ #define __CCMATHBASE_H__ #include -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" /** * @addtogroup base * @{ diff --git a/native/cocos/network/Downloader-curl.cpp b/native/cocos/network/Downloader-curl.cpp index 7e4381b821..e3fbb92fb3 100644 --- a/native/cocos/network/Downloader-curl.cpp +++ b/native/cocos/network/Downloader-curl.cpp @@ -110,7 +110,7 @@ public: bool ret = false; do { ccstd::string dir; - size_t found = _tempFileName.find_last_of("/\\"); + size_t found = _tempFileName.find_last_of("/\\"); if (found == ccstd::string::npos) { _errCode = DownloadTask::ERROR_INVALID_PARAMS; _errCodeInternal = 0; @@ -196,13 +196,13 @@ private: int64_t _totalBytesReceived; // error - int _errCode; - int _errCodeInternal; + int _errCode; + int _errCodeInternal; ccstd::string _errDescription; // for saving data - ccstd::string _fileName; - ccstd::string _tempFileName; + ccstd::string _fileName; + ccstd::string _tempFileName; ccstd::vector _buf; FILE * _fp; @@ -218,7 +218,7 @@ private: _header.reserve(384); // pre alloc header string buffer } }; -int DownloadTaskCURL::_sSerialId; +int DownloadTaskCURL::_sSerialId; ccstd::set DownloadTaskCURL::_sStoragePathSet; typedef std::pair, DownloadTaskCURL *> TaskWrapper; diff --git a/native/cocos/network/Downloader-curl.h b/native/cocos/network/Downloader-curl.h index bec85e5213..3d2980a522 100644 --- a/native/cocos/network/Downloader-curl.h +++ b/native/cocos/network/Downloader-curl.h @@ -56,7 +56,7 @@ protected: // scheduler for update processing and finished task in main schedule void _onSchedule(float); - ccstd::string _schedulerKey; + ccstd::string _schedulerKey; std::weak_ptr _scheduler; }; diff --git a/native/cocos/network/Downloader-java.cpp b/native/cocos/network/Downloader-java.cpp index 1a7997d320..9b3963ad76 100644 --- a/native/cocos/network/Downloader-java.cpp +++ b/native/cocos/network/Downloader-java.cpp @@ -145,12 +145,12 @@ IDownloadTask *DownloaderJava::createCoTask(std::shared_ptr JCLS_DOWNLOADER, "createTask", "(" JARG_DOWNLOADER "I" JARG_STR JARG_STR "[" JARG_STR ")V")) { - jclass jclassString = methodInfo.env->FindClass("java/lang/String"); - jstring jstrURL = methodInfo.env->NewStringUTF(task->requestURL.c_str()); - jstring jstrPath = methodInfo.env->NewStringUTF(task->storagePath.c_str()); - jobjectArray jarrayHeader = methodInfo.env->NewObjectArray(task->header.size() * 2, jclassString, nullptr); + jclass jclassString = methodInfo.env->FindClass("java/lang/String"); + jstring jstrURL = methodInfo.env->NewStringUTF(task->requestURL.c_str()); + jstring jstrPath = methodInfo.env->NewStringUTF(task->storagePath.c_str()); + jobjectArray jarrayHeader = methodInfo.env->NewObjectArray(task->header.size() * 2, jclassString, nullptr); const ccstd::map &headMap = task->header; - int index = 0; + int index = 0; for (const auto &it : headMap) { methodInfo.env->SetObjectArrayElement(jarrayHeader, index++, methodInfo.env->NewStringUTF(it.first.c_str())); methodInfo.env->SetObjectArrayElement(jarrayHeader, index++, methodInfo.env->NewStringUTF(it.second.c_str())); @@ -226,7 +226,7 @@ void DownloaderJava::onFinishImpl(int taskId, int errCode, const char *errStr, c return; } DownloadTaskAndroid *coTask = iter->second; - ccstd::string str = (errStr ? errStr : ""); + ccstd::string str = (errStr ? errStr : ""); _taskMap.erase(iter); onTaskFinish(*coTask->task, errStr ? DownloadTask::ERROR_IMPL_INTERNAL : DownloadTask::ERROR_NO_ERROR, @@ -255,7 +255,7 @@ JNIEXPORT void JNICALL JNI_DOWNLOADER(nativeOnProgress)(JNIEnv * /*env*/, jclass } JNIEXPORT void JNICALL JNI_DOWNLOADER(nativeOnFinish)(JNIEnv *env, jclass /*clazz*/, jint id, jint taskId, jint errCode, jstring errStr, jbyteArray data) { - ccstd::string errStrTmp; + ccstd::string errStrTmp; ccstd::vector dataTmp; if (errStr) { const char *nativeErrStr = env->GetStringUTFChars(errStr, JNI_FALSE); diff --git a/native/cocos/network/Downloader.cpp b/native/cocos/network/Downloader.cpp index 9bf49fd2ef..27214f1c7b 100644 --- a/native/cocos/network/Downloader.cpp +++ b/native/cocos/network/Downloader.cpp @@ -85,7 +85,7 @@ Downloader::Downloader(const DownloaderHints &hints) { _impl->onTaskFinish = [this](const DownloadTask & task, int errorCode, int errorCodeInternal, - const ccstd::string & errorStr, + const ccstd::string & errorStr, const ccstd::vector &data) { if (DownloadTask::ERROR_NO_ERROR != errorCode) { if (onTaskError) { @@ -131,10 +131,10 @@ std::shared_ptr Downloader::createDownloadDataTask(const ccs return task; } -std::shared_ptr Downloader::createDownloadFileTask(const ccstd::string & srcUrl, - const ccstd::string & storagePath, +std::shared_ptr Downloader::createDownloadFileTask(const ccstd::string & srcUrl, + const ccstd::string & storagePath, const ccstd::map &header, - const ccstd::string & identifier /* = ""*/) { + const ccstd::string & identifier /* = ""*/) { auto * iTask = new (std::nothrow) DownloadTask(); std::shared_ptr task(iTask); do { diff --git a/native/cocos/network/Downloader.h b/native/cocos/network/Downloader.h index 7a37d83869..683758805c 100644 --- a/native/cocos/network/Downloader.h +++ b/native/cocos/network/Downloader.h @@ -29,9 +29,9 @@ #include #include -#include "base/std/container/string.h" #include "base/Macros.h" #include "base/std/container/map.h" +#include "base/std/container/string.h" #include "base/std/container/vector.h" namespace cc { @@ -49,9 +49,9 @@ public: const static int ERROR_IMPL_INTERNAL = -3; const static int ERROR_ABORT = -4; - ccstd::string identifier; - ccstd::string requestURL; - ccstd::string storagePath; + ccstd::string identifier; + ccstd::string requestURL; + ccstd::string storagePath; ccstd::map header; DownloadTask(); @@ -63,8 +63,8 @@ private: }; struct CC_DLL DownloaderHints { - uint32_t countOfMaxProcessingTasks; - uint32_t timeoutInSeconds; + uint32_t countOfMaxProcessingTasks; + uint32_t timeoutInSeconds; ccstd::string tempFileNameSuffix; }; @@ -86,10 +86,10 @@ public: int64_t totalBytesExpected)> onTaskProgress; - std::function + std::function onTaskError; void setOnFileTaskSuccess(const std::function &callback) { onFileTaskSuccess = callback; }; @@ -99,10 +99,10 @@ public: int64_t totalBytesReceived, int64_t totalBytesExpected)> &callback) { onTaskProgress = callback; }; - void setOnTaskError(const std::function &callback) { onTaskError = callback; }; + void setOnTaskError(const std::function &callback) { onTaskError = callback; }; std::shared_ptr createDownloadDataTask(const ccstd::string &srcUrl, const ccstd::string &identifier = ""); diff --git a/native/cocos/network/DownloaderImpl.h b/native/cocos/network/DownloaderImpl.h index 3ec5603481..56b6ab953c 100644 --- a/native/cocos/network/DownloaderImpl.h +++ b/native/cocos/network/DownloaderImpl.h @@ -28,8 +28,8 @@ #include #include -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" @@ -65,7 +65,7 @@ public: std::function &data)> onTaskFinish; diff --git a/native/cocos/network/HttpClient-java.cpp b/native/cocos/network/HttpClient-java.cpp index 07e8e8627d..674f558a3d 100644 --- a/native/cocos/network/HttpClient-java.cpp +++ b/native/cocos/network/HttpClient-java.cpp @@ -55,9 +55,9 @@ static HttpClient *gHttpClient = nullptr; // pointer to singleton struct CookiesInfo { ccstd::string domain; - bool tailmatch; + bool tailmatch; ccstd::string path; - bool secure; + bool secure; ccstd::string key; ccstd::string value; ccstd::string expires; @@ -423,7 +423,7 @@ private: cookiesVec.clear(); std::stringstream stream(cookiesInfo); - ccstd::string item; + ccstd::string item; while (std::getline(stream, item, '\n')) { cookiesVec.push_back(item); } @@ -444,8 +444,8 @@ private: continue; } - CookiesInfo co; - std::stringstream streamInfo(cookies); + CookiesInfo co; + std::stringstream streamInfo(cookies); ccstd::string item; ccstd::vector elems; @@ -467,7 +467,7 @@ private: } ccstd::string sendCookiesInfo; - int cookiesCount = 0; + int cookiesCount = 0; for (auto &cookieInfo : cookiesInfoVec) { if (_url.find(cookieInfo.domain) != ccstd::string::npos) { ccstd::string keyValue = cookieInfo.key; @@ -544,8 +544,8 @@ private: return nullptr; } ccstd::string strValue = cc::StringUtils::getStringUTFCharsJNI(env, jstr); - size_t size = strValue.size() + 1; - char * retVal = static_cast(malloc(size)); + size_t size = strValue.size() + 1; + char * retVal = static_cast(malloc(size)); if (retVal == nullptr) { return nullptr; } @@ -572,13 +572,13 @@ private: } private: // NOLINT(readability-redundant-access-specifiers) - HttpClient *_client; - jobject _httpURLConnection; + HttpClient * _client; + jobject _httpURLConnection; ccstd::string _requestmethod; ccstd::string _responseCookies; ccstd::string _cookieFileName; ccstd::string _url; - int _contentLength; + int _contentLength; }; // Process Response diff --git a/native/cocos/network/HttpClient.h b/native/cocos/network/HttpClient.h index 7d550e9bbd..7271050a1c 100644 --- a/native/cocos/network/HttpClient.h +++ b/native/cocos/network/HttpClient.h @@ -186,16 +186,16 @@ private: // NOLINT(readability-redundant-access-specifiers) std::mutex _schedulerMutex; RefVector _requestQueue; - std::mutex _requestQueueMutex; + std::mutex _requestQueueMutex; RefVector _responseQueue; - std::mutex _responseQueueMutex; + std::mutex _responseQueueMutex; ccstd::string _cookieFilename; - std::mutex _cookieFileMutex; + std::mutex _cookieFileMutex; ccstd::string _sslCaFilename; - std::mutex _sslCaFileMutex; + std::mutex _sslCaFileMutex; HttpCookie *_cookie; diff --git a/native/cocos/network/HttpCookie.cpp b/native/cocos/network/HttpCookie.cpp index cf63ad2c73..088c09afe7 100644 --- a/native/cocos/network/HttpCookie.cpp +++ b/native/cocos/network/HttpCookie.cpp @@ -37,7 +37,7 @@ void HttpCookie::readFile() { cookiesVec.clear(); std::stringstream stream(inString); - ccstd::string item; + ccstd::string item; while (std::getline(stream, item, '\n')) { cookiesVec.push_back(item); } @@ -61,8 +61,8 @@ void HttpCookie::readFile() { continue; } - CookiesInfo co; - std::stringstream streamInfo(cookie); + CookiesInfo co; + std::stringstream streamInfo(cookie); ccstd::vector elems; ccstd::string elemsItem; diff --git a/native/cocos/network/HttpCookie.h b/native/cocos/network/HttpCookie.h index 707657d51d..a492588529 100644 --- a/native/cocos/network/HttpCookie.h +++ b/native/cocos/network/HttpCookie.h @@ -33,9 +33,9 @@ struct CookiesInfo { ccstd::string domain; - bool tailmatch; + bool tailmatch; ccstd::string path; - bool secure; + bool secure; ccstd::string name; ccstd::string value; ccstd::string expires; @@ -53,7 +53,7 @@ public: void updateOrAddCookie(CookiesInfo *cookie); private: - ccstd::string _cookieFileName; + ccstd::string _cookieFileName; ccstd::vector _cookies; }; diff --git a/native/cocos/network/HttpRequest.h b/native/cocos/network/HttpRequest.h index 29624315fb..09a8ab4a6a 100644 --- a/native/cocos/network/HttpRequest.h +++ b/native/cocos/network/HttpRequest.h @@ -261,14 +261,14 @@ public: protected: // properties - Type _requestType{Type::UNKNOWN}; /// kHttpRequestGet, kHttpRequestPost or other enums + Type _requestType{Type::UNKNOWN}; /// kHttpRequestGet, kHttpRequestPost or other enums ccstd::string _url; /// target url that this request is sent to - ccstd::vector _requestData; /// used for POST + ccstd::vector _requestData; /// used for POST ccstd::string _tag; /// user defined tag, to identify different requests in response callback - ccHttpRequestCallback _callback; /// C++11 style callbacks - void * _userData{nullptr}; /// You can add your customed data here + ccHttpRequestCallback _callback; /// C++11 style callbacks + void * _userData{nullptr}; /// You can add your customed data here ccstd::vector _headers; /// custom http headers - float _timeoutInSeconds{10.F}; + float _timeoutInSeconds{10.F}; }; } // namespace network diff --git a/native/cocos/network/HttpResponse.h b/native/cocos/network/HttpResponse.h index fcb658864b..fd9b44781f 100644 --- a/native/cocos/network/HttpResponse.h +++ b/native/cocos/network/HttpResponse.h @@ -210,8 +210,8 @@ protected: ccstd::vector _responseData; /// the returned raw data. You can also dump it as a string ccstd::vector _responseHeader; /// the returned raw header data. You can also dump it as a string long _responseCode; /// the status code returned from libcurl, e.g. 200, 404 - ccstd::string _errorBuffer; /// if _responseCode != 200, please read _errorBuffer to find the reason - ccstd::string _responseDataString; // the returned raw data. You can also dump it as a string + ccstd::string _errorBuffer; /// if _responseCode != 200, please read _errorBuffer to find the reason + ccstd::string _responseDataString; // the returned raw data. You can also dump it as a string }; } // namespace network diff --git a/native/cocos/network/SocketIO.cpp b/native/cocos/network/SocketIO.cpp index 256b38aada..482a449b33 100644 --- a/native/cocos/network/SocketIO.cpp +++ b/native/cocos/network/SocketIO.cpp @@ -64,15 +64,15 @@ public: void initWithTypeIndex(int index); ccstd::string toString() const; - virtual int typeAsNumber() const; + virtual int typeAsNumber() const; const ccstd::string &typeForIndex(int index) const; - void setEndpoint(const ccstd::string &endpoint) { _endpoint = endpoint; }; + void setEndpoint(const ccstd::string &endpoint) { _endpoint = endpoint; }; const ccstd::string &getEndpoint() const { return _endpoint; }; - void setEvent(const ccstd::string &event) { _name = event; }; + void setEvent(const ccstd::string &event) { _name = event; }; const ccstd::string &getEvent() const { return _name; }; - void addData(const ccstd::string &data); + void addData(const ccstd::string &data); ccstd::vector getData() const { return _args; }; virtual ccstd::string stringify() const; @@ -95,7 +95,7 @@ class SocketIOPacketV10x : public SocketIOPacket { public: SocketIOPacketV10x(); ~SocketIOPacketV10x() override; - int typeAsNumber() const override; + int typeAsNumber() const override; ccstd::string stringify() const override; private: @@ -161,7 +161,7 @@ ccstd::string SocketIOPacket::toString() const { } int SocketIOPacket::typeAsNumber() const { ccstd::string::size_type num = 0; - auto item = std::find(_types.begin(), _types.end(), _type); + auto item = std::find(_types.begin(), _types.end(), _type); if (item != _types.end()) { num = item - _types.begin(); } @@ -227,7 +227,7 @@ SocketIOPacketV10x::SocketIOPacketV10x() { int SocketIOPacketV10x::typeAsNumber() const { ccstd::vector::size_type num = 0; - auto item = std::find(_typesMessage.begin(), _typesMessage.end(), _type); + auto item = std::find(_typesMessage.begin(), _typesMessage.end(), _type); if (item != _typesMessage.end()) { //it's a message num = item - _typesMessage.begin(); num += 40; @@ -301,9 +301,9 @@ class SIOClientImpl : public cc::RefCounted, public WebSocket::Delegate { private: int _heartbeat, _timeout; - ccstd::string _sid; + ccstd::string _sid; Uri _uri; - ccstd::string _caFilePath; + ccstd::string _caFilePath; bool _connected; SocketIOPacket::SocketIOVersion _version; @@ -345,9 +345,9 @@ public: //begin SIOClientImpl methods SIOClientImpl::SIOClientImpl(Uri uri, ccstd::string caFilePath) : _uri(std::move(uri)), - _caFilePath(std::move(caFilePath)), - _connected(false), - _ws(nullptr) { + _caFilePath(std::move(caFilePath)), + _connected(false), + _ws(nullptr) { } SIOClientImpl::~SIOClientImpl() { @@ -424,8 +424,8 @@ void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *res ccstd::string res = s.str(); ccstd::string sid; - int heartbeat = 0; - int timeout = 0; + int heartbeat = 0; + int timeout = 0; if (res.find('}') != ccstd::string::npos) { CC_LOG_INFO("SIOClientImpl::handshake() Socket.IO 1.x detected"); @@ -434,7 +434,7 @@ void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *res // 96:0{"sid":"jzrjDlQusSUxLTd3AAAV","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40 ccstd::string::size_type a; ccstd::string::size_type b; - a = res.find('{'); + a = res.find('{'); ccstd::string temp = res.substr(a, res.size() - a); // find the sid @@ -455,15 +455,15 @@ void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *res b = temp.find(','); ccstd::string heartbeatStr = temp.substr(a + 1, b - a); - heartbeat = atoi(heartbeatStr.c_str()) / 1000; - temp = temp.erase(0, b + 1); + heartbeat = atoi(heartbeatStr.c_str()) / 1000; + temp = temp.erase(0, b + 1); // get the timeout a = temp.find(':'); b = temp.find('}'); ccstd::string timeoutStr = temp.substr(a + 1, b - a); - timeout = atoi(timeoutStr.c_str()) / 1000; + timeout = atoi(timeoutStr.c_str()) / 1000; CC_LOG_INFO("done parsing 1.x"); } else { @@ -668,8 +668,8 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { CC_LOG_INFO("SIOClientImpl::onMessage received: %s", data.bytes); ccstd::string payload = data.bytes; - int control = atoi(payload.substr(0, 1).c_str()); - payload = payload.substr(1, payload.size() - 1); + int control = atoi(payload.substr(0, 1).c_str()); + payload = payload.substr(1, payload.size() - 1); SIOClient *c = nullptr; @@ -837,7 +837,7 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { ccstd::string::size_type payloadSecondSlashPos = payload.substr(payloadFirstSlashPos + 1).find('\"'); ccstd::string eventname = payload.substr(payloadFirstSlashPos + 1, - payloadSecondSlashPos - payloadFirstSlashPos + 1); + payloadSecondSlashPos - payloadFirstSlashPos + 1); CC_LOG_INFO("event name %s between %i and %i", eventname.c_str(), payloadFirstSlashPos, payloadSecondSlashPos); diff --git a/native/cocos/network/SocketIO.h b/native/cocos/network/SocketIO.h index 37c33e09a7..7fa9fb3ece 100644 --- a/native/cocos/network/SocketIO.h +++ b/native/cocos/network/SocketIO.h @@ -28,9 +28,9 @@ #pragma once #include -#include "base/std/container/string.h" #include "base/Macros.h" #include "base/RefMap.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" /** @@ -170,7 +170,7 @@ class CC_DLL SIOClient private: friend class SocketIO; // Only SocketIO class could contruct a SIOClient instance. - ccstd::string _path, _tag; + ccstd::string _path, _tag; bool _connected; SIOClientImpl *_socket; diff --git a/native/cocos/network/Uri.cpp b/native/cocos/network/Uri.cpp index c335a30912..a8e7ae8462 100644 --- a/native/cocos/network/Uri.cpp +++ b/native/cocos/network/Uri.cpp @@ -175,7 +175,7 @@ bool Uri::doParse(const ccstd::string &str) { } ccstd::string authorityAndPath(match[2].first, match[2].second); - std::smatch authorityAndPathMatch; + std::smatch authorityAndPathMatch; if (!std::regex_match(authorityAndPath.cbegin(), authorityAndPath.cend(), authorityAndPathMatch, diff --git a/native/cocos/network/Uri.h b/native/cocos/network/Uri.h index cd9e70b4f8..bf1f4d57e7 100644 --- a/native/cocos/network/Uri.h +++ b/native/cocos/network/Uri.h @@ -20,8 +20,8 @@ #pragma once #include -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" #include "base/std/container/vector.h" /** @@ -157,20 +157,20 @@ public: private: bool doParse(const ccstd::string &str); - bool _isValid; - bool _isSecure; - ccstd::string _scheme; - ccstd::string _username; - ccstd::string _password; - ccstd::string _host; - ccstd::string _hostName; - bool _hasAuthority; - uint16_t _port; - ccstd::string _authority; - ccstd::string _pathEtc; - ccstd::string _path; - ccstd::string _query; - ccstd::string _fragment; + bool _isValid; + bool _isSecure; + ccstd::string _scheme; + ccstd::string _username; + ccstd::string _password; + ccstd::string _host; + ccstd::string _hostName; + bool _hasAuthority; + uint16_t _port; + ccstd::string _authority; + ccstd::string _pathEtc; + ccstd::string _path; + ccstd::string _query; + ccstd::string _fragment; ccstd::vector> _queryParams; }; diff --git a/native/cocos/network/WebSocket-libwebsockets.cpp b/native/cocos/network/WebSocket-libwebsockets.cpp index 9bbaede531..73e830750e 100644 --- a/native/cocos/network/WebSocket-libwebsockets.cpp +++ b/native/cocos/network/WebSocket-libwebsockets.cpp @@ -50,11 +50,11 @@ #include #include // for std::shared_ptr #include -#include "base/std/container/string.h" #include #include "application/ApplicationManager.h" #include "base/Scheduler.h" #include "base/std/container/queue.h" +#include "base/std/container/string.h" #include "network/Uri.h" #include "network/WebSocket.h" @@ -208,9 +208,9 @@ public: ~WebSocketImpl(); bool init(const cc::network::WebSocket::Delegate &delegate, - const ccstd::string & url, - const ccstd::vector * protocols = nullptr, - const ccstd::string & caFilePath = ""); + const ccstd::string & url, + const ccstd::vector * protocols = nullptr, + const ccstd::string & caFilePath = ""); void send(const ccstd::string &message); void send(const unsigned char *binaryMsg, unsigned int len); @@ -218,11 +218,11 @@ public: void closeAsync(); void closeAsync(int code, const ccstd::string &reason); cc::network::WebSocket::State getReadyState() const; - const ccstd::string & getUrl() const; - const ccstd::string & getProtocol() const; + const ccstd::string & getUrl() const; + const ccstd::string & getProtocol() const; cc::network::WebSocket::Delegate *getDelegate() const; - size_t getBufferedAmount() const; + size_t getBufferedAmount() const; ccstd::string getExtensions() const; private: @@ -241,13 +241,13 @@ private: cc::network::WebSocket * _ws; cc::network::WebSocket::State _readyState; std::mutex _readyStateMutex; - ccstd::string _url; + ccstd::string _url; ccstd::vector _receivedData; struct lws * _wsInstance; struct lws_protocols *_lwsProtocols; - ccstd::string _clientSupportedProtocols; - ccstd::string _selectedProtocol; + ccstd::string _clientSupportedProtocols; + ccstd::string _selectedProtocol; std::shared_ptr> _isDestroyed; cc::network::WebSocket::Delegate * _delegate; @@ -287,8 +287,8 @@ static std::atomic_bool wsPolling{false}; #if (CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_OHOS) static ccstd::string getFileNameForPath(const ccstd::string &filePath) { - ccstd::string fileName = filePath; - const size_t lastSlashIdx = fileName.find_last_of("\\/"); + ccstd::string fileName = filePath; + const size_t lastSlashIdx = fileName.find_last_of("\\/"); if (ccstd::string::npos != lastSlashIdx) { fileName.erase(0, lastSlashIdx + 1); } @@ -659,9 +659,9 @@ WebSocketImpl::~WebSocketImpl() { } bool WebSocketImpl::init(const cc::network::WebSocket::Delegate &delegate, - const ccstd::string & url, - const ccstd::vector * protocols /* = nullptr*/, - const ccstd::string & caFilePath /* = ""*/) { + const ccstd::string & url, + const ccstd::vector * protocols /* = nullptr*/, + const ccstd::string & caFilePath /* = ""*/) { _delegate = const_cast(&delegate); _url = url; _caFilePath = caFilePath; @@ -1352,7 +1352,7 @@ WebSocket::~WebSocket() { delete _impl; } -bool WebSocket::init(const Delegate & delegate, +bool WebSocket::init(const Delegate & delegate, const ccstd::string & url, const ccstd::vector *protocols /* = nullptr*/, const ccstd::string & caFilePath /* = ""*/) { diff --git a/native/cocos/network/WebSocket.h b/native/cocos/network/WebSocket.h index b2e1042fc2..af87c519cd 100644 --- a/native/cocos/network/WebSocket.h +++ b/native/cocos/network/WebSocket.h @@ -166,7 +166,7 @@ public: * @return true: Success, false: Failure. * @lua NA */ - bool init(const Delegate & delegate, + bool init(const Delegate & delegate, const ccstd::string & url, const ccstd::vector *protocols = nullptr, const ccstd::string & caFilePath = ""); diff --git a/native/cocos/network/WebSocketServer.cpp b/native/cocos/network/WebSocketServer.cpp index 09b641dcf4..2dc349c521 100644 --- a/native/cocos/network/WebSocketServer.cpp +++ b/native/cocos/network/WebSocketServer.cpp @@ -106,7 +106,7 @@ namespace network { #define DISPATCH_CALLBACK_IN_GAMETHREAD() \ do { \ - data->setCallback([callback](const ccstd::string &msg) { \ + data->setCallback([callback](const ccstd::string &msg) { \ auto wrapper = [callback, msg]() { callback(msg); }; \ RUN_IN_GAMETHREAD(wrapper()); \ }); \ diff --git a/native/cocos/network/WebSocketServer.h b/native/cocos/network/WebSocketServer.h index b847305ee4..7ec88870a8 100644 --- a/native/cocos/network/WebSocketServer.h +++ b/native/cocos/network/WebSocketServer.h @@ -39,8 +39,8 @@ #include #include #include - #include "base/std/container/string.h" #include + #include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #if CC_PLATFORM == CC_PLATFORM_OHOS @@ -97,9 +97,9 @@ public: unsigned char *getData() { return _underlyingData.data() + LWS_PRE; } private: - ccstd::vector _underlyingData; - int _consumed = 0; - bool _isBinary = false; + ccstd::vector _underlyingData; + int _consumed = 0; + bool _isBinary = false; std::function _callback; }; @@ -190,18 +190,18 @@ private: void onDestroyClient(); - struct lws * _wsi = nullptr; - ccstd::map _headers; - std::list> _sendQueue; - std::shared_ptr _prevPkg; - bool _closed = false; - ccstd::string _closeReason = "close connection"; - int _closeCode = 1000; - std::atomic _readyState{ReadyState::CLOSED}; + struct lws * _wsi = nullptr; + ccstd::map _headers; + std::list> _sendQueue; + std::shared_ptr _prevPkg; + bool _closed = false; + ccstd::string _closeReason = "close connection"; + int _closeCode = 1000; + std::atomic _readyState{ReadyState::CLOSED}; // Attention: do not reference **this** in callbacks - std::function _onclose; - std::function _onerror; + std::function _onclose; + std::function _onerror; std::function)> _ontext; std::function)> _onbinary; std::function)> _ondata; @@ -266,18 +266,18 @@ private: std::shared_ptr findConnection(struct lws *wsi); void destroyContext(); - ccstd::string _host; - lws_context *_ctx = nullptr; - uv_async_t _async = {0}; + ccstd::string _host; + lws_context * _ctx = nullptr; + uv_async_t _async = {0}; mutable std::mutex _connsMtx; ccstd::unordered_map> _conns; // Attention: do not reference **this** in callbacks - std::function _onlistening; - std::function _onerror; - std::function _onclose; - std::function _onclose_cb; + std::function _onlistening; + std::function _onerror; + std::function _onclose; + std::function _onclose_cb; std::function _onend; std::function _onbegin; std::function)> _onconnection; diff --git a/native/cocos/platform/FileUtils.cpp b/native/cocos/platform/FileUtils.cpp index 33d5b6eaf4..1c036f324d 100644 --- a/native/cocos/platform/FileUtils.cpp +++ b/native/cocos/platform/FileUtils.cpp @@ -78,7 +78,7 @@ public: ccstd::string _curKey; ///< parsed key ccstd::string _curValue; // parsed value - SAXState _state{SAX_NONE}; + SAXState _state{SAX_NONE}; ValueMap * _curDict; ValueVector *_curArray; @@ -193,7 +193,7 @@ public: void endElement(void *ctx, const char *name) override { CC_UNUSED_PARAM(ctx); - SAXState curState = _stateStack.empty() ? SAX_DICT : _stateStack.top(); + SAXState curState = _stateStack.empty() ? SAX_DICT : _stateStack.top(); const ccstd::string sName(const_cast(name)); if (sName == "dict") { _stateStack.pop(); @@ -250,7 +250,7 @@ public: return; } - SAXState curState = _stateStack.empty() ? SAX_DICT : _stateStack.top(); + SAXState curState = _stateStack.empty() ? SAX_DICT : _stateStack.top(); const ccstd::string text = ccstd::string(const_cast(ch), len); switch (_state) { @@ -290,7 +290,7 @@ ValueMap FileUtils::getValueMapFromData(const char *filedata, int filesize) { ValueVector FileUtils::getValueVectorFromFile(const ccstd::string &filename) { const ccstd::string fullPath = fullPathForFilename(filename); - DictMaker tMaker; + DictMaker tMaker; return tMaker.arrayWithContentsOfFile(fullPath); } @@ -628,7 +628,7 @@ unsigned char *FileUtils::getFileDataFromZip(const ccstd::string &zipFilePath, c ccstd::string FileUtils::getPathForFilename(const ccstd::string &filename, const ccstd::string &searchPath) const { ccstd::string file{filename}; ccstd::string filePath; - size_t pos = filename.find_last_of('/'); + size_t pos = filename.find_last_of('/'); if (pos != ccstd::string::npos) { filePath = filename.substr(0, pos + 1); file = filename.substr(pos + 1); @@ -981,8 +981,8 @@ bool FileUtils::createDirectory(const ccstd::string &path) { } // Split the path - size_t start = 0; - size_t found = path.find_first_of("/\\", start); + size_t start = 0; + size_t found = path.find_first_of("/\\", start); ccstd::string subpath; ccstd::vector dirs; @@ -1115,7 +1115,7 @@ long FileUtils::getFileSize(const ccstd::string &filepath) { //NOLINT(google-run ccstd::string FileUtils::getFileExtension(const ccstd::string &filePath) const { ccstd::string fileExtension; - size_t pos = filePath.find_last_of('.'); + size_t pos = filePath.find_last_of('.'); if (pos != ccstd::string::npos) { fileExtension = filePath.substr(pos, filePath.length()); @@ -1133,7 +1133,7 @@ void FileUtils::valueVectorCompact(ValueVector &valueVector) { ccstd::string FileUtils::getFileDir(const ccstd::string &path) { ccstd::string ret; - size_t pos = path.rfind('/'); + size_t pos = path.rfind('/'); if (pos != ccstd::string::npos) { ret = path.substr(0, pos); } diff --git a/native/cocos/platform/FileUtils.h b/native/cocos/platform/FileUtils.h index 5cd233ab73..13cc68f592 100644 --- a/native/cocos/platform/FileUtils.h +++ b/native/cocos/platform/FileUtils.h @@ -25,11 +25,11 @@ #pragma once -#include "base/std/container/string.h" #include #include "base/Data.h" #include "base/Macros.h" #include "base/Value.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" diff --git a/native/cocos/platform/Image.cpp b/native/cocos/platform/Image.cpp index 29e32df9be..43db749390 100644 --- a/native/cocos/platform/Image.cpp +++ b/native/cocos/platform/Image.cpp @@ -29,8 +29,8 @@ #include #include #include -#include "base/std/container/string.h" #include "base/Config.h" // CC_USE_JPEG, CC_USE_WEBP +#include "base/std/container/string.h" #if CC_USE_JPEG #include "jpeg/jpeglib.h" diff --git a/native/cocos/platform/Image.h b/native/cocos/platform/Image.h index 7b5b27c756..cbefb01ad7 100644 --- a/native/cocos/platform/Image.h +++ b/native/cocos/platform/Image.h @@ -27,8 +27,8 @@ #pragma once -#include "base/std/container/string.h" #include "base/RefCounted.h" +#include "base/std/container/string.h" #include "gfx-base/GFXDef.h" namespace cc { @@ -79,7 +79,7 @@ public: inline gfx::Format getRenderFormat() const { return _renderFormat; } inline int getWidth() const { return _width; } inline int getHeight() const { return _height; } - inline ccstd::string getFilePath() const { return _filePath; } + inline ccstd::string getFilePath() const { return _filePath; } inline bool isCompressed() const { return _isCompressed; } @@ -100,7 +100,7 @@ protected: int _height = 0; Format _fileType = Format::UNKNOWN; gfx::Format _renderFormat; - ccstd::string _filePath; + ccstd::string _filePath; bool _isCompressed = false; static Format detectFormat(const unsigned char *data, ssize_t dataLen); diff --git a/native/cocos/platform/SAXParser.h b/native/cocos/platform/SAXParser.h index 66f745b5e4..3c57cb2e9b 100644 --- a/native/cocos/platform/SAXParser.h +++ b/native/cocos/platform/SAXParser.h @@ -30,8 +30,8 @@ #define __CCSAXPARSER_H__ /// @cond DO_NOT_SHOW -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" namespace cc { diff --git a/native/cocos/platform/android/FileUtils-android.cpp b/native/cocos/platform/android/FileUtils-android.cpp index 943b9bd695..7ff43beb66 100644 --- a/native/cocos/platform/android/FileUtils-android.cpp +++ b/native/cocos/platform/android/FileUtils-android.cpp @@ -186,7 +186,7 @@ FileUtils::Status FileUtilsAndroid::getContents(const ccstd::string &filename, R } ccstd::string relativePath; - size_t position = fullPath.find(ASSETS_FOLDER_NAME); + size_t position = fullPath.find(ASSETS_FOLDER_NAME); if (0 == position) { // "@assets/" is at the beginning of the path and we don't want it relativePath += fullPath.substr(strlen(ASSETS_FOLDER_NAME)); diff --git a/native/cocos/platform/android/FileUtils-android.h b/native/cocos/platform/android/FileUtils-android.h index a4ab0a547d..3b93663422 100644 --- a/native/cocos/platform/android/FileUtils-android.h +++ b/native/cocos/platform/android/FileUtils-android.h @@ -27,9 +27,9 @@ #pragma once -#include "base/std/container/string.h" #include "android/asset_manager.h" #include "base/Macros.h" +#include "base/std/container/string.h" #include "jni.h" #include "platform/FileUtils.h" @@ -63,7 +63,7 @@ public: FileUtils::Status getContents(const ccstd::string &filename, ResizableBuffer *buffer) override; ccstd::string getWritablePath() const override; - bool isAbsolutePath(const ccstd::string &strPath) const override; + bool isAbsolutePath(const ccstd::string &strPath) const override; private: bool isFileExistInternal(const ccstd::string &strFilePath) const override; diff --git a/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.cpp b/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.cpp index d61c3c647e..2a64f0fedc 100644 --- a/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.cpp +++ b/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.cpp @@ -84,10 +84,10 @@ CanvasRenderingContext2DDelegate::Size CanvasRenderingContext2DDelegate::measure } void CanvasRenderingContext2DDelegate::updateFont(const ccstd::string &fontName, - float fontSize, - bool bold, - bool italic, - bool oblique, + float fontSize, + bool bold, + bool italic, + bool oblique, bool /* smallCaps */) { } diff --git a/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h index 5c1bb90399..3f223edfeb 100644 --- a/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h @@ -81,14 +81,14 @@ private: int32_t _lineCap{0}; int32_t _lineJoin{0}; - cc::Data _imageData; + cc::Data _imageData; ccstd::string _curFontPath; - int _savedDC{0}; - float _lineWidth{0.0F}; - float _bufferWidth{0.0F}; - float _bufferHeight{0.0F}; + int _savedDC{0}; + float _lineWidth{0.0F}; + float _bufferWidth{0.0F}; + float _bufferHeight{0.0F}; - ccstd::string _fontName; + ccstd::string _fontName; int _fontSize{0}; Size _textSize; CanvasTextAlign _textAlign{CanvasTextAlign::CENTER}; diff --git a/native/cocos/platform/interfaces/modules/ISystem.cpp b/native/cocos/platform/interfaces/modules/ISystem.cpp index 3ed7e306d9..e44d14d677 100644 --- a/native/cocos/platform/interfaces/modules/ISystem.cpp +++ b/native/cocos/platform/interfaces/modules/ISystem.cpp @@ -49,8 +49,8 @@ ISystem::Ptr ISystem::createSystemInterface() { } ccstd::string ISystem::getCurrentLanguageToString() { - LanguageType language = getCurrentLanguage(); - ccstd::string languageStr = ""; // NOLINT + LanguageType language = getCurrentLanguage(); + ccstd::string languageStr = ""; // NOLINT switch (language) { case ISystem::LanguageType::ENGLISH: languageStr = "en"; diff --git a/native/cocos/platform/interfaces/modules/ISystem.h b/native/cocos/platform/interfaces/modules/ISystem.h index 8f6166f30d..7c584409f5 100644 --- a/native/cocos/platform/interfaces/modules/ISystem.h +++ b/native/cocos/platform/interfaces/modules/ISystem.h @@ -71,10 +71,10 @@ public: virtual OSType getOSType() const = 0; // - virtual ccstd::string getDeviceModel() const = 0; - virtual LanguageType getCurrentLanguage() const = 0; - virtual ccstd::string getCurrentLanguageCode() const = 0; - virtual ccstd::string getSystemVersion() const = 0; + virtual ccstd::string getDeviceModel() const = 0; + virtual LanguageType getCurrentLanguage() const = 0; + virtual ccstd::string getCurrentLanguageCode() const = 0; + virtual ccstd::string getSystemVersion() const = 0; virtual ccstd::string getCurrentLanguageToString(); diff --git a/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.cpp b/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.cpp index 9c00cccb9e..b0704277a9 100644 --- a/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.cpp +++ b/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.cpp @@ -240,7 +240,7 @@ void CanvasRenderingContext2D::setFont(const ccstd::string &font) { ccstd::string fontSizeStr = "30"; // support get font name from `60px American` or `60px "American abc-abc_abc"` - std::regex re("(bold)?\\s*((\\d+)([\\.]\\d+)?)px\\s+([\\w-]+|\"[\\w -]+\"$)"); + std::regex re("(bold)?\\s*((\\d+)([\\.]\\d+)?)px\\s+([\\w-]+|\"[\\w -]+\"$)"); std::match_results results; if (std::regex_search(_font.cbegin(), _font.cend(), results, re)) { boldStr = results[1].str(); @@ -261,7 +261,7 @@ void CanvasRenderingContext2D::setFont(const ccstd::string &font) { ccstd::string fontSizeStr = "30"; // support get font name from `60px American` or `60px "American abc-abc_abc"` - std::regex re("(bold)?\\s*((\\d+)([\\.]\\d+)?)px\\s+([\\w-]+|\"[\\w -]+\"$)"); + std::regex re("(bold)?\\s*((\\d+)([\\.]\\d+)?)px\\s+([\\w-]+|\"[\\w -]+\"$)"); std::match_results results; if (std::regex_search(_font.cbegin(), _font.cend(), results, re)) { boldStr = results[1].str(); @@ -279,7 +279,7 @@ void CanvasRenderingContext2D::setFont(const ccstd::string &font) { ccstd::string fontName = "sans-serif"; ccstd::string fontSizeStr = "30"; - std::regex re(R"(\s*((\d+)([\.]\d+)?)px\s+([^\r\n]*))"); + std::regex re(R"(\s*((\d+)([\.]\d+)?)px\s+([^\r\n]*))"); std::match_results results; if (std::regex_search(_font.cbegin(), _font.cend(), results, re)) { fontSizeStr = results[2].str(); @@ -287,7 +287,7 @@ void CanvasRenderingContext2D::setFont(const ccstd::string &font) { // support get font name contain space,example `times new roman` // if regex rule that does not conform to the rules,such as Chinese,it defaults to sans-serif std::match_results fontResults; - std::regex fontRe(R"(([\w\s-]+|"[\w\s-]+"$))"); + std::regex fontRe(R"(([\w\s-]+|"[\w\s-]+"$))"); ccstd::string tmp(results[4].str()); if (std::regex_match(tmp, fontResults, fontRe)) { //fontName = results[4].str(); @@ -302,10 +302,10 @@ void CanvasRenderingContext2D::setFont(const ccstd::string &font) { } #elif CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_OHOS if (_font != font) { - _font = font; + _font = font; ccstd::string fontName = "sans-serif"; ccstd::string fontSizeStr = "30"; - std::regex re(R"(\s*((\d+)([\.]\d+)?)px\s+([^\r\n]*))"); + std::regex re(R"(\s*((\d+)([\.]\d+)?)px\s+([^\r\n]*))"); std::match_results results; if (std::regex_search(_font.cbegin(), _font.cend(), results, re)) { fontSizeStr = results[2].str(); @@ -313,7 +313,7 @@ void CanvasRenderingContext2D::setFont(const ccstd::string &font) { // support get font name contain space,example `times new roman` // if regex rule that does not conform to the rules,such as Chinese,it defaults to sans-serif std::match_results fontResults; - std::regex fontRe(R"(([\w\s-]+|"[\w\s-]+"$))"); + std::regex fontRe(R"(([\w\s-]+|"[\w\s-]+"$))"); ccstd::string tmp(results[4].str()); if (std::regex_match(tmp, fontResults, fontRe)) { fontName = results[4].str(); @@ -339,7 +339,7 @@ void CanvasRenderingContext2D::setFont(const ccstd::string &font) { ccstd::string fontSizeStr = "30"; // support get font name from `60px American` or `60px "American abc-abc_abc"` - std::regex re("(bold)?\\s*((\\d+)([\\.]\\d+)?)px\\s+([\\w-]+|\"[\\w -]+\"$)"); + std::regex re("(bold)?\\s*((\\d+)([\\.]\\d+)?)px\\s+([\\w-]+|\"[\\w -]+\"$)"); std::match_results results; if (std::regex_search(_font.cbegin(), _font.cend(), results, re)) { boldStr = results[1].str(); diff --git a/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.h b/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.h index fd7ddda0c1..187711c933 100644 --- a/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.h +++ b/native/cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.h @@ -97,7 +97,7 @@ public: float _height = 0.0F; // Line styles - float _lineWidth = 1.0F; + float _lineWidth = 1.0F; ccstd::string _lineJoin = "miter"; ccstd::string _lineCap = "butt"; diff --git a/native/cocos/platform/interfaces/modules/canvas/ICanvasRenderingContext2D.h b/native/cocos/platform/interfaces/modules/canvas/ICanvasRenderingContext2D.h index ef7755a531..daa243b254 100644 --- a/native/cocos/platform/interfaces/modules/canvas/ICanvasRenderingContext2D.h +++ b/native/cocos/platform/interfaces/modules/canvas/ICanvasRenderingContext2D.h @@ -56,8 +56,8 @@ namespace cc { class ICanvasGradient { public: - ICanvasGradient() = default; - virtual ~ICanvasGradient() = default; // NOLINT(performance-trivially-destructible) + ICanvasGradient() = default; + virtual ~ICanvasGradient() = default; // NOLINT(performance-trivially-destructible) virtual void addColorStop(float offset, const ccstd::string &color) = 0; }; @@ -65,34 +65,34 @@ class ICanvasRenderingContext2D : public OSInterface { public: class Delegate { public: - using Size = std::array; - virtual ~Delegate() = default; - virtual void recreateBuffer(float w, float h) = 0; - virtual void beginPath() = 0; - virtual void closePath() = 0; - virtual void moveTo(float x, float y) = 0; - virtual void lineTo(float x, float y) = 0; - virtual void stroke() = 0; - virtual void saveContext() = 0; - virtual void restoreContext() = 0; - virtual void clearRect(float /*x*/, float /*y*/, float w, float h) = 0; - virtual void fill() = 0; - virtual void rect(float x, float y, float w, float h) = 0; + using Size = std::array; + virtual ~Delegate() = default; + virtual void recreateBuffer(float w, float h) = 0; + virtual void beginPath() = 0; + virtual void closePath() = 0; + virtual void moveTo(float x, float y) = 0; + virtual void lineTo(float x, float y) = 0; + virtual void stroke() = 0; + virtual void saveContext() = 0; + virtual void restoreContext() = 0; + virtual void clearRect(float /*x*/, float /*y*/, float w, float h) = 0; + virtual void fill() = 0; + virtual void rect(float x, float y, float w, float h) = 0; virtual void setLineCap(const ccstd::string &lineCap) = 0; virtual void setLineJoin(const ccstd::string &lineCap) = 0; - virtual void fillImageData(const Data &imageData, float imageWidth, float imageHeight, float offsetX, float offsetY) = 0; - virtual void fillRect(float x, float y, float w, float h) = 0; + virtual void fillImageData(const Data &imageData, float imageWidth, float imageHeight, float offsetX, float offsetY) = 0; + virtual void fillRect(float x, float y, float w, float h) = 0; virtual void fillText(const ccstd::string &text, float x, float y, float /*maxWidth*/) = 0; virtual void strokeText(const ccstd::string &text, float /*x*/, float /*y*/, float /*maxWidth*/) = 0; virtual Size measureText(const ccstd::string &text) = 0; virtual void updateFont(const ccstd::string &fontName, float fontSize, bool bold, bool italic, bool oblique, bool smallCaps) = 0; - virtual void setTextAlign(CanvasTextAlign align) = 0; - virtual void setTextBaseline(CanvasTextBaseline baseline) = 0; - virtual void setFillStyle(float r, float g, float b, float a) = 0; - virtual void setStrokeStyle(float r, float g, float b, float a) = 0; - virtual void setLineWidth(float lineWidth) = 0; - virtual const cc::Data &getDataRef() const = 0; - virtual void updateData() = 0; + virtual void setTextAlign(CanvasTextAlign align) = 0; + virtual void setTextBaseline(CanvasTextBaseline baseline) = 0; + virtual void setFillStyle(float r, float g, float b, float a) = 0; + virtual void setStrokeStyle(float r, float g, float b, float a) = 0; + virtual void setLineWidth(float lineWidth) = 0; + virtual const cc::Data &getDataRef() const = 0; + virtual void updateData() = 0; }; //static OSInterface::Ptr getInterface(); // Rect @@ -103,8 +103,8 @@ public: virtual void fillText(const ccstd::string &text, float x, float y, float maxWidth) = 0; virtual void strokeText(const ccstd::string &text, float x, float y, float maxWidth) = 0; virtual Size measureText(const ccstd::string &text) = 0; - virtual ICanvasGradient *createLinearGradient(float x0, float y0, float x1, float y1) = 0; - virtual void save() = 0; + virtual ICanvasGradient *createLinearGradient(float x0, float y0, float x1, float y1) = 0; + virtual void save() = 0; // Paths virtual void beginPath() = 0; virtual void closePath() = 0; @@ -119,9 +119,9 @@ public: virtual void setCanvasBufferUpdatedCallback(const CanvasBufferUpdatedCallback &cb) = 0; // functions for properties - virtual void setWidth(float width) = 0; - virtual void setHeight(float height) = 0; - virtual void setLineWidth(float lineWidth) = 0; + virtual void setWidth(float width) = 0; + virtual void setHeight(float height) = 0; + virtual void setLineWidth(float lineWidth) = 0; virtual void setLineJoin(const ccstd::string &lineJoin) = 0; virtual void setLineCap(const ccstd::string &lineCap) = 0; virtual void setFont(const ccstd::string &font) = 0; diff --git a/native/cocos/platform/java/jni/JniHelper.h b/native/cocos/platform/java/jni/JniHelper.h index db06d71a24..99eb2127c1 100644 --- a/native/cocos/platform/java/jni/JniHelper.h +++ b/native/cocos/platform/java/jni/JniHelper.h @@ -29,9 +29,9 @@ #include #include -#include "base/std/container/string.h" #include "base/Log.h" #include "base/Macros.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" #include "math/Vec3.h" @@ -100,7 +100,7 @@ public: jobject ret = nullptr; static const char *methodName = ""; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")V"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")V"; if (cc::JniHelper::getMethodInfo(t, className.c_str(), methodName, signature.c_str())) { LocalRefMapType localRefs; ret = t.env->NewObject(t.classID, t.methodID, convert(&localRefs, &t, xs)...); @@ -115,12 +115,12 @@ public: } template - static void callObjectVoidMethod(jobject object, + static void callObjectVoidMethod(jobject object, const ccstd::string &className, const ccstd::string &methodName, Ts... xs) { cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")V"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")V"; if (cc::JniHelper::getMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; t.env->CallVoidMethod(object, t.methodID, convert(&localRefs, &t, xs)...); @@ -135,13 +135,13 @@ public: } template - static float callObjectFloatMethod(jobject object, + static float callObjectFloatMethod(jobject object, const ccstd::string &className, const ccstd::string &methodName, Ts... xs) { float ret = 0.0F; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")F"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")F"; if (cc::JniHelper::getMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; ret = t.env->CallFloatMethod(object, t.methodID, convert(&localRefs, &t, xs)...); @@ -157,13 +157,13 @@ public: } template - static jbyteArray callObjectByteArrayMethod(jobject object, + static jbyteArray callObjectByteArrayMethod(jobject object, const ccstd::string &className, const ccstd::string &methodName, Ts... xs) { jbyteArray ret = nullptr; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")[B"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")[B"; if (cc::JniHelper::getMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; ret = static_cast(t.env->CallObjectMethod(object, t.methodID, convert(&localRefs, &t, xs)...)); @@ -183,7 +183,7 @@ public: const ccstd::string &methodName, Ts... xs) { cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")V"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")V"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; t.env->CallStaticVoidMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...); @@ -203,7 +203,7 @@ public: Ts... xs) { jboolean jret = JNI_FALSE; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")Z"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")Z"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; jret = t.env->CallStaticBooleanMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...); @@ -224,7 +224,7 @@ public: Ts... xs) { jint ret = 0; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")I"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")I"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; ret = t.env->CallStaticIntMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...); @@ -245,7 +245,7 @@ public: Ts... xs) { jfloat ret = 0.0; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")F"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")F"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; ret = t.env->CallStaticFloatMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...); @@ -266,7 +266,7 @@ public: Ts... xs) { static float ret[32]; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")[F"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")[F"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; auto * array = static_cast(t.env->CallStaticObjectMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...)); @@ -297,7 +297,7 @@ public: Ts... xs) { Vec3 ret; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")[F"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")[F"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; auto * array = static_cast(t.env->CallStaticObjectMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...)); @@ -328,7 +328,7 @@ public: Ts... xs) { jdouble ret = 0.0; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")D"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")D"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; ret = t.env->CallStaticDoubleMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...); @@ -345,12 +345,12 @@ public: template static ccstd::string callStaticStringMethod(const ccstd::string &className, - const ccstd::string &methodName, - Ts... xs) { + const ccstd::string &methodName, + Ts... xs) { ccstd::string ret; cc::JniMethodInfo t; - ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")Ljava/lang/String;"; + ccstd::string signature = "(" + ccstd::string(getJNISignature(xs...)) + ")Ljava/lang/String;"; if (cc::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { LocalRefMapType localRefs; auto * jret = static_cast(t.env->CallStaticObjectMethod(t.classID, t.methodID, convert(&localRefs, &t, xs)...)); diff --git a/native/cocos/platform/java/jni/JniImp.cpp b/native/cocos/platform/java/jni/JniImp.cpp index a673707d67..607e57a752 100644 --- a/native/cocos/platform/java/jni/JniImp.cpp +++ b/native/cocos/platform/java/jni/JniImp.cpp @@ -44,9 +44,9 @@ #endif #ifndef COM_AUDIOFOCUS_CLASS_NAME -#define COM_AUDIOFOCUS_CLASS_NAME com_cocos_lib_CocosAudioFocusManager + #define COM_AUDIOFOCUS_CLASS_NAME com_cocos_lib_CocosAudioFocusManager #endif -#define JNI_AUDIO(FUNC) JNI_METHOD1(COM_AUDIOFOCUS_CLASS_NAME,FUNC) +#define JNI_AUDIO(FUNC) JNI_METHOD1(COM_AUDIOFOCUS_CLASS_NAME, FUNC) using namespace cc; //NOLINT @@ -153,10 +153,8 @@ float *getDeviceMotionValueJNI() { return JniHelper::callStaticFloatArrayMethod(JCLS_SENSOR, "getDeviceMotionValue"); } - extern "C" { -JNIEXPORT void JNICALL JNI_AUDIO(nativeSetAudioVolumeFactor)(JNIEnv* /*env*/, jclass/* thiz*/, jfloat volumeFactor) -{ +JNIEXPORT void JNICALL JNI_AUDIO(nativeSetAudioVolumeFactor)(JNIEnv * /*env*/, jclass /* thiz*/, jfloat volumeFactor) { AudioEngine::setVolumeFactor(volumeFactor); } } diff --git a/native/cocos/platform/java/jni/JniImp.h b/native/cocos/platform/java/jni/JniImp.h index 30b640892c..9a7b71b904 100644 --- a/native/cocos/platform/java/jni/JniImp.h +++ b/native/cocos/platform/java/jni/JniImp.h @@ -28,21 +28,21 @@ #include "base/std/container/string.h" extern ccstd::string getObbFilePathJNI(); -extern int getObbAssetFileDescriptorJNI(const ccstd::string &path, int64_t *startOffset, int64_t *size); +extern int getObbAssetFileDescriptorJNI(const ccstd::string &path, int64_t *startOffset, int64_t *size); extern ccstd::string getCurrentLanguageJNI(); extern ccstd::string getCurrentLanguageCodeJNI(); extern ccstd::string getSystemVersionJNI(); -extern bool openURLJNI(const ccstd::string &url); -extern void copyTextToClipboardJNI(const ccstd::string &text); +extern bool openURLJNI(const ccstd::string &url); +extern void copyTextToClipboardJNI(const ccstd::string &text); extern ccstd::string getDeviceModelJNI(); -extern int getDPIJNI(); -extern void setVibrateJNI(float duration); -extern int getNetworkTypeJNI(); -extern float * getSafeAreaEdgeJNI(); -extern int getDeviceRotationJNI(); -extern float getBatteryLevelJNI(); -extern void flushTasksOnGameThreadJNI(); -extern void flushTasksOnGameThreadAtForegroundJNI(); -extern void setAccelerometerEnabledJNI(bool isEnabled); -extern void setAccelerometerIntervalJNI(float interval); -extern float * getDeviceMotionValueJNI(); \ No newline at end of file +extern int getDPIJNI(); +extern void setVibrateJNI(float duration); +extern int getNetworkTypeJNI(); +extern float * getSafeAreaEdgeJNI(); +extern int getDeviceRotationJNI(); +extern float getBatteryLevelJNI(); +extern void flushTasksOnGameThreadJNI(); +extern void flushTasksOnGameThreadAtForegroundJNI(); +extern void setAccelerometerEnabledJNI(bool isEnabled); +extern void setAccelerometerIntervalJNI(float interval); +extern float * getDeviceMotionValueJNI(); \ No newline at end of file diff --git a/native/cocos/platform/java/jni/glue/JniNativeGlue.h b/native/cocos/platform/java/jni/glue/JniNativeGlue.h index a2bcdd498a..514dd4c451 100644 --- a/native/cocos/platform/java/jni/glue/JniNativeGlue.h +++ b/native/cocos/platform/java/jni/glue/JniNativeGlue.h @@ -27,8 +27,8 @@ #include #include -#include "platform/java/jni/glue/MessagePipe.h" #include "base/std/container/string.h" +#include "platform/java/jni/glue/MessagePipe.h" #if (CC_PLATFORM == CC_PLATFORM_ANDROID) #include @@ -75,7 +75,7 @@ public: void setSdkVersion(int sdkVersion); int getSdkVersion() const; - void setObbPath(const ccstd::string &path); + void setObbPath(const ccstd::string &path); ccstd::string getObbPath() const; bool isRunning() const; @@ -118,7 +118,7 @@ private: bool _animating{false}; std::promise _threadPromise; - ccstd::string _obbPath; + ccstd::string _obbPath; ResourceManagerType * _resourceManager{nullptr}; NativeWindowType * _window{nullptr}; NativeWindowType * _pendingWindow{nullptr}; diff --git a/native/cocos/platform/java/modules/CommonSystem.cpp b/native/cocos/platform/java/modules/CommonSystem.cpp index f4b9ce7d17..aa69713b25 100644 --- a/native/cocos/platform/java/modules/CommonSystem.cpp +++ b/native/cocos/platform/java/modules/CommonSystem.cpp @@ -36,9 +36,9 @@ ccstd::string CommonSystem::getDeviceModel() const { } CommonSystem::LanguageType CommonSystem::getCurrentLanguage() const { - ccstd::string languageName = getCurrentLanguageJNI(); - const char * pLanguageName = languageName.c_str(); - LanguageType ret = LanguageType::ENGLISH; + ccstd::string languageName = getCurrentLanguageJNI(); + const char * pLanguageName = languageName.c_str(); + LanguageType ret = LanguageType::ENGLISH; if (0 == strcmp("zh", pLanguageName)) { ret = LanguageType::CHINESE; diff --git a/native/cocos/platform/linux/FileUtils-linux.cpp b/native/cocos/platform/linux/FileUtils-linux.cpp index d4cea130ea..35c098f343 100644 --- a/native/cocos/platform/linux/FileUtils-linux.cpp +++ b/native/cocos/platform/linux/FileUtils-linux.cpp @@ -58,13 +58,13 @@ bool FileUtilsLinux::init() { return false; } - fullpath[length] = '\0'; + fullpath[length] = '\0'; ccstd::string appPath = fullpath; - _defaultResRootPath = appPath.substr(0, appPath.find_last_of('/')); + _defaultResRootPath = appPath.substr(0, appPath.find_last_of('/')); _defaultResRootPath.append(CC_RESOURCE_FOLDER_LINUX); // Set writable path to $XDG_CONFIG_HOME or ~/.config// if $XDG_CONFIG_HOME not exists. - const char *xdg_config_path = getenv("XDG_CONFIG_HOME"); + const char * xdg_config_path = getenv("XDG_CONFIG_HOME"); ccstd::string xdgConfigPath; if (xdg_config_path == nullptr) { xdgConfigPath = getenv("HOME"); diff --git a/native/cocos/platform/linux/FileUtils-linux.h b/native/cocos/platform/linux/FileUtils-linux.h index f00c06ad1e..600cbbb528 100644 --- a/native/cocos/platform/linux/FileUtils-linux.h +++ b/native/cocos/platform/linux/FileUtils-linux.h @@ -30,9 +30,9 @@ namespace cc { class FileUtilsLinux : public FileUtils { public: friend class FileUtils; - bool isFileExistInternal(const ccstd::string &filename) const override; + bool isFileExistInternal(const ccstd::string &filename) const override; ccstd::string getWritablePath() const override; - bool init() override; + bool init() override; private: ccstd::string _writablePath; diff --git a/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.cpp b/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.cpp index 1c5c844c42..c9c2b46f81 100644 --- a/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.cpp +++ b/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.cpp @@ -165,17 +165,17 @@ CanvasRenderingContext2DDelegate::Size CanvasRenderingContext2DDelegate::measure } void CanvasRenderingContext2DDelegate::updateFont(const ccstd::string &fontName, - float fontSize, - bool bold, - bool italic, - bool oblique, + float fontSize, + bool bold, + bool italic, + bool oblique, bool /* smallCaps */) { do { _fontName = fontName; _fontSize = static_cast(fontSize); /// TODO(bug):Remove default settings ccstd::string fontName = "helvetica"; // default - char serv[1024] = {0}; + char serv[1024] = {0}; ccstd::string slant = ""; if (italic) { slant = "*I"; diff --git a/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h index c92e8c85b8..e9eb4f40e7 100644 --- a/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h @@ -104,14 +104,14 @@ private: int32_t _lineJoin{0}; private: - cc::Data _imageData; + cc::Data _imageData; ccstd::string _curFontPath; - int _savedDC{0}; - float _lineWidth{0.0F}; - float _bufferWidth{0.0F}; - float _bufferHeight{0.0F}; + int _savedDC{0}; + float _lineWidth{0.0F}; + float _bufferWidth{0.0F}; + float _bufferHeight{0.0F}; - ccstd::string _fontName; + ccstd::string _fontName; int _fontSize{0}; Size _textSize; CanvasTextAlign _textAlign{CanvasTextAlign::CENTER}; diff --git a/native/cocos/platform/ohos/FileUtils-ohos.cpp b/native/cocos/platform/ohos/FileUtils-ohos.cpp index 23e794f7cd..43318282a4 100644 --- a/native/cocos/platform/ohos/FileUtils-ohos.cpp +++ b/native/cocos/platform/ohos/FileUtils-ohos.cpp @@ -44,7 +44,7 @@ namespace cc { ResourceManager *FileUtilsOHOS::ohosResourceMgr = {}; -ccstd::string FileUtilsOHOS::ohosAssetPath = {}; +ccstd::string FileUtilsOHOS::ohosAssetPath = {}; namespace { @@ -62,8 +62,8 @@ void printRawfiles(ResourceManager *mgr, const ccstd::string &path) { auto fileCnt = GetRawFileCount(dir); for (auto i = 0; i < fileCnt; i++) { ccstd::string subFile = GetRawFileName(dir, i); - auto newPath = path + "/" + subFile; // NOLINT - auto debugPtr = newPath.c_str(); + auto newPath = path + "/" + subFile; // NOLINT + auto debugPtr = newPath.c_str(); HILOG_ERROR(LOG_APP, " find path %{public}s", newPath.c_str()); printRawfiles(mgr, newPath); } @@ -127,7 +127,7 @@ FileUtils::Status FileUtilsOHOS::getContents(const ccstd::string &filename, Resi } ccstd::string relativePath; - size_t position = fullPath.find(ASSETS_FOLDER_NAME); + size_t position = fullPath.find(ASSETS_FOLDER_NAME); if (0 == position) { // "@assets/" is at the beginning of the path and we don't want it relativePath = rawfilePrefix + fullPath.substr(strlen(ASSETS_FOLDER_NAME)); diff --git a/native/cocos/platform/ohos/FileUtils-ohos.h b/native/cocos/platform/ohos/FileUtils-ohos.h index f8302b7ff6..486ebe01cf 100644 --- a/native/cocos/platform/ohos/FileUtils-ohos.h +++ b/native/cocos/platform/ohos/FileUtils-ohos.h @@ -65,7 +65,7 @@ private: /* weak ref, do not need release */ static ResourceManager *ohosResourceMgr; - static ccstd::string ohosAssetPath; + static ccstd::string ohosAssetPath; friend class FileUtils; }; diff --git a/native/cocos/platform/ohos/jni/JniCocosAbility.cpp b/native/cocos/platform/ohos/jni/JniCocosAbility.cpp index edf1e164ed..23f9b512d5 100644 --- a/native/cocos/platform/ohos/jni/JniCocosAbility.cpp +++ b/native/cocos/platform/ohos/jni/JniCocosAbility.cpp @@ -59,17 +59,17 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosAbilitySlice_onCreateNative(JNIEn ResourceManager *objResourceManager = InitNativeResourceManager(env, resourceManager); JNI_NATIVE_GLUE()->setResourceManager(objResourceManager); - jboolean isCopy = false; + jboolean isCopy = false; ccstd::string assetPathClone; - const char *assetPathStr = env->GetStringUTFChars(assetPath, &isCopy); - assetPathClone = assetPathStr; + const char * assetPathStr = env->GetStringUTFChars(assetPath, &isCopy); + assetPathClone = assetPathStr; if (isCopy) { env->ReleaseStringUTFChars(assetPath, assetPathStr); assetPathStr = nullptr; } ccstd::string moduleName{"entry"}; - const char *moduleNameStr = env->GetStringUTFChars(moduleNameJ, &isCopy); - moduleName = moduleNameStr; + const char * moduleNameStr = env->GetStringUTFChars(moduleNameJ, &isCopy); + moduleName = moduleNameStr; if (isCopy) { env->ReleaseStringUTFChars(moduleNameJ, moduleNameStr); moduleNameStr = nullptr; diff --git a/native/cocos/platform/qnx/FileUtils-qnx.cpp b/native/cocos/platform/qnx/FileUtils-qnx.cpp index 79a0fd40bf..a1d0d19915 100644 --- a/native/cocos/platform/qnx/FileUtils-qnx.cpp +++ b/native/cocos/platform/qnx/FileUtils-qnx.cpp @@ -66,7 +66,7 @@ bool FileUtilsQNX::init() { _defaultResRootPath += CC_RESOURCE_FOLDER_LINUX; // Set writable path to $XDG_CONFIG_HOME or ~/.config// if $XDG_CONFIG_HOME not exists. - const char *xdg_config_path = getenv("XDG_CONFIG_HOME"); + const char * xdg_config_path = getenv("XDG_CONFIG_HOME"); ccstd::string xdgConfigPath; if (xdg_config_path == NULL) { xdg_config_path = getenv("HOME"); diff --git a/native/cocos/platform/qnx/FileUtils-qnx.h b/native/cocos/platform/qnx/FileUtils-qnx.h index 694ba3efbb..c7024b5f44 100644 --- a/native/cocos/platform/qnx/FileUtils-qnx.h +++ b/native/cocos/platform/qnx/FileUtils-qnx.h @@ -30,9 +30,9 @@ namespace cc { class FileUtilsQNX : public FileUtils { public: friend class FileUtils; - bool isFileExistInternal(const ccstd::string &filename) const override; + bool isFileExistInternal(const ccstd::string &filename) const override; ccstd::string getWritablePath() const override; - bool init() override; + bool init() override; private: ccstd::string _writablePath; diff --git a/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.cpp b/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.cpp index 6a5a56c88e..581a7e8e22 100644 --- a/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.cpp +++ b/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.cpp @@ -169,10 +169,10 @@ CanvasRenderingContext2DDelegate::Size CanvasRenderingContext2DDelegate::measure } void CanvasRenderingContext2DDelegate::updateFont(const ccstd::string &fontName, - float fontSize, - bool bold, - bool italic, - bool oblique, + float fontSize, + bool bold, + bool italic, + bool oblique, bool /* smallCaps */) { do { _fontName = fontName; diff --git a/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h index d15ce55400..f52182cc4d 100644 --- a/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h @@ -92,14 +92,14 @@ public: cairo_t * _cr{nullptr}; private: - cc::Data _imageData; + cc::Data _imageData; ccstd::string _curFontPath; - int _savedDC{0}; - float _lineWidth{0.0F}; - float _bufferWidth{0.0F}; - float _bufferHeight{0.0F}; + int _savedDC{0}; + float _lineWidth{0.0F}; + float _bufferWidth{0.0F}; + float _bufferHeight{0.0F}; - ccstd::string _fontName; + ccstd::string _fontName; int _fontSize{0}; Size _textSize; CanvasTextAlign _textAlign{CanvasTextAlign::CENTER}; diff --git a/native/cocos/platform/win32/FileUtils-win32.cpp b/native/cocos/platform/win32/FileUtils-win32.cpp index 4abd7c20e3..41504bf3d3 100644 --- a/native/cocos/platform/win32/FileUtils-win32.cpp +++ b/native/cocos/platform/win32/FileUtils-win32.cpp @@ -47,7 +47,7 @@ static ccstd::string s_resourcePath = ""; // D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt static inline ccstd::string convertPathFormatToUnixStyle(const ccstd::string &path) { ccstd::string ret = path; - size_t len = ret.length(); + size_t len = ret.length(); for (size_t i = 0; i < len; ++i) { if (ret[i] == '\\') { ret[i] = '/'; @@ -264,7 +264,7 @@ bool FileUtilsWin32::renameFile(const ccstd::string &path, const ccstd::string & ccstd::string oldPath = path + oldname; ccstd::string newPath = path + name; - std::regex pat("\\/"); + std::regex pat("\\/"); ccstd::string _old = std::regex_replace(oldPath, pat, "\\"); ccstd::string _new = std::regex_replace(newPath, pat, "\\"); @@ -320,7 +320,7 @@ bool FileUtilsWin32::createDirectory(const ccstd::string &dirPath) { } bool FileUtilsWin32::removeFile(const ccstd::string &filepath) { - std::regex pat("\\/"); + std::regex pat("\\/"); ccstd::string win32path = std::regex_replace(filepath, pat, "\\"); if (DeleteFile(StringUtf8ToWideChar(win32path).c_str())) { diff --git a/native/cocos/platform/win32/FileUtils-win32.h b/native/cocos/platform/win32/FileUtils-win32.h index 3a249cee93..3b29db428f 100644 --- a/native/cocos/platform/win32/FileUtils-win32.h +++ b/native/cocos/platform/win32/FileUtils-win32.h @@ -30,8 +30,8 @@ #if CC_PLATFORM == CC_PLATFORM_WINDOWS - #include "base/std/container/string.h" #include "base/Macros.h" + #include "base/std/container/string.h" #include "platform/FileUtils.h" namespace cc { @@ -48,11 +48,11 @@ class CC_DLL FileUtilsWin32 : public FileUtils { public: /* override functions */ - bool init(); + bool init(); virtual ccstd::string getWritablePath() const override; - virtual bool isAbsolutePath(const ccstd::string &strPath) const override; + virtual bool isAbsolutePath(const ccstd::string &strPath) const override; virtual ccstd::string getSuitableFOpen(const ccstd::string &filenameUtf8) const override; - virtual long getFileSize(const ccstd::string &filepath); + virtual long getFileSize(const ccstd::string &filepath); protected: virtual bool isFileExistInternal(const ccstd::string &strFilePath) const override; diff --git a/native/cocos/platform/win32/Utils-win32.h b/native/cocos/platform/win32/Utils-win32.h index 5ede1a9e4d..e2f6b30023 100644 --- a/native/cocos/platform/win32/Utils-win32.h +++ b/native/cocos/platform/win32/Utils-win32.h @@ -34,9 +34,9 @@ namespace cc { -std::wstring CC_DLL StringUtf8ToWideChar(const ccstd::string &strUtf8); -ccstd::string CC_DLL StringWideCharToUtf8(const std::wstring &strWideChar); -ccstd::string CC_DLL UTF8StringToMultiByte(const ccstd::string &strUtf8); +std::wstring CC_DLL StringUtf8ToWideChar(const ccstd::string &strUtf8); +ccstd::string CC_DLL StringWideCharToUtf8(const std::wstring &strWideChar); +ccstd::string CC_DLL UTF8StringToMultiByte(const ccstd::string &strUtf8); } // namespace cc diff --git a/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.cpp b/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.cpp index 3689f82a63..7e46e7d19f 100644 --- a/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.cpp +++ b/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.cpp @@ -184,8 +184,8 @@ CanvasRenderingContext2DDelegate::Size CanvasRenderingContext2DDelegate::measure } void CanvasRenderingContext2DDelegate::updateFont(const ccstd::string &fontName, - float fontSize, - bool bold, + float fontSize, + bool bold, bool /* italic */, bool /* oblique */, bool /* smallCaps */) { @@ -193,17 +193,17 @@ void CanvasRenderingContext2DDelegate::updateFont(const ccstd::string &fontName, _fontName = fontName; _fontSize = static_cast(fontSize); ccstd::string fontPath; - LOGFONTA tFont = {0}; + LOGFONTA tFont = {0}; if (!_fontName.empty()) { // firstly, try to create font from ttf file const auto &fontInfoMap = getFontFamilyNameMap(); auto iter = fontInfoMap.find(_fontName); if (iter != fontInfoMap.end()) { - fontPath = iter->second; + fontPath = iter->second; ccstd::string tmpFontPath = fontPath; - size_t nFindPos = tmpFontPath.rfind("/"); - tmpFontPath = &tmpFontPath[nFindPos + 1]; - nFindPos = tmpFontPath.rfind("."); + size_t nFindPos = tmpFontPath.rfind("/"); + tmpFontPath = &tmpFontPath[nFindPos + 1]; + nFindPos = tmpFontPath.rfind("."); // IDEA: draw ttf failed if font file name not equal font face name // for example: "DejaVuSansMono-Oblique" not equal "DejaVu Sans Mono" when using DejaVuSansMono-Oblique.ttf _fontName = tmpFontPath.substr(0, nFindPos); diff --git a/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.h index eb2abda5a6..b399869363 100644 --- a/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/win32/modules/CanvasRenderingContext2DDelegate.h @@ -92,18 +92,18 @@ public: HBITMAP _bmp{nullptr}; private: - cc::Data _imageData; - HFONT _font{static_cast(GetStockObject(DEFAULT_GUI_FONT))}; - HWND _wnd{nullptr}; - HPEN _hpen; - PAINTSTRUCT _paintStruct; + cc::Data _imageData; + HFONT _font{static_cast(GetStockObject(DEFAULT_GUI_FONT))}; + HWND _wnd{nullptr}; + HPEN _hpen; + PAINTSTRUCT _paintStruct; ccstd::string _curFontPath; - int _savedDC{0}; - float _lineWidth{0.0F}; - float _bufferWidth{0.0F}; - float _bufferHeight{0.0F}; + int _savedDC{0}; + float _lineWidth{0.0F}; + float _bufferWidth{0.0F}; + float _bufferHeight{0.0F}; - ccstd::string _fontName; + ccstd::string _fontName; int _fontSize{0}; Size _textSize; CanvasTextAlign _textAlign{CanvasTextAlign::CENTER}; diff --git a/native/cocos/profiler/DebugRenderer.cpp b/native/cocos/profiler/DebugRenderer.cpp index 60996bf97d..565f1df167 100644 --- a/native/cocos/profiler/DebugRenderer.cpp +++ b/native/cocos/profiler/DebugRenderer.cpp @@ -222,7 +222,7 @@ void DebugRenderer::destroyInstance() { } void DebugRenderer::activate(gfx::Device *device, const DebugRendererInfo &info) { - _device = device; + _device = device; static const gfx::AttributeList ATTRIBUTES = { {"a_position", gfx::Format::RG32F}, @@ -244,7 +244,7 @@ void DebugRenderer::activate(gfx::Device *device, const DebugRendererInfo &info) } } -void DebugRenderer::render(gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuff, pipeline::PipelineSceneData* sceneData) { +void DebugRenderer::render(gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuff, pipeline::PipelineSceneData *sceneData) { CC_PROFILE(DebugRendererRender); if (!_buffer || _buffer->empty()) { return; diff --git a/native/cocos/profiler/GameStats.h b/native/cocos/profiler/GameStats.h index 7aee38f7cc..54ef031413 100644 --- a/native/cocos/profiler/GameStats.h +++ b/native/cocos/profiler/GameStats.h @@ -28,9 +28,9 @@ #include #include #include -#include "base/std/container/string.h" #include #include "base/StringUtil.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" namespace cc { @@ -158,19 +158,19 @@ struct ObjectCounter { // assume update in main thread only. struct CoreStats { - uint32_t fps{0U}; - float frameTime{0.0F}; + uint32_t fps{0U}; + float frameTime{0.0F}; ccstd::string gfx; - bool multiThread{true}; - bool occlusionQuery{false}; - bool shadowMap{false}; - uint32_t screenWidth{0U}; - uint32_t screenHeight{0U}; + bool multiThread{true}; + bool occlusionQuery{false}; + bool shadowMap{false}; + uint32_t screenWidth{0U}; + uint32_t screenHeight{0U}; }; struct MemoryStats { // memory stats - std::mutex mutex; + std::mutex mutex; ccstd::unordered_map memories; inline void update(const ccstd::string &name, uint64_t value) { diff --git a/native/cocos/profiler/Profiler.cpp b/native/cocos/profiler/Profiler.cpp index 2beccf623f..88b2a3dc6b 100644 --- a/native/cocos/profiler/Profiler.cpp +++ b/native/cocos/profiler/Profiler.cpp @@ -62,7 +62,7 @@ private: ProfilerBlock * _parent{nullptr}; std::vector _children; utils::Timer _timer; - ccstd::string _name; + ccstd::string _name; TimeCounter _item; friend class Profiler; diff --git a/native/cocos/renderer/core/PassUtils.h b/native/cocos/renderer/core/PassUtils.h index 36324e5dc6..50289c58f1 100644 --- a/native/cocos/renderer/core/PassUtils.h +++ b/native/cocos/renderer/core/PassUtils.h @@ -25,9 +25,9 @@ #pragma once -#include "base/std/container/string.h" #include "base/Ptr.h" #include "base/TypeDef.h" +#include "base/std/container/string.h" #include "cocos/base/Variant.h" #include "math/Color.h" @@ -93,7 +93,7 @@ extern const ccstd::unordered_map type2writer; * @param type The type of the uniform */ const ccstd::vector &getDefaultFloatArrayFromType(gfx::Type type); -const ccstd::string & getDefaultStringFromType(gfx::Type type); +const ccstd::string & getDefaultStringFromType(gfx::Type type); /** * @en Combination of preprocess macros diff --git a/native/cocos/renderer/core/ProgramLib.h b/native/cocos/renderer/core/ProgramLib.h index 981f19e10f..5c8962ca1c 100644 --- a/native/cocos/renderer/core/ProgramLib.h +++ b/native/cocos/renderer/core/ProgramLib.h @@ -28,8 +28,8 @@ #include #include #include -#include "base/std/container/string.h" #include "base/RefVector.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "cocos/base/Optional.h" #include "core/Types.h" @@ -52,7 +52,7 @@ struct IDefineRecord : public IDefineInfo { struct IMacroInfo { ccstd::string name; ccstd::string value; - bool isDefault{false}; + bool isDefault{false}; }; struct ITemplateInfo { @@ -61,15 +61,15 @@ struct ITemplateInfo { ccstd::vector blockSizes; RefVector setLayouts; IntrusivePtr pipelineLayout; - Record handleMap; + Record handleMap; ccstd::vector bindings; int32_t samplerStartBinding{-1}; }; struct IProgramInfo : public IShaderInfo { - ccstd::string effectName; + ccstd::string effectName; ccstd::vector defines; - ccstd::string constantMacros; + ccstd::string constantMacros; bool uber{false}; // macro number exceeds default limits, will fallback to string hash void copyFrom(const IShaderInfo &o); @@ -160,10 +160,10 @@ private: ProgramLib(); ~ProgramLib(); - static ProgramLib * instance; + static ProgramLib * instance; Record _templates; // per shader Record> _cache; - Record _templateInfos; + Record _templateInfos; }; } // namespace cc diff --git a/native/cocos/renderer/frame-graph/DevicePass.h b/native/cocos/renderer/frame-graph/DevicePass.h index f2fb779d5f..aa6d93701c 100644 --- a/native/cocos/renderer/frame-graph/DevicePass.h +++ b/native/cocos/renderer/frame-graph/DevicePass.h @@ -25,9 +25,9 @@ #pragma once -#include "base/std/container/string.h" #include "CallbackPass.h" #include "RenderTargetAttachment.h" +#include "base/std/container/string.h" #include "gfx-base/GFXDef.h" namespace cc { diff --git a/native/cocos/renderer/frame-graph/FrameGraph.h b/native/cocos/renderer/frame-graph/FrameGraph.h index d8e84a1dd7..e110be8255 100644 --- a/native/cocos/renderer/frame-graph/FrameGraph.h +++ b/native/cocos/renderer/frame-graph/FrameGraph.h @@ -26,7 +26,6 @@ #pragma once #include -#include "base/std/container/string.h" #include "Blackboard.h" #include "CallbackPass.h" #include "DevicePass.h" @@ -34,6 +33,7 @@ #include "PassNodeBuilder.h" #include "ResourceEntry.h" #include "ResourceNode.h" +#include "base/std/container/string.h" namespace cc { namespace framegraph { diff --git a/native/cocos/renderer/gfx-base/GFXDef-common.h b/native/cocos/renderer/gfx-base/GFXDef-common.h index 4d17f4dec9..5eee56ba87 100644 --- a/native/cocos/renderer/gfx-base/GFXDef-common.h +++ b/native/cocos/renderer/gfx-base/GFXDef-common.h @@ -27,9 +27,9 @@ #include "base/TypeDef.h" #include "base/memory/Memory.h" -#include "math/Math.h" #include "base/std/container/string.h" #include "base/std/container/vector.h" +#include "math/Math.h" /** * Some general guide lines: @@ -1060,9 +1060,9 @@ struct ALIGNAS(8) SamplerInfo { }; struct Uniform { - ccstd::string name; - Type type{Type::UNKNOWN}; - uint32_t count{0}; + ccstd::string name; + Type type{Type::UNKNOWN}; + uint32_t count{0}; EXPOSE_COPY_FN(Uniform) }; @@ -1070,11 +1070,11 @@ struct Uniform { using UniformList = ccstd::vector; struct UniformBlock { - uint32_t set{0}; - uint32_t binding{0}; - ccstd::string name; - UniformList members; - uint32_t count{0}; + uint32_t set{0}; + uint32_t binding{0}; + ccstd::string name; + UniformList members; + uint32_t count{0}; EXPOSE_COPY_FN(UniformBlock) }; @@ -1082,11 +1082,11 @@ struct UniformBlock { using UniformBlockList = ccstd::vector; struct UniformSamplerTexture { - uint32_t set{0}; - uint32_t binding{0}; - ccstd::string name; - Type type{Type::UNKNOWN}; - uint32_t count{0}; + uint32_t set{0}; + uint32_t binding{0}; + ccstd::string name; + Type type{Type::UNKNOWN}; + uint32_t count{0}; EXPOSE_COPY_FN(UniformSamplerTexture) }; @@ -1094,10 +1094,10 @@ struct UniformSamplerTexture { using UniformSamplerTextureList = ccstd::vector; struct UniformSampler { - uint32_t set{0}; - uint32_t binding{0}; - ccstd::string name; - uint32_t count{0}; + uint32_t set{0}; + uint32_t binding{0}; + ccstd::string name; + uint32_t count{0}; EXPOSE_COPY_FN(UniformSampler) }; @@ -1105,11 +1105,11 @@ struct UniformSampler { using UniformSamplerList = ccstd::vector; struct UniformTexture { - uint32_t set{0}; - uint32_t binding{0}; - ccstd::string name; - Type type{Type::UNKNOWN}; - uint32_t count{0}; + uint32_t set{0}; + uint32_t binding{0}; + ccstd::string name; + Type type{Type::UNKNOWN}; + uint32_t count{0}; EXPOSE_COPY_FN(UniformTexture) }; @@ -1117,12 +1117,12 @@ struct UniformTexture { using UniformTextureList = ccstd::vector; struct UniformStorageImage { - uint32_t set{0}; - uint32_t binding{0}; - ccstd::string name; - Type type{Type::UNKNOWN}; - uint32_t count{0}; - MemoryAccess memoryAccess{MemoryAccessBit::READ_WRITE}; + uint32_t set{0}; + uint32_t binding{0}; + ccstd::string name; + Type type{Type::UNKNOWN}; + uint32_t count{0}; + MemoryAccess memoryAccess{MemoryAccessBit::READ_WRITE}; EXPOSE_COPY_FN(UniformStorageImage) }; @@ -1130,11 +1130,11 @@ struct UniformStorageImage { using UniformStorageImageList = ccstd::vector; struct UniformStorageBuffer { - uint32_t set{0}; - uint32_t binding{0}; - ccstd::string name; - uint32_t count{0}; - MemoryAccess memoryAccess{MemoryAccessBit::READ_WRITE}; + uint32_t set{0}; + uint32_t binding{0}; + ccstd::string name; + uint32_t count{0}; + MemoryAccess memoryAccess{MemoryAccessBit::READ_WRITE}; EXPOSE_COPY_FN(UniformStorageBuffer) }; @@ -1142,10 +1142,10 @@ struct UniformStorageBuffer { using UniformStorageBufferList = ccstd::vector; struct UniformInputAttachment { - uint32_t set{0}; - uint32_t binding{0}; - ccstd::string name; - uint32_t count{0}; + uint32_t set{0}; + uint32_t binding{0}; + ccstd::string name; + uint32_t count{0}; EXPOSE_COPY_FN(UniformInputAttachment) }; @@ -1154,7 +1154,7 @@ using UniformInputAttachmentList = ccstd::vector; struct ShaderStage { ShaderStageFlagBit stage{ShaderStageFlagBit::NONE}; - ccstd::string source; + ccstd::string source; EXPOSE_COPY_FN(ShaderStage) }; @@ -1162,12 +1162,12 @@ struct ShaderStage { using ShaderStageList = ccstd::vector; struct Attribute { - ccstd::string name; - Format format{Format::UNKNOWN}; - bool isNormalized{false}; - uint32_t stream{0}; - bool isInstanced{false}; - uint32_t location{0}; + ccstd::string name; + Format format{Format::UNKNOWN}; + bool isNormalized{false}; + uint32_t stream{0}; + bool isInstanced{false}; + uint32_t location{0}; EXPOSE_COPY_FN(Attribute) }; @@ -1196,7 +1196,7 @@ constexpr const char *ATTR_NAME_BATCH_ID = "a_batch_id"; constexpr const char *ATTR_NAME_BATCH_UV = "a_batch_uv"; struct ShaderInfo { - ccstd::string name; + ccstd::string name; ShaderStageList stages; AttributeList attributes; UniformBlockList blocks; @@ -1484,14 +1484,14 @@ struct QueryPoolInfo { }; struct FormatInfo { - const ccstd::string name; - const uint32_t size{0}; - const uint32_t count{0}; - const FormatType type{FormatType::NONE}; - const bool hasAlpha{false}; - const bool hasDepth{false}; - const bool hasStencil{false}; - const bool isCompressed{false}; + const ccstd::string name; + const uint32_t size{0}; + const uint32_t count{0}; + const FormatType type{FormatType::NONE}; + const bool hasAlpha{false}; + const bool hasDepth{false}; + const bool hasStencil{false}; + const bool isCompressed{false}; }; struct MemoryStatus { diff --git a/native/cocos/renderer/gfx-base/GFXDevice.h b/native/cocos/renderer/gfx-base/GFXDevice.h index 4e5d0883ab..bdc06c8d7c 100644 --- a/native/cocos/renderer/gfx-base/GFXDevice.h +++ b/native/cocos/renderer/gfx-base/GFXDevice.h @@ -98,16 +98,16 @@ public: inline void flushCommands(const ccstd::vector &cmdBuffs); inline void acquire(const ccstd::vector &swapchains); - inline Queue * getQueue() const { return _queue; } - inline QueryPool * getQueryPool() const { return _queryPool; } - inline CommandBuffer * getCommandBuffer() const { return _cmdBuff; } - inline const DeviceCaps &getCapabilities() const { return _caps; } - inline API getGfxAPI() const { return _api; } - inline const ccstd::string & getDeviceName() const { return _deviceName; } - inline const ccstd::string & getRenderer() const { return _renderer; } - inline const ccstd::string & getVendor() const { return _vendor; } - inline bool hasFeature(Feature feature) const { return _features[toNumber(feature)]; } - inline FormatFeature getFormatFeatures(Format format) const { return _formatFeatures[toNumber(format)]; } + inline Queue * getQueue() const { return _queue; } + inline QueryPool * getQueryPool() const { return _queryPool; } + inline CommandBuffer * getCommandBuffer() const { return _cmdBuff; } + inline const DeviceCaps & getCapabilities() const { return _caps; } + inline API getGfxAPI() const { return _api; } + inline const ccstd::string &getDeviceName() const { return _deviceName; } + inline const ccstd::string &getRenderer() const { return _renderer; } + inline const ccstd::string &getVendor() const { return _vendor; } + inline bool hasFeature(Feature feature) const { return _features[toNumber(feature)]; } + inline FormatFeature getFormatFeatures(Format format) const { return _formatFeatures[toNumber(format)]; } inline const BindingMappingInfo &bindingMappingInfo() const { return _bindingMappingInfo; } @@ -153,10 +153,10 @@ protected: // For context switching between threads virtual void bindContext(bool bound) {} - ccstd::string _deviceName; - ccstd::string _renderer; - ccstd::string _vendor; - ccstd::string _version; + ccstd::string _deviceName; + ccstd::string _renderer; + ccstd::string _vendor; + ccstd::string _version; API _api{API::UNKNOWN}; DeviceCaps _caps; BindingMappingInfo _bindingMappingInfo; diff --git a/native/cocos/renderer/gfx-base/GFXShader.h b/native/cocos/renderer/gfx-base/GFXShader.h index ff02a4e3b0..793e6822b7 100644 --- a/native/cocos/renderer/gfx-base/GFXShader.h +++ b/native/cocos/renderer/gfx-base/GFXShader.h @@ -39,7 +39,7 @@ public: void initialize(const ShaderInfo &info); void destroy(); - inline const ccstd::string & getName() const { return _name; } + inline const ccstd::string & getName() const { return _name; } inline const ShaderStageList & getStages() const { return _stages; } inline const AttributeList & getAttributes() const { return _attributes; } inline const UniformBlockList & getBlocks() const { return _blocks; } @@ -54,7 +54,7 @@ protected: virtual void doInit(const ShaderInfo &info) = 0; virtual void doDestroy() = 0; - ccstd::string _name; + ccstd::string _name; ShaderStageList _stages; AttributeList _attributes; UniformBlockList _blocks; diff --git a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp index 82207a5687..a5837d7c4f 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp @@ -858,9 +858,9 @@ void cmdFuncGLES2DestroySampler(GLES2Device *device, GLES2GPUSampler *gpuSampler } void cmdFuncGLES2CreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { - GLenum glShaderType = 0; + GLenum glShaderType = 0; ccstd::string shaderTypeStr; - GLint status; + GLint status; for (size_t i = 0; i < gpuShader->gpuStages.size(); ++i) { GLES2GPUShaderStage &gpuStage = gpuShader->gpuStages[i]; @@ -1088,10 +1088,10 @@ void cmdFuncGLES2CreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { } // texture unit index mapping optimization - ccstd::vector glActiveSamplerTextures; - ccstd::vector glActiveSamplerLocations; - const GLESBindingMapping & bindingMappings = device->bindingMappings(); - ccstd::unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; + ccstd::vector glActiveSamplerTextures; + ccstd::vector glActiveSamplerLocations; + const GLESBindingMapping & bindingMappings = device->bindingMappings(); + ccstd::unordered_map &texUnitCacheMap = device->stateCache()->texUnitCacheMap; // sampler bindings in the flexible set comes strictly after buffer bindings // so we need to subtract the buffer count for these samplers diff --git a/native/cocos/renderer/gfx-gles2/GLES2Device.cpp b/native/cocos/renderer/gfx-gles2/GLES2Device.cpp index 9e818ddac6..f992dcbe7b 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Device.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Device.cpp @@ -100,7 +100,7 @@ bool GLES2Device::doInit(const DeviceInfo & /*info*/) { _bindingMappings.flexibleSet = _bindingMappingInfo.setIndices.back(); ccstd::string extStr = reinterpret_cast(glGetString(GL_EXTENSIONS)); - _extensions = StringUtil::split(extStr, " "); + _extensions = StringUtil::split(extStr, " "); _multithreadedCommandRecording = false; diff --git a/native/cocos/renderer/gfx-gles2/GLES2GPUContext.cpp b/native/cocos/renderer/gfx-gles2/GLES2GPUContext.cpp index 76d3aabd7a..1e377dfe49 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2GPUContext.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2GPUContext.cpp @@ -67,7 +67,7 @@ void GL_APIENTRY GLES2EGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum } ccstd::string msg = StringUtil::format("source: %s, type: %s, severity: %s, message: %s", - sourceDesc.c_str(), typeDesc.c_str(), severityDesc.c_str(), message); + sourceDesc.c_str(), typeDesc.c_str(), severityDesc.c_str(), message); if (severity == GL_DEBUG_SEVERITY_HIGH_KHR) { CC_LOG_ERROR(msg.c_str()); diff --git a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h index d396406881..047ce04b02 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h +++ b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h @@ -163,20 +163,20 @@ struct GLES2GPUSampler { }; struct GLES2GPUInput { - uint32_t binding = 0; - ccstd::string name; - Type type = Type::UNKNOWN; - uint32_t stride = 0; - uint32_t count = 0; - uint32_t size = 0; - GLenum glType = 0; - GLint glLoc = -1; + uint32_t binding = 0; + ccstd::string name; + Type type = Type::UNKNOWN; + uint32_t stride = 0; + uint32_t count = 0; + uint32_t size = 0; + GLenum glType = 0; + GLint glLoc = -1; }; using GLES2GPUInputList = ccstd::vector; struct GLES2GPUUniform { uint32_t binding = INVALID_BINDING; - ccstd::string name; + ccstd::string name; Type type = Type::UNKNOWN; uint32_t stride = 0; uint32_t count = 0; @@ -192,7 +192,7 @@ struct GLES2GPUUniformBlock { uint32_t set = 0; uint32_t binding = 0; uint32_t idx = 0; - ccstd::string name; + ccstd::string name; uint32_t size = 0; GLES2GPUUniformList glUniforms; GLES2GPUUniformList glActiveUniforms; @@ -201,11 +201,11 @@ struct GLES2GPUUniformBlock { using GLES2GPUUniformBlockList = ccstd::vector; struct GLES2GPUUniformSamplerTexture { - uint32_t set = 0; - uint32_t binding = 0; - ccstd::string name; - Type type = Type::UNKNOWN; - uint32_t count = 0U; + uint32_t set = 0; + uint32_t binding = 0; + ccstd::string name; + Type type = Type::UNKNOWN; + uint32_t count = 0U; ccstd::vector units; GLenum glType = 0; @@ -215,13 +215,13 @@ using GLES2GPUUniformSamplerTextureList = ccstd::vector; struct GLES2GPUShader { - ccstd::string name; + ccstd::string name; UniformBlockList blocks; UniformSamplerTextureList samplerTextures; UniformInputAttachmentList subpassInputs; @@ -233,16 +233,16 @@ struct GLES2GPUShader { }; struct GLES2GPUAttribute { - ccstd::string name; - GLuint glBuffer = 0; - GLenum glType = 0; - uint32_t size = 0; - uint32_t count = 0; - uint32_t stride = 1; - uint32_t componentCount = 1; - bool isNormalized = false; - bool isInstanced = false; - uint32_t offset = 0; + ccstd::string name; + GLuint glBuffer = 0; + GLenum glType = 0; + uint32_t size = 0; + uint32_t count = 0; + uint32_t stride = 1; + uint32_t componentCount = 1; + bool isNormalized = false; + bool isInstanced = false; + uint32_t offset = 0; }; using GLES2GPUAttributeList = ccstd::vector; @@ -391,27 +391,27 @@ struct GLES2ObjectCache { class GLES2GPUStateCache { public: - GLuint glArrayBuffer = 0; - GLuint glElementArrayBuffer = 0; - GLuint glUniformBuffer = 0; - GLuint glVAO = 0; - uint32_t texUint = 0; - ccstd::vector glTextures; - GLuint glProgram = 0; - ccstd::vector glEnabledAttribLocs; - ccstd::vector glCurrentAttribLocs; - GLuint glFramebuffer = 0; - GLuint glRenderbuffer = 0; - GLuint glReadFBO = 0; - Viewport viewport; - Rect scissor; - RasterizerState rs; - DepthStencilState dss; - BlendState bs; - bool isCullFaceEnabled = true; - bool isStencilTestEnabled = false; + GLuint glArrayBuffer = 0; + GLuint glElementArrayBuffer = 0; + GLuint glUniformBuffer = 0; + GLuint glVAO = 0; + uint32_t texUint = 0; + ccstd::vector glTextures; + GLuint glProgram = 0; + ccstd::vector glEnabledAttribLocs; + ccstd::vector glCurrentAttribLocs; + GLuint glFramebuffer = 0; + GLuint glRenderbuffer = 0; + GLuint glReadFBO = 0; + Viewport viewport; + Rect scissor; + RasterizerState rs; + DepthStencilState dss; + BlendState bs; + bool isCullFaceEnabled = true; + bool isStencilTestEnabled = false; ccstd::unordered_map texUnitCacheMap; - GLES2ObjectCache gfxStateCache; + GLES2ObjectCache gfxStateCache; void initialize(size_t texUnits, size_t vertexAttributes) { glTextures.resize(texUnits, 0U); diff --git a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp index aa5a2e2c18..e919690fb6 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp @@ -999,9 +999,9 @@ GLuint GLES3GPUSampler::getGLSampler(uint16_t minLod, uint16_t maxLod) { // NOLINTNEXTLINE(google-readability-function-size, readability-function-size) void cmdFuncGLES3CreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { - GLenum glShaderStage = 0; + GLenum glShaderStage = 0; ccstd::string shaderStageStr; - GLint status; + GLint status; for (size_t i = 0; i < gpuShader->gpuStages.size(); ++i) { GLES3GPUShaderStage &gpuStage = gpuShader->gpuStages[i]; @@ -1028,9 +1028,9 @@ void cmdFuncGLES3CreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { } } GL_CHECK(gpuStage.glShader = glCreateShader(glShaderStage)); - uint32_t version = device->constantRegistry()->glMinorVersion ? 310 : 300; - ccstd::string shaderSource = StringUtil::format("#version %u es\n", version) + gpuStage.source; - const char *source = shaderSource.c_str(); + uint32_t version = device->constantRegistry()->glMinorVersion ? 310 : 300; + ccstd::string shaderSource = StringUtil::format("#version %u es\n", version) + gpuStage.source; + const char * source = shaderSource.c_str(); GL_CHECK(glShaderSource(gpuStage.glShader, 1, (const GLchar **)&source, nullptr)); GL_CHECK(glCompileShader(gpuStage.glShader)); @@ -1216,10 +1216,10 @@ void cmdFuncGLES3CreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { } // texture unit index mapping optimization - ccstd::vector glActiveSamplerTextures; - ccstd::vector glActiveSamplerLocations; - const GLESBindingMapping & bindingMappings = device->bindingMappings(); - ccstd::unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; + ccstd::vector glActiveSamplerTextures; + ccstd::vector glActiveSamplerLocations; + const GLESBindingMapping & bindingMappings = device->bindingMappings(); + ccstd::unordered_map &texUnitCacheMap = device->stateCache()->texUnitCacheMap; // sampler bindings in the flexible set comes strictly after buffer bindings // so we need to subtract the buffer count for these samplers diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp index c0cedec5bf..cfe273a745 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp @@ -99,7 +99,7 @@ bool GLES3Device::doInit(const DeviceInfo & /*info*/) { _bindingMappings.flexibleSet = _bindingMappingInfo.setIndices.back(); ccstd::string extStr = reinterpret_cast(glGetString(GL_EXTENSIONS)); - _extensions = StringUtil::split(extStr, " "); + _extensions = StringUtil::split(extStr, " "); initFormatFeature(); diff --git a/native/cocos/renderer/gfx-gles3/GLES3GPUContext.cpp b/native/cocos/renderer/gfx-gles3/GLES3GPUContext.cpp index 27edc4f393..3fafb24047 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3GPUContext.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3GPUContext.cpp @@ -67,7 +67,7 @@ void GL_APIENTRY GLES3EGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum } ccstd::string msg = StringUtil::format("source: %s, type: %s, severity: %s, message: %s", - sourceDesc.c_str(), typeDesc.c_str(), severityDesc.c_str(), message); + sourceDesc.c_str(), typeDesc.c_str(), severityDesc.c_str(), message); if (severity == GL_DEBUG_SEVERITY_HIGH_KHR) { CC_LOG_ERROR(msg.c_str()); diff --git a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h index 529907c6ed..886c08a368 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h +++ b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h @@ -195,46 +195,46 @@ private: }; struct GLES3GPUInput { - uint32_t binding = 0; - ccstd::string name; - Type type = Type::UNKNOWN; - uint32_t stride = 0; - uint32_t count = 0; - uint32_t size = 0; - GLenum glType = 0; - GLint glLoc = -1; + uint32_t binding = 0; + ccstd::string name; + Type type = Type::UNKNOWN; + uint32_t stride = 0; + uint32_t count = 0; + uint32_t size = 0; + GLenum glType = 0; + GLint glLoc = -1; }; using GLES3GPUInputList = ccstd::vector; struct GLES3GPUUniform { - uint32_t binding = INVALID_BINDING; - ccstd::string name; - Type type = Type::UNKNOWN; - uint32_t stride = 0; - uint32_t count = 0; - uint32_t size = 0; - uint32_t offset = 0; - GLenum glType = 0; - GLint glLoc = -1; + uint32_t binding = INVALID_BINDING; + ccstd::string name; + Type type = Type::UNKNOWN; + uint32_t stride = 0; + uint32_t count = 0; + uint32_t size = 0; + uint32_t offset = 0; + GLenum glType = 0; + GLint glLoc = -1; }; using GLES3GPUUniformList = ccstd::vector; struct GLES3GPUUniformBuffer { - uint32_t set = INVALID_BINDING; - uint32_t binding = INVALID_BINDING; - ccstd::string name; - uint32_t size = 0; - uint32_t glBinding = 0xffffffff; - bool isStorage = false; + uint32_t set = INVALID_BINDING; + uint32_t binding = INVALID_BINDING; + ccstd::string name; + uint32_t size = 0; + uint32_t glBinding = 0xffffffff; + bool isStorage = false; }; using GLES3GPUUniformBufferList = ccstd::vector; struct GLES3GPUUniformSamplerTexture { - uint32_t set = 0; - uint32_t binding = 0; - ccstd::string name; - Type type = Type::UNKNOWN; - uint32_t count = 0U; + uint32_t set = 0; + uint32_t binding = 0; + ccstd::string name; + Type type = Type::UNKNOWN; + uint32_t count = 0U; ccstd::vector units; GLenum glType = 0; @@ -243,11 +243,11 @@ struct GLES3GPUUniformSamplerTexture { using GLES3GPUUniformSamplerTextureList = ccstd::vector; struct GLES3GPUUniformStorageImage { - uint32_t set = 0; - uint32_t binding = 0; - ccstd::string name; - Type type = Type::UNKNOWN; - uint32_t count = 0U; + uint32_t set = 0; + uint32_t binding = 0; + ccstd::string name; + Type type = Type::UNKNOWN; + uint32_t count = 0U; ccstd::vector units; GLenum glMemoryAccess = GL_READ_WRITE; @@ -261,13 +261,13 @@ struct GLES3GPUShaderStage { source(std::move(std::move(s))), glShader(shader) {} ShaderStageFlagBit type; - ccstd::string source; + ccstd::string source; GLuint glShader = 0; }; using GLES3GPUShaderStageList = ccstd::vector; struct GLES3GPUShader { - ccstd::string name; + ccstd::string name; UniformBlockList blocks; UniformStorageBufferList buffers; UniformSamplerTextureList samplerTextures; @@ -285,16 +285,16 @@ struct GLES3GPUShader { }; struct GLES3GPUAttribute { - ccstd::string name; - GLuint glBuffer = 0; - GLenum glType = 0; - uint32_t size = 0; - uint32_t count = 0; - uint32_t stride = 1; - uint32_t componentCount = 1; - bool isNormalized = false; - bool isInstanced = false; - uint32_t offset = 0; + ccstd::string name; + GLuint glBuffer = 0; + GLenum glType = 0; + uint32_t size = 0; + uint32_t count = 0; + uint32_t stride = 1; + uint32_t componentCount = 1; + bool isNormalized = false; + bool isInstanced = false; + uint32_t offset = 0; }; using GLES3GPUAttributeList = ccstd::vector; @@ -455,35 +455,35 @@ struct GLES3ObjectCache { class GLES3GPUStateCache final { public: - GLuint glArrayBuffer = 0; - GLuint glElementArrayBuffer = 0; - GLuint glUniformBuffer = 0; - ccstd::vector glBindUBOs; - ccstd::vector glBindUBOOffsets; - GLuint glShaderStorageBuffer = 0; - ccstd::vector glBindSSBOs; - ccstd::vector glBindSSBOOffsets; - GLuint glDispatchIndirectBuffer = 0; - GLuint glVAO = 0; - uint32_t texUint = 0; - ccstd::vector glTextures; - ccstd::vector glImages; - ccstd::vector glSamplers; - GLuint glProgram = 0; - ccstd::vector glEnabledAttribLocs; - ccstd::vector glCurrentAttribLocs; - GLuint glReadFramebuffer = 0; - GLuint glDrawFramebuffer = 0; - GLuint glRenderbuffer = 0; - Viewport viewport; - Rect scissor; - RasterizerState rs; - DepthStencilState dss; - BlendState bs; - bool isCullFaceEnabled = true; - bool isStencilTestEnabled = false; + GLuint glArrayBuffer = 0; + GLuint glElementArrayBuffer = 0; + GLuint glUniformBuffer = 0; + ccstd::vector glBindUBOs; + ccstd::vector glBindUBOOffsets; + GLuint glShaderStorageBuffer = 0; + ccstd::vector glBindSSBOs; + ccstd::vector glBindSSBOOffsets; + GLuint glDispatchIndirectBuffer = 0; + GLuint glVAO = 0; + uint32_t texUint = 0; + ccstd::vector glTextures; + ccstd::vector glImages; + ccstd::vector glSamplers; + GLuint glProgram = 0; + ccstd::vector glEnabledAttribLocs; + ccstd::vector glCurrentAttribLocs; + GLuint glReadFramebuffer = 0; + GLuint glDrawFramebuffer = 0; + GLuint glRenderbuffer = 0; + Viewport viewport; + Rect scissor; + RasterizerState rs; + DepthStencilState dss; + BlendState bs; + bool isCullFaceEnabled = true; + bool isStencilTestEnabled = false; ccstd::unordered_map texUnitCacheMap; - GLES3ObjectCache gfxStateCache; + GLES3ObjectCache gfxStateCache; void initialize(size_t texUnits, size_t imageUnits, size_t uboBindings, size_t ssboBindings, size_t vertexAttributes) { glBindUBOs.resize(uboBindings, 0U); diff --git a/native/cocos/renderer/gfx-metal/MTLGPUObjects.h b/native/cocos/renderer/gfx-metal/MTLGPUObjects.h index f5b82b9eb1..038046af65 100644 --- a/native/cocos/renderer/gfx-metal/MTLGPUObjects.h +++ b/native/cocos/renderer/gfx-metal/MTLGPUObjects.h @@ -70,7 +70,7 @@ struct CCMTLGPUPipelineLayout { }; struct CCMTLGPUUniformBlock { - ccstd::string name; + ccstd::string name; uint set = INVALID_BINDING; uint binding = INVALID_BINDING; uint mappedBinding = INVALID_BINDING; @@ -80,7 +80,7 @@ struct CCMTLGPUUniformBlock { }; struct CCMTLGPUSamplerBlock { - ccstd::string name; + ccstd::string name; uint set = INVALID_BINDING; uint binding = INVALID_BINDING; uint textureBinding = INVALID_BINDING; @@ -92,8 +92,8 @@ struct CCMTLGPUSamplerBlock { struct CCMTLGPUSubpassAttachment { ccstd::string name; - uint set = INVALID_BINDING; - uint binding = INVALID_BINDING; + uint set = INVALID_BINDING; + uint binding = INVALID_BINDING; }; struct CCMTLGPUShader { diff --git a/native/cocos/renderer/gfx-metal/MTLUtils.h b/native/cocos/renderer/gfx-metal/MTLUtils.h index a1f440d11f..113c90d813 100644 --- a/native/cocos/renderer/gfx-metal/MTLUtils.h +++ b/native/cocos/renderer/gfx-metal/MTLUtils.h @@ -72,7 +72,7 @@ MTLSamplerAddressMode toMTLSamplerAddressMode(Address); int toMTLSamplerBorderColor(const Color &); MTLSamplerMinMagFilter toMTLSamplerMinMagFilter(Filter); MTLSamplerMipFilter toMTLSamplerMipFilter(Filter); -ccstd::string spirv2MSL(const uint32_t *ir, size_t word_count, ShaderStageFlagBit shaderType, CCMTLGPUShader *gpuShader); +ccstd::string spirv2MSL(const uint32_t *ir, size_t word_count, ShaderStageFlagBit shaderType, CCMTLGPUShader *gpuShader); const uint8_t * convertRGB8ToRGBA8(const uint8_t *source, uint length); const uint8_t * convertRGB32FToRGBA32F(const uint8_t *source, uint length); NSUInteger highestSupportedFeatureSet(id device); @@ -102,7 +102,7 @@ MTLPixelFormat getSupportedDepthStencilFormat(id device, uint bool isIndirectDrawSupported(uint family); bool isImageBlockSupported(); bool isFramebufferFetchSupported(); -ccstd::string featureSetToString(MTLFeatureSet featureSet); +ccstd::string featureSetToString(MTLFeatureSet featureSet); const uint8_t *const convertData(const uint8_t *source, uint length, Format type); uint getBlockSize(Format format); uint getBytesPerRow(Format format, uint width); diff --git a/native/cocos/renderer/gfx-validator/ValidationUtils.h b/native/cocos/renderer/gfx-validator/ValidationUtils.h index 4d57f1033f..0ca765e5f1 100644 --- a/native/cocos/renderer/gfx-validator/ValidationUtils.h +++ b/native/cocos/renderer/gfx-validator/ValidationUtils.h @@ -131,8 +131,8 @@ public: private: struct ResourceRecord { - Resource *resource = nullptr; - ccstd::string initStack; + Resource * resource = nullptr; + ccstd::string initStack; }; static ccstd::vector resources; diff --git a/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h b/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h index e89ce9afd2..ae539218e4 100644 --- a/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h +++ b/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h @@ -266,12 +266,12 @@ struct CCVKGPUShaderStage { source(std::move(s)) { } ShaderStageFlagBit type = ShaderStageFlagBit::NONE; - ccstd::string source; + ccstd::string source; VkShaderModule vkShader = VK_NULL_HANDLE; }; struct CCVKGPUShader { - ccstd::string name; + ccstd::string name; AttributeList attributes; ccstd::vector gpuStages; }; diff --git a/native/cocos/renderer/gfx-vulkan/VKUtils.h b/native/cocos/renderer/gfx-vulkan/VKUtils.h index 85a2a32913..8369b82e6b 100644 --- a/native/cocos/renderer/gfx-vulkan/VKUtils.h +++ b/native/cocos/renderer/gfx-vulkan/VKUtils.h @@ -69,7 +69,7 @@ VkColorComponentFlags mapVkColorComponentFlags(ColorMask colorMask); VkShaderStageFlagBits mapVkShaderStageFlagBits(ShaderStageFlagBit stage); VkShaderStageFlags mapVkShaderStageFlags(ShaderStageFlagBit stages); SurfaceTransform mapSurfaceTransform(VkSurfaceTransformFlagBitsKHR transform); -ccstd::string mapVendorName(uint32_t vendorID); +ccstd::string mapVendorName(uint32_t vendorID); void fullPipelineBarrier(VkCommandBuffer cmdBuff); const ThsvsAccessType *getAccessType(AccessFlagBit flag); diff --git a/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h b/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h index 245223baa0..e71ba77778 100644 --- a/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h +++ b/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h @@ -14476,7 +14476,7 @@ void VmaRecorder::GetBasicParams(CallParams &outParams) { std::stringstream thread_id_to_string_converter; thread_id_to_string_converter << thread_id; ccstd::string thread_id_as_string = thread_id_to_string_converter.str(); - outParams.threadId = static_cast(std::stoi(thread_id_as_string.c_str())); + outParams.threadId = static_cast(std::stoi(thread_id_as_string.c_str())); #endif auto current_time = std::chrono::high_resolution_clock::now(); diff --git a/native/cocos/renderer/gfx-wgpu/WGPUObject.h b/native/cocos/renderer/gfx-wgpu/WGPUObject.h index 9c8ec7a7c9..16b52036aa 100644 --- a/native/cocos/renderer/gfx-wgpu/WGPUObject.h +++ b/native/cocos/renderer/gfx-wgpu/WGPUObject.h @@ -82,7 +82,7 @@ struct CCWGPUSwapchainObject { struct CCWGPURenderPassObject { RenderPassInfo info; - ccstd::string label; + ccstd::string label; uint8_t sampleCount = 1; WGPURenderPassDescriptor *wgpuRenderPassDesc = wgpuDefaultHandle; }; @@ -173,7 +173,7 @@ struct CCWGPUPipelineStateObject { }; struct CCWGPUShaderObject { - ccstd::string name; + ccstd::string name; WGPUShaderModule wgpuShaderVertexModule = wgpuDefaultHandle; WGPUShaderModule wgpuShaderFragmentModule = wgpuDefaultHandle; WGPUShaderModule wgpuShaderComputeModule = wgpuDefaultHandle; diff --git a/native/cocos/renderer/gfx-wgpu/WGPUPipelineState.cpp b/native/cocos/renderer/gfx-wgpu/WGPUPipelineState.cpp index 4d6b95efea..a12c0982eb 100644 --- a/native/cocos/renderer/gfx-wgpu/WGPUPipelineState.cpp +++ b/native/cocos/renderer/gfx-wgpu/WGPUPipelineState.cpp @@ -86,7 +86,7 @@ void CCWGPUPipelineState::prepare(const ccstd::set &setInUse) { // wgpuAttrsVec[0] ∪ wgpuAttrsVec[1] ∪ ... ∪ wgpuAttrsVec[n] == shader.attrs for (size_t i = 0; i < attrs.size(); i++) { ccstd::string attrName = attrs[i].name; - auto iter = std::find_if(_inputState.attributes.begin(), _inputState.attributes.end(), [attrName](const Attribute &attr) { + auto iter = std::find_if(_inputState.attributes.begin(), _inputState.attributes.end(), [attrName](const Attribute &attr) { return strcmp(attrName.c_str(), attr.name.c_str()) == 0; }); @@ -123,9 +123,9 @@ void CCWGPUPipelineState::prepare(const ccstd::set &setInUse) { // input state has attr which shader hasnt. for (size_t i = 0; i < _inputState.attributes.size(); ++i) { - ccstd::string attrName = _inputState.attributes[i].name; - const auto &attribute = _inputState.attributes[i]; - auto iter = std::find_if(attrs.begin(), attrs.end(), [attrName](const Attribute &attr) { + ccstd::string attrName = _inputState.attributes[i].name; + const auto & attribute = _inputState.attributes[i]; + auto iter = std::find_if(attrs.begin(), attrs.end(), [attrName](const Attribute &attr) { return strcmp(attrName.c_str(), attr.name.c_str()) == 0; }); if (iter == attrs.end()) { diff --git a/native/cocos/renderer/pipeline/Define.cpp b/native/cocos/renderer/pipeline/Define.cpp index 89ebaff418..660a164bfd 100644 --- a/native/cocos/renderer/pipeline/Define.cpp +++ b/native/cocos/renderer/pipeline/Define.cpp @@ -55,7 +55,7 @@ gfx::BindingMappingInfo bindingMappingInfo = { DescriptorSetLayoutInfos globalDescriptorSetLayout; DescriptorSetLayoutInfos localDescriptorSetLayout; -const ccstd::string UBOGlobal::NAME = "CCGlobal"; +const ccstd::string UBOGlobal::NAME = "CCGlobal"; const gfx::DescriptorSetLayoutBinding UBOGlobal::DESCRIPTOR = { UBOGlobal::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -75,7 +75,7 @@ const gfx::UniformBlock UBOGlobal::LAYOUT = { 1, }; -const ccstd::string UBOLocalBatched::NAME = "CCLocalBatched"; +const ccstd::string UBOLocalBatched::NAME = "CCLocalBatched"; const gfx::DescriptorSetLayoutBinding UBOLocalBatched::DESCRIPTOR = { UBOLocalBatched::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -93,7 +93,7 @@ const gfx::UniformBlock UBOLocalBatched::LAYOUT = { 1, }; -const ccstd::string UBOCamera::NAME = "CCCamera"; +const ccstd::string UBOCamera::NAME = "CCCamera"; const gfx::DescriptorSetLayoutBinding UBOCamera::DESCRIPTOR = { UBOCamera::BINDING, gfx::DescriptorType::DYNAMIC_UNIFORM_BUFFER, @@ -128,7 +128,7 @@ const gfx::UniformBlock UBOCamera::LAYOUT = { 1, }; -const ccstd::string UBOShadow::NAME = "CCShadow"; +const ccstd::string UBOShadow::NAME = "CCShadow"; const gfx::DescriptorSetLayoutBinding UBOShadow::DESCRIPTOR = { UBOShadow::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -156,7 +156,7 @@ const gfx::UniformBlock UBOShadow::LAYOUT = { 1, }; -const ccstd::string UBOLocal::NAME = "CCLocal"; +const ccstd::string UBOLocal::NAME = "CCLocal"; const gfx::DescriptorSetLayoutBinding UBOLocal::DESCRIPTOR = { UBOLocal::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -177,7 +177,7 @@ const gfx::UniformBlock UBOLocal::LAYOUT = { 1, }; -const ccstd::string UBOWorldBound::NAME = "CCWorldBound"; +const ccstd::string UBOWorldBound::NAME = "CCWorldBound"; const gfx::DescriptorSetLayoutBinding UBOWorldBound::DESCRIPTOR = { UBOWorldBound::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -196,7 +196,7 @@ const gfx::UniformBlock UBOWorldBound::LAYOUT = { 1, }; -const ccstd::string UBOForwardLight::NAME = "CCForwardLight"; +const ccstd::string UBOForwardLight::NAME = "CCForwardLight"; const gfx::DescriptorSetLayoutBinding UBOForwardLight::DESCRIPTOR = { UBOForwardLight::BINDING, gfx::DescriptorType::DYNAMIC_UNIFORM_BUFFER, @@ -217,7 +217,7 @@ const gfx::UniformBlock UBOForwardLight::LAYOUT = { 1, }; -const ccstd::string UBOSkinningTexture::NAME = "CCSkinningTexture"; +const ccstd::string UBOSkinningTexture::NAME = "CCSkinningTexture"; const gfx::DescriptorSetLayoutBinding UBOSkinningTexture::DESCRIPTOR = { UBOSkinningTexture::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -235,7 +235,7 @@ const gfx::UniformBlock UBOSkinningTexture::LAYOUT = { 1, }; -const ccstd::string UBOSkinningAnimation::NAME = "CCSkinningAnimation"; +const ccstd::string UBOSkinningAnimation::NAME = "CCSkinningAnimation"; const gfx::DescriptorSetLayoutBinding UBOSkinningAnimation::DESCRIPTOR = { UBOSkinningAnimation::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -253,7 +253,7 @@ const gfx::UniformBlock UBOSkinningAnimation::LAYOUT = { 1, }; -const ccstd::string UBOSkinning::NAME = "CCSkinning"; +const ccstd::string UBOSkinning::NAME = "CCSkinning"; const gfx::DescriptorSetLayoutBinding UBOSkinning::DESCRIPTOR = { UBOSkinning::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -273,7 +273,7 @@ const gfx::UniformBlock UBOSkinning::LAYOUT = { const uint UBOMorph::COUNT_BASE_4_BYTES = static_cast(4 * std::ceil(UBOMorph::MAX_MORPH_TARGET_COUNT / 4) + 4); const uint UBOMorph::SIZE = UBOMorph::COUNT_BASE_4_BYTES * 4; -const ccstd::string UBOMorph::NAME = "CCMorph"; +const ccstd::string UBOMorph::NAME = "CCMorph"; const gfx::DescriptorSetLayoutBinding UBOMorph::DESCRIPTOR = { UBOMorph::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -292,7 +292,7 @@ const gfx::UniformBlock UBOMorph::LAYOUT = { 1, }; -const ccstd::string UBOUILocal::NAME = "CCUILocal"; +const ccstd::string UBOUILocal::NAME = "CCUILocal"; const gfx::DescriptorSetLayoutBinding UBOUILocal::DESCRIPTOR = { UBOUILocal::BINDING, gfx::DescriptorType::DYNAMIC_UNIFORM_BUFFER, @@ -309,7 +309,7 @@ const gfx::UniformBlock UBOUILocal::LAYOUT = { 1, }; -const ccstd::string SHADOWMAP::NAME = "cc_shadowMap"; +const ccstd::string SHADOWMAP::NAME = "cc_shadowMap"; const gfx::DescriptorSetLayoutBinding SHADOWMAP::DESCRIPTOR = { SHADOWMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -325,7 +325,7 @@ const gfx::UniformSamplerTexture SHADOWMAP::LAYOUT = { 1, }; -const ccstd::string ENVIRONMENT::NAME = "cc_environment"; +const ccstd::string ENVIRONMENT::NAME = "cc_environment"; const gfx::DescriptorSetLayoutBinding ENVIRONMENT::DESCRIPTOR = { ENVIRONMENT::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -341,7 +341,7 @@ const gfx::UniformSamplerTexture ENVIRONMENT::LAYOUT = { 1, }; -const ccstd::string SPOTLIGHTINGMAP::NAME = "cc_spotLightingMap"; +const ccstd::string SPOTLIGHTINGMAP::NAME = "cc_spotLightingMap"; const gfx::DescriptorSetLayoutBinding SPOTLIGHTINGMAP::DESCRIPTOR = { SPOTLIGHTINGMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -357,7 +357,7 @@ const gfx::UniformSamplerTexture SPOTLIGHTINGMAP::LAYOUT = { 1, }; -const ccstd::string DIFFUSEMAP::NAME = "cc_diffuseMap"; +const ccstd::string DIFFUSEMAP::NAME = "cc_diffuseMap"; const gfx::DescriptorSetLayoutBinding DIFFUSEMAP::DESCRIPTOR = { DIFFUSEMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -373,7 +373,7 @@ const gfx::UniformSamplerTexture DIFFUSEMAP::LAYOUT = { 1, }; -const ccstd::string JOINTTEXTURE::NAME = "cc_jointTexture"; +const ccstd::string JOINTTEXTURE::NAME = "cc_jointTexture"; const gfx::DescriptorSetLayoutBinding JOINTTEXTURE::DESCRIPTOR = { JOINTTEXTURE::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -389,7 +389,7 @@ const gfx::UniformSamplerTexture JOINTTEXTURE::LAYOUT = { 1, }; -const ccstd::string POSITIONMORPH::NAME = "cc_PositionDisplacements"; +const ccstd::string POSITIONMORPH::NAME = "cc_PositionDisplacements"; const gfx::DescriptorSetLayoutBinding POSITIONMORPH::DESCRIPTOR = { POSITIONMORPH::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -405,7 +405,7 @@ const gfx::UniformSamplerTexture POSITIONMORPH::LAYOUT = { 1, }; -const ccstd::string NORMALMORPH::NAME = "cc_NormalDisplacements"; +const ccstd::string NORMALMORPH::NAME = "cc_NormalDisplacements"; const gfx::DescriptorSetLayoutBinding NORMALMORPH::DESCRIPTOR = { NORMALMORPH::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -421,7 +421,7 @@ const gfx::UniformSamplerTexture NORMALMORPH::LAYOUT = { 1, }; -const ccstd::string TANGENTMORPH::NAME = "cc_TangentDisplacements"; +const ccstd::string TANGENTMORPH::NAME = "cc_TangentDisplacements"; const gfx::DescriptorSetLayoutBinding TANGENTMORPH::DESCRIPTOR = { TANGENTMORPH::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -437,7 +437,7 @@ const gfx::UniformSamplerTexture TANGENTMORPH::LAYOUT = { 1, }; -const ccstd::string LIGHTMAPTEXTURE::NAME = "cc_lightingMap"; +const ccstd::string LIGHTMAPTEXTURE::NAME = "cc_lightingMap"; const gfx::DescriptorSetLayoutBinding LIGHTMAPTEXTURE::DESCRIPTOR = { LIGHTMAPTEXTURE::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -453,7 +453,7 @@ const gfx::UniformSamplerTexture LIGHTMAPTEXTURE::LAYOUT = { 1, }; -const ccstd::string SPRITETEXTURE::NAME = "cc_spriteTexture"; +const ccstd::string SPRITETEXTURE::NAME = "cc_spriteTexture"; const gfx::DescriptorSetLayoutBinding SPRITETEXTURE::DESCRIPTOR = { SPRITETEXTURE::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -469,7 +469,7 @@ const gfx::UniformSamplerTexture SPRITETEXTURE::LAYOUT = { 1, }; -const ccstd::string REFLECTIONTEXTURE::NAME = "cc_reflectionTexture"; +const ccstd::string REFLECTIONTEXTURE::NAME = "cc_reflectionTexture"; const gfx::DescriptorSetLayoutBinding REFLECTIONTEXTURE::DESCRIPTOR = { REFLECTIONTEXTURE::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -485,7 +485,7 @@ const gfx::UniformSamplerTexture REFLECTIONTEXTURE::LAYOUT = { 1, }; -const ccstd::string REFLECTIONSTORAGE::NAME = "cc_reflectionStorage"; +const ccstd::string REFLECTIONSTORAGE::NAME = "cc_reflectionStorage"; const gfx::DescriptorSetLayoutBinding REFLECTIONSTORAGE::DESCRIPTOR = { REFLECTIONSTORAGE::BINDING, gfx::DescriptorType::STORAGE_IMAGE, @@ -523,7 +523,7 @@ bool supportsR32FloatTexture(gfx::Device *device) { } static ccstd::unordered_map phases; //cjh how to clear this global variable when exiting game? -static uint32_t phaseNum = 0; +static uint32_t phaseNum = 0; uint getPhaseID(const ccstd::string &phaseName) { auto iter = phases.find(phaseName); diff --git a/native/cocos/renderer/pipeline/Define.h b/native/cocos/renderer/pipeline/Define.h index 22013a316e..613300305b 100644 --- a/native/cocos/renderer/pipeline/Define.h +++ b/native/cocos/renderer/pipeline/Define.h @@ -89,7 +89,7 @@ struct CC_DLL RenderPassDesc { using RenderPassDescList = ccstd::vector; struct CC_DLL RenderTextureDesc { - ccstd::string name; + ccstd::string name; gfx::TextureType type = gfx::TextureType::TEX2D; gfx::TextureUsage usage = gfx::TextureUsage::COLOR_ATTACHMENT; gfx::Format format = gfx::Format::UNKNOWN; @@ -100,7 +100,7 @@ using RenderTextureDescList = ccstd::vector; struct CC_DLL FrameBufferDesc { ccstd::string name; - uint renderPass = 0; + uint renderPass = 0; ccstd::vector colorTextures; ccstd::string depthStencilTexture; }; @@ -157,9 +157,9 @@ enum class CC_DLL RenderQueueSortMode { CC_ENUM_CONVERSION_OPERATOR(RenderQueueSortMode) struct CC_DLL RenderQueueDesc { - bool isTransparent = false; - RenderQueueSortMode sortMode = RenderQueueSortMode::FRONT_TO_BACK; - ccstd::vector stages; + bool isTransparent = false; + RenderQueueSortMode sortMode = RenderQueueSortMode::FRONT_TO_BACK; + ccstd::vector stages; }; using RenderQueueDescList = ccstd::vector; @@ -272,7 +272,7 @@ struct CC_DLL UBOLocalBatched { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOLocal { @@ -285,7 +285,7 @@ struct CC_DLL UBOLocal { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOWorldBound { @@ -296,7 +296,7 @@ struct CC_DLL UBOWorldBound { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOForwardLight { @@ -310,7 +310,7 @@ struct CC_DLL UBOForwardLight { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_FORWARD_LIGHTS); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBODeferredLight { @@ -324,7 +324,7 @@ struct CC_DLL UBOSkinningTexture { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOSkinningAnimation { @@ -334,7 +334,7 @@ struct CC_DLL UBOSkinningAnimation { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_ANIMATION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOSkinning { @@ -344,7 +344,7 @@ struct CC_DLL UBOSkinning { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOMorph { @@ -358,14 +358,14 @@ struct CC_DLL UBOMorph { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_MORPH); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOUILocal { static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_UI_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; enum class CC_DLL ForwardStagePriority { @@ -414,7 +414,7 @@ struct CC_DLL UBOGlobal { static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_GLOBAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOCamera { @@ -441,7 +441,7 @@ struct CC_DLL UBOCamera { static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_CAMERA); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL UBOShadow { @@ -461,11 +461,11 @@ struct CC_DLL UBOShadow { static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_SHADOW); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformBlock LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL DescriptorSetLayoutInfos { - gfx::DescriptorSetLayoutBindingList bindings; + gfx::DescriptorSetLayoutBindingList bindings; ccstd::unordered_map blocks; ccstd::unordered_map samplers; ccstd::unordered_map storeImages; @@ -504,84 +504,84 @@ struct CC_DLL SHADOWMAP { static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SHADOWMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL ENVIRONMENT { static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_ENVIRONMENT); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL SPOTLIGHTINGMAP { static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SPOT_LIGHTING_MAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL DIFFUSEMAP { static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_DIFFUSEMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL JOINTTEXTURE { static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_JOINTS); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL POSITIONMORPH { static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_POSITION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL NORMALMORPH { static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_NORMAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL TANGENTMORPH { static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_TANGENT); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL LIGHTMAPTEXTURE { static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_LIGHTMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL SPRITETEXTURE { static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_SPRITE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL REFLECTIONTEXTURE { static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_REFLECTION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformSamplerTexture LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; struct CC_DLL REFLECTIONSTORAGE { static constexpr uint BINDING = static_cast(ModelLocalBindings::STORAGE_REFLECTION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; static const gfx::UniformStorageImage LAYOUT; - static const ccstd::string NAME; + static const ccstd::string NAME; }; static constexpr uint CLUSTER_LIGHT_BINDING = 4; diff --git a/native/cocos/renderer/pipeline/RenderFlow.h b/native/cocos/renderer/pipeline/RenderFlow.h index 150299848d..576eb7a9b9 100644 --- a/native/cocos/renderer/pipeline/RenderFlow.h +++ b/native/cocos/renderer/pipeline/RenderFlow.h @@ -37,7 +37,7 @@ class RenderPipeline; class RenderStage; struct CC_DLL RenderFlowInfo { - ccstd::string name; + ccstd::string name; uint priority = 0; uint tag = 0; RenderStageList stages; @@ -54,13 +54,13 @@ public: virtual void destroy(); inline const ccstd::string &getName() const { return _name; } - inline uint getPriority() const { return _priority; } - inline uint getTag() const { return _tag; } - RenderStage * getRenderstageByName(const ccstd::string &name) const; + inline uint getPriority() const { return _priority; } + inline uint getTag() const { return _tag; } + RenderStage * getRenderstageByName(const ccstd::string &name) const; protected: RenderStageList _stages; - ccstd::string _name; + ccstd::string _name; RenderPipeline *_pipeline = nullptr; uint _priority = 0; uint _tag = 0; diff --git a/native/cocos/renderer/pipeline/RenderPipeline.h b/native/cocos/renderer/pipeline/RenderPipeline.h index e56767bbe0..4199c705ad 100644 --- a/native/cocos/renderer/pipeline/RenderPipeline.h +++ b/native/cocos/renderer/pipeline/RenderPipeline.h @@ -25,9 +25,9 @@ #pragma once -#include "base/std/container/string.h" #include "Define.h" #include "base/CoreStd.h" +#include "base/std/container/string.h" #include "base/std/container/unordered_map.h" #include "core/assets/Asset.h" #include "frame-graph/FrameGraph.h" @@ -75,27 +75,27 @@ public: virtual void render(const ccstd::vector &cameras); virtual void onGlobalPipelineStateChanged(); - inline const RenderFlowList & getFlows() const { return _flows; } - inline uint getTag() const { return _tag; } + inline const RenderFlowList & getFlows() const { return _flows; } + inline uint getTag() const { return _tag; } inline const ccstd::map &getGlobalBindings() const { return _globalBindings; } - inline const MacroRecord & getMacros() const { return _macros; } - inline void setValue(const ccstd::string &name, int32_t value) { _macros[name] = value; } - inline void setValue(const ccstd::string &name, bool value) { _macros[name] = value; } - inline void setValue(const ccstd::string &name, const ccstd::string &value) { _macros[name] = value; } - inline GlobalDSManager * getGlobalDSManager() const { return _globalDSManager; } - inline gfx::DescriptorSet * getDescriptorSet() const { return _descriptorSet; } - gfx::DescriptorSetLayout * getDescriptorSetLayout() const; - inline PipelineSceneData * getPipelineSceneData() const { return _pipelineSceneData; } - inline const gfx::CommandBufferList & getCommandBuffers() const { return _commandBuffers; } - inline const gfx::QueryPoolList & getQueryPools() const { return _queryPools; } - inline PipelineUBO * getPipelineUBO() const { return _pipelineUBO; } + inline const MacroRecord & getMacros() const { return _macros; } + inline void setValue(const ccstd::string &name, int32_t value) { _macros[name] = value; } + inline void setValue(const ccstd::string &name, bool value) { _macros[name] = value; } + inline void setValue(const ccstd::string &name, const ccstd::string &value) { _macros[name] = value; } + inline GlobalDSManager * getGlobalDSManager() const { return _globalDSManager; } + inline gfx::DescriptorSet * getDescriptorSet() const { return _descriptorSet; } + gfx::DescriptorSetLayout * getDescriptorSetLayout() const; + inline PipelineSceneData * getPipelineSceneData() const { return _pipelineSceneData; } + inline const gfx::CommandBufferList & getCommandBuffers() const { return _commandBuffers; } + inline const gfx::QueryPoolList & getQueryPools() const { return _queryPools; } + inline PipelineUBO * getPipelineUBO() const { return _pipelineUBO; } inline const ccstd::string & getConstantMacros() const { return _constantMacros; } - inline gfx::Device * getDevice() const { return _device; } - RenderStage * getRenderstageByName(const ccstd::string &name) const; - bool isOccluded(const scene::Camera *camera, const scene::SubModel *subModel); - bool isOcclusionQueryEnabled() const { return _occlusionQueryEnabled && _device->getCapabilities().supportQuery; } - void setOcclusionQueryEnabled(bool enable) { _occlusionQueryEnabled = enable; } - bool isEnvmapEnabled() const; + inline gfx::Device * getDevice() const { return _device; } + RenderStage * getRenderstageByName(const ccstd::string &name) const; + bool isOccluded(const scene::Camera *camera, const scene::SubModel *subModel); + bool isOcclusionQueryEnabled() const { return _occlusionQueryEnabled && _device->getCapabilities().supportQuery; } + void setOcclusionQueryEnabled(bool enable) { _occlusionQueryEnabled = enable; } + bool isEnvmapEnabled() const; gfx::Viewport getViewport(scene::Camera *camera); gfx::Rect getScissor(scene::Camera *camera); @@ -129,12 +129,12 @@ protected: static void framegraphGC(); - gfx::CommandBufferList _commandBuffers; - gfx::QueryPoolList _queryPools; - RenderFlowList _flows; + gfx::CommandBufferList _commandBuffers; + gfx::QueryPoolList _queryPools; + RenderFlowList _flows; ccstd::map _globalBindings; - MacroRecord _macros; - uint _tag = 0; + MacroRecord _macros; + uint _tag = 0; ccstd::string _constantMacros; gfx::Device * _device{nullptr}; diff --git a/native/cocos/renderer/pipeline/RenderStage.h b/native/cocos/renderer/pipeline/RenderStage.h index 3117cd9fa2..02b3485f12 100644 --- a/native/cocos/renderer/pipeline/RenderStage.h +++ b/native/cocos/renderer/pipeline/RenderStage.h @@ -42,7 +42,7 @@ class RenderPipeline; class RenderQueue; struct CC_DLL RenderStageInfo { - ccstd::string name; + ccstd::string name; uint priority = 0; uint tag = 0; RenderQueueDescList renderQueues; @@ -60,9 +60,9 @@ public: virtual void render(scene::Camera *camera) = 0; inline const ccstd::string &getName() const { return _name; } - inline uint getPriority() const { return _priority; } - inline uint getTag() const { return _tag; } - inline RenderFlow * getFlow() const { return _flow; } + inline uint getPriority() const { return _priority; } + inline uint getTag() const { return _tag; } + inline RenderFlow * getFlow() const { return _flow; } protected: gfx::Rect _renderArea; @@ -73,7 +73,7 @@ protected: RenderPipeline * _pipeline = nullptr; RenderFlow * _flow = nullptr; gfx::Device * _device = nullptr; - ccstd::string _name; + ccstd::string _name; uint _priority = 0; uint _tag = 0; gfx::ColorList _clearColors = {{0.0F, 0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, 0.0F, 0.0F}}; diff --git a/native/cocos/renderer/pipeline/deferred/LightingStage.cpp b/native/cocos/renderer/pipeline/deferred/LightingStage.cpp index 54457e04b4..fbba36e051 100644 --- a/native/cocos/renderer/pipeline/deferred/LightingStage.cpp +++ b/native/cocos/renderer/pipeline/deferred/LightingStage.cpp @@ -51,7 +51,7 @@ namespace cc { namespace pipeline { namespace { -const ccstd::string STAGE_NAME = "LightingStage"; +const ccstd::string STAGE_NAME = "LightingStage"; const uint MAX_REFLECTOR_SIZE = 5; framegraph::StringHandle reflectTexHandle = framegraph::FrameGraph::stringToHandle("reflectionTex"); framegraph::StringHandle denoiseTexHandle[MAX_REFLECTOR_SIZE]; diff --git a/native/cocos/renderer/pipeline/deferred/ReflectionComp.h b/native/cocos/renderer/pipeline/deferred/ReflectionComp.h index a5750a8cf6..90e746e282 100644 --- a/native/cocos/renderer/pipeline/deferred/ReflectionComp.h +++ b/native/cocos/renderer/pipeline/deferred/ReflectionComp.h @@ -23,57 +23,57 @@ class ReflectionComp { public: ReflectionComp() = default; ~ReflectionComp(); - void init(gfx::Device* dev, uint groupSizeX, uint groupSizeY); + void init(gfx::Device *dev, uint groupSizeX, uint groupSizeY); void getReflectorShader(ShaderSources &sources, bool useEnvmap) const; void getDenoiseShader(ShaderSources &sources, bool useEnvmap) const; void initReflectionRes(); void initDenoiseRes(); void initDenoiseResEnvmap(); void applyTexSize(uint width, uint height, const Mat4 &matView, - const Mat4& matViewProj, const Mat4& matViewProjInv, - const Mat4& matProjInv, const Vec4 &viewPort); + const Mat4 &matViewProj, const Mat4 &matViewProjInv, + const Mat4 &matProjInv, const Vec4 &viewPort); - inline gfx::DescriptorSet* getDescriptorSet() { return _compDescriptorSet; } - inline const gfx::PipelineState* getPipelineState(bool useEnvmap) { return _compPipelineState[useEnvmap]; } - inline gfx::DescriptorSet* getDenoiseDescriptorSet() { return _compDenoiseDescriptorSet; } - inline const gfx::PipelineState* getDenoisePipelineState(bool useEnvmap) { return _compDenoisePipelineState[useEnvmap]; } - inline const gfx::PipelineState* getDenoisePipelineStateEnvmap() { return _compDenoisePipelineStateEnvmap; } - inline const gfx::GeneralBarrier* getBarrierPre() { return _barrierPre; } - inline const gfx::TextureBarrierList& getBarrierBeforeDenoise() { return _barrierBeforeDenoise; } - inline const gfx::TextureBarrierList& getBarrierAfterDenoise() { return _barrierAfterDenoise; } - inline const gfx::DispatchInfo& getDispatchInfo() { return _dispatchInfo; } - inline const gfx::DispatchInfo& getDenoiseDispatchInfo() { return _denoiseDispatchInfo; } - inline uint getGroupSizeX() const { return _groupSizeX; } - inline uint getGroupSizeY() const { return _groupSizeY; } + inline gfx::DescriptorSet * getDescriptorSet() { return _compDescriptorSet; } + inline const gfx::PipelineState * getPipelineState(bool useEnvmap) { return _compPipelineState[useEnvmap]; } + inline gfx::DescriptorSet * getDenoiseDescriptorSet() { return _compDenoiseDescriptorSet; } + inline const gfx::PipelineState * getDenoisePipelineState(bool useEnvmap) { return _compDenoisePipelineState[useEnvmap]; } + inline const gfx::PipelineState * getDenoisePipelineStateEnvmap() { return _compDenoisePipelineStateEnvmap; } + inline const gfx::GeneralBarrier * getBarrierPre() { return _barrierPre; } + inline const gfx::TextureBarrierList &getBarrierBeforeDenoise() { return _barrierBeforeDenoise; } + inline const gfx::TextureBarrierList &getBarrierAfterDenoise() { return _barrierAfterDenoise; } + inline const gfx::DispatchInfo & getDispatchInfo() { return _dispatchInfo; } + inline const gfx::DispatchInfo & getDenoiseDispatchInfo() { return _denoiseDispatchInfo; } + inline uint getGroupSizeX() const { return _groupSizeX; } + inline uint getGroupSizeY() const { return _groupSizeY; } - inline gfx::Buffer* getConstantsBuffer() { return _compConstantsBuffer; } - inline gfx::Sampler* getSampler() { return _sampler; } + inline gfx::Buffer * getConstantsBuffer() { return _compConstantsBuffer; } + inline gfx::Sampler *getSampler() { return _sampler; } private: template - T& getAppropriateShaderSource(ShaderSources& sources); + T &getAppropriateShaderSource(ShaderSources &sources); - gfx::Device* _device{nullptr}; + gfx::Device *_device{nullptr}; - gfx::Shader* _compShader[2]{nullptr}; - gfx::DescriptorSetLayout* _compDescriptorSetLayout{nullptr}; - gfx::PipelineLayout* _compPipelineLayout{nullptr}; - gfx::PipelineState* _compPipelineState[2]{nullptr}; - gfx::DescriptorSet* _compDescriptorSet{nullptr}; + gfx::Shader * _compShader[2]{nullptr}; + gfx::DescriptorSetLayout *_compDescriptorSetLayout{nullptr}; + gfx::PipelineLayout * _compPipelineLayout{nullptr}; + gfx::PipelineState * _compPipelineState[2]{nullptr}; + gfx::DescriptorSet * _compDescriptorSet{nullptr}; - gfx::Shader* _compDenoiseShader[2]{nullptr}; - gfx::DescriptorSetLayout* _compDenoiseDescriptorSetLayout{nullptr}; - gfx::PipelineLayout* _compDenoisePipelineLayout{nullptr}; - gfx::PipelineState* _compDenoisePipelineState[2]{nullptr}; - gfx::PipelineState* _compDenoisePipelineStateEnvmap{nullptr}; - gfx::DescriptorSet* _compDenoiseDescriptorSet{nullptr}; + gfx::Shader * _compDenoiseShader[2]{nullptr}; + gfx::DescriptorSetLayout *_compDenoiseDescriptorSetLayout{nullptr}; + gfx::PipelineLayout * _compDenoisePipelineLayout{nullptr}; + gfx::PipelineState * _compDenoisePipelineState[2]{nullptr}; + gfx::PipelineState * _compDenoisePipelineStateEnvmap{nullptr}; + gfx::DescriptorSet * _compDenoiseDescriptorSet{nullptr}; - gfx::DescriptorSetLayout* _localDescriptorSetLayout{nullptr}; + gfx::DescriptorSetLayout *_localDescriptorSetLayout{nullptr}; - gfx::Buffer* _compConstantsBuffer{nullptr}; - gfx::Sampler* _sampler{nullptr}; + gfx::Buffer * _compConstantsBuffer{nullptr}; + gfx::Sampler *_sampler{nullptr}; - gfx::GeneralBarrier* _barrierPre{nullptr}; + gfx::GeneralBarrier *_barrierPre{nullptr}; gfx::TextureBarrierList _barrierBeforeDenoise; gfx::TextureBarrierList _barrierAfterDenoise; diff --git a/native/cocos/scene/Camera.h b/native/cocos/scene/Camera.h index b9ba3504d8..3e31fade0e 100644 --- a/native/cocos/scene/Camera.h +++ b/native/cocos/scene/Camera.h @@ -26,10 +26,10 @@ #pragma once #include -#include "base/std/container/string.h" #include "base/Macros.h" #include "base/Ptr.h" #include "base/RefCounted.h" +#include "base/std/container/string.h" #include "cocos/base/Optional.h" #include "cocos/math/Utils.h" #include "core/geometry/Frustum.h" @@ -116,11 +116,11 @@ enum class CameraShutter { struct ICameraInfo { ccstd::string name; - Node * node{nullptr}; - CameraProjection projection; - cc::optional targetDisplay; - RenderWindow * window{nullptr}; - uint32_t priority{0}; + Node * node{nullptr}; + CameraProjection projection; + cc::optional targetDisplay; + RenderWindow * window{nullptr}; + uint32_t priority{0}; cc::optional pipeline; }; @@ -232,16 +232,16 @@ public: void setViewport(const Vec4 &val); void setViewportInOrientedSpace(const Vec4 &val); - inline RenderScene * getScene() const { return _scene; } + inline RenderScene * getScene() const { return _scene; } inline const ccstd::string &getName() const { return _name; } - inline uint32_t getWidth() const { return _width; } - inline uint32_t getHeight() const { return _height; } - inline float getAspect() const { return _aspect; } - inline const Mat4 & getMatView() const { return _matView; } - inline const Mat4 & getMatProj() const { return _matProj; } - inline const Mat4 & getMatProjInv() const { return _matProjInv; } - inline const Mat4 & getMatViewProj() const { return _matViewProj; } - inline const Mat4 & getMatViewProjInv() const { return _matViewProjInv; } + inline uint32_t getWidth() const { return _width; } + inline uint32_t getHeight() const { return _height; } + inline float getAspect() const { return _aspect; } + inline const Mat4 & getMatView() const { return _matView; } + inline const Mat4 & getMatProj() const { return _matProj; } + inline const Mat4 & getMatProjInv() const { return _matProjInv; } + inline const Mat4 & getMatViewProj() const { return _matViewProj; } + inline const Mat4 & getMatViewProjInv() const { return _matViewProjInv; } inline void setFrustum(const geometry::Frustum &val) { *_frustum = val; @@ -326,7 +326,7 @@ private: gfx::Device * _device{nullptr}; RenderScene * _scene{nullptr}; IntrusivePtr _node; - ccstd::string _name; + ccstd::string _name; bool _enabled{false}; CameraProjection _proj{CameraProjection::UNKNOWN}; float _aspect{0.F}; @@ -363,7 +363,7 @@ private: float _clearDepth{1.0F}; IntrusivePtr _geometryRenderer; - + static const ccstd::vector FSTOPS; static const ccstd::vector SHUTTERS; static const ccstd::vector ISOS; diff --git a/native/cocos/scene/Define.h b/native/cocos/scene/Define.h index 85d3241f91..be3e6999c5 100644 --- a/native/cocos/scene/Define.h +++ b/native/cocos/scene/Define.h @@ -33,7 +33,7 @@ namespace scene { struct IMacroPatch { ccstd::string name; - MacroValue value; + MacroValue value; }; } // namespace scene diff --git a/native/cocos/scene/Light.h b/native/cocos/scene/Light.h index d6694b4aad..2dae3ca2d1 100644 --- a/native/cocos/scene/Light.h +++ b/native/cocos/scene/Light.h @@ -25,9 +25,9 @@ #pragma once -#include "base/std/container/string.h" #include "base/Ptr.h" #include "base/RefCounted.h" +#include "base/std/container/string.h" #include "math/Vec3.h" namespace cc { @@ -79,7 +79,7 @@ public: inline void setType(LightType type) { _type = type; } inline const ccstd::string &getName() const { return _name; } - inline void setName(const ccstd::string &name) { _name = name; } + inline void setName(const ccstd::string &name) { _name = name; } inline RenderScene *getScene() const { return _scene; } @@ -94,7 +94,7 @@ protected: IntrusivePtr _node; float _colorTemp{6550.F}; LightType _type{LightType::UNKNOWN}; - ccstd::string _name; + ccstd::string _name; RenderScene * _scene{nullptr}; Vec3 _color{1, 1, 1}; Vec3 _colorTemperatureRGB; diff --git a/native/cocos/scene/Model.cpp b/native/cocos/scene/Model.cpp index f371ae644d..652559beb0 100644 --- a/native/cocos/scene/Model.cpp +++ b/native/cocos/scene/Model.cpp @@ -105,7 +105,7 @@ const cc::gfx::SamplerInfo LIGHTMAP_SAMPLER_WITH_MIP_HASH{ }; const ccstd::vector SHADOW_MAP_PATCHES{{"CC_RECEIVE_SHADOW", true}}; -const ccstd::string INST_MAT_WORLD = "a_matWorld0"; +const ccstd::string INST_MAT_WORLD = "a_matWorld0"; } // namespace namespace cc { diff --git a/native/cocos/scene/Pass.cpp b/native/cocos/scene/Pass.cpp index c062ad67ed..184a2639c0 100644 --- a/native/cocos/scene/Pass.cpp +++ b/native/cocos/scene/Pass.cpp @@ -109,14 +109,14 @@ void Pass::fillPipelineInfo(Pass *pass, const IPassInfoFull &info) { /* static */ uint64_t Pass::getPassHash(Pass *pass) { const ccstd::string &shaderKey = ProgramLib::getInstance()->getKey(pass->getProgram(), pass->getDefines()); - std::stringstream res; + std::stringstream res; res << shaderKey << "," << static_cast(pass->_primitive) << "," << static_cast(pass->_dynamicStates); res << serializeBlendState(pass->_blendState); res << serializeDepthStencilState(pass->_depthStencilState); res << serializeRasterizerState(pass->_rs); ccstd::string str{res.str()}; - std::size_t seed = 666; + std::size_t seed = 666; boost::hash_range(seed, str.begin(), str.end()); return static_cast(seed); } @@ -322,12 +322,12 @@ void Pass::resetTexture(const ccstd::string &name, index_t index /* = CC_INVALID } const gfx::Type type = Pass::getTypeFromHandle(handle); const uint32_t binding = Pass::getBindingFromHandle(handle); - ccstd::string texName; + ccstd::string texName; IPropertyInfo * info = nullptr; auto iter = _properties.find(name); if (iter != _properties.end()) { if (iter->second.value.has_value()) { - info = &iter->second; + info = &iter->second; ccstd::string *pStrVal = cc::get_if(&iter->second.value.value()); if (pStrVal != nullptr) { texName = (*pStrVal) + "-texture"; @@ -562,8 +562,8 @@ void Pass::doInit(const IPassInfoFull &info, bool /*copyDefines*/ /* = false */) _descriptorSet->bindBuffer(binding, bufferView); } // store handles - _propertyHandleMap = handleMap; - auto & directHandleMap = _propertyHandleMap; + _propertyHandleMap = handleMap; + auto & directHandleMap = _propertyHandleMap; Record indirectHandleMap; for (const auto &properties : _properties) { if (!properties.second.handleInfo.has_value()) { diff --git a/native/cocos/scene/Pass.h b/native/cocos/scene/Pass.h index 35d08e5d91..1a64f20680 100644 --- a/native/cocos/scene/Pass.h +++ b/native/cocos/scene/Pass.h @@ -26,10 +26,10 @@ #pragma once #include -#include "base/std/container/string.h" #include "base/Ptr.h" #include "base/RefCounted.h" #include "base/TypeDef.h" +#include "base/std/container/string.h" #include "core/ArrayBuffer.h" #include "core/TypedArray.h" #include "core/assets/EffectAsset.h" @@ -261,16 +261,16 @@ public: IPassInfoFull getPassInfoFull() const; // infos - inline Root * getRoot() const { return _root; } - inline gfx::Device * getDevice() const { return _device; } - inline IProgramInfo * getShaderInfo() const { return _shaderInfo; } - gfx::DescriptorSetLayout * getLocalSetLayout() const; + inline Root * getRoot() const { return _root; } + inline gfx::Device * getDevice() const { return _device; } + inline IProgramInfo * getShaderInfo() const { return _shaderInfo; } + gfx::DescriptorSetLayout * getLocalSetLayout() const; inline const ccstd::string & getProgram() const { return _programName; } inline const Record &getProperties() const { return _properties; } - inline const MacroRecord & getDefines() const { return _defines; } - inline MacroRecord & getDefines() { return _defines; } - inline index_t getPassIndex() const { return _passIndex; } - inline index_t getPropertyIndex() const { return _propertyIndex; } + inline const MacroRecord & getDefines() const { return _defines; } + inline MacroRecord & getDefines() { return _defines; } + inline index_t getPassIndex() const { return _passIndex; } + inline index_t getPropertyIndex() const { return _propertyIndex; } // data inline const IPassDynamics & getDynamics() const { return _dynamics; } inline const ccstd::vector &getBlocks() const { return _blocks; } @@ -317,17 +317,17 @@ protected: IntrusivePtr _descriptorSet; IntrusivePtr _pipelineLayout; // internal data - index_t _passIndex{0}; - index_t _propertyIndex{0}; + index_t _passIndex{0}; + index_t _propertyIndex{0}; ccstd::string _programName; - IPassDynamics _dynamics; + IPassDynamics _dynamics; Record _propertyHandleMap; - IntrusivePtr _rootBlock; - ccstd::vector _blocks; // Point to position in _rootBlock + IntrusivePtr _rootBlock; + ccstd::vector _blocks; // Point to position in _rootBlock IProgramInfo * _shaderInfo; // weakref to template of ProgramLib MacroRecord _defines; - Record _properties; + Record _properties; IntrusivePtr _shader; gfx::BlendState _blendState{}; gfx::DepthStencilState _depthStencilState{}; @@ -335,7 +335,7 @@ protected: pipeline::RenderPriority _priority{pipeline::RenderPriority::DEFAULT}; pipeline::RenderPassStage _stage{pipeline::RenderPassStage::DEFAULT}; uint32_t _phase{0}; - ccstd::string _phaseString; + ccstd::string _phaseString; gfx::PrimitiveMode _primitive{gfx::PrimitiveMode::TRIANGLE_LIST}; BatchingSchemes _batchingScheme{BatchingSchemes::NONE}; gfx::DynamicStateFlagBit _dynamicStates{gfx::DynamicStateFlagBit::NONE}; diff --git a/native/cocos/scene/RenderScene.h b/native/cocos/scene/RenderScene.h index aef6512728..0f458c8fab 100644 --- a/native/cocos/scene/RenderScene.h +++ b/native/cocos/scene/RenderScene.h @@ -25,11 +25,11 @@ #pragma once -#include "base/std/container/string.h" #include "base/Macros.h" #include "base/Ptr.h" #include "base/RefCounted.h" #include "base/TypeDef.h" +#include "base/std/container/string.h" #include "base/std/container/vector.h" namespace cc { @@ -99,7 +99,7 @@ public: void setMainLight(DirectionalLight *dl); inline uint64_t generateModelId() { return _modelId++; } - inline const ccstd::string & getName() const { return _name; } + inline const ccstd::string & getName() const { return _name; } inline const ccstd::vector> & getCameras() const { return _cameras; } inline const ccstd::vector> &getSphereLights() const { return _sphereLights; } inline const ccstd::vector> & getSpotLights() const { return _spotLights; } @@ -111,7 +111,7 @@ public: inline const ccstd::vector &getDrawBatch2Ds() const { return _batches; } private: - ccstd::string _name; + ccstd::string _name; uint64_t _modelId{0}; IntrusivePtr _mainLight; ccstd::vector> _models; diff --git a/native/cocos/scene/RenderWindow.h b/native/cocos/scene/RenderWindow.h index 7eaeec6d16..bf66f867ac 100644 --- a/native/cocos/scene/RenderWindow.h +++ b/native/cocos/scene/RenderWindow.h @@ -36,10 +36,10 @@ class Camera; struct IRenderWindowInfo { cc::optional title; - uint32_t width{0}; - uint32_t height{0}; - gfx::RenderPassInfo renderPassInfo; - gfx::Swapchain * swapchain{nullptr}; + uint32_t width{0}; + uint32_t height{0}; + gfx::RenderPassInfo renderPassInfo; + gfx::Swapchain * swapchain{nullptr}; }; /** @@ -120,7 +120,7 @@ private: uint32_t _width{1}; uint32_t _height{1}; gfx::Swapchain * _swapchain{nullptr}; - ccstd::string _title; + ccstd::string _title; IntrusivePtr _renderPass; IntrusivePtr _depthStencilTexture; IntrusivePtr _frameBuffer; diff --git a/native/cocos/scene/Skybox.cpp b/native/cocos/scene/Skybox.cpp index e2dea04d64..d0fcb4c3fb 100644 --- a/native/cocos/scene/Skybox.cpp +++ b/native/cocos/scene/Skybox.cpp @@ -36,8 +36,8 @@ #include "renderer/core/MaterialInstance.h" #include "renderer/core/PassUtils.h" #include "renderer/gfx-base/GFXDevice.h" -#include "renderer/pipeline/custom/RenderInterfaceTypes.h" #include "renderer/pipeline/PipelineSceneData.h" +#include "renderer/pipeline/custom/RenderInterfaceTypes.h" #include "scene/Ambient.h" #include "scene/Model.h" @@ -289,8 +289,8 @@ void Skybox::updatePipeline() const { _model->setSubModelMaterial(0, skyboxMaterial); } - Root * root = Root::getInstance(); - auto * pipeline = root->getPipeline(); + Root *root = Root::getInstance(); + auto *pipeline = root->getPipeline(); const bool useRGBE = isRGBE(); const int32_t useIBLValue = isUseIBL() ? (useRGBE ? 2 : 1) : 0; @@ -298,7 +298,7 @@ void Skybox::updatePipeline() const { const bool useHDRValue = isUseHDR(); bool valueChanged = false; - auto iter = pipeline->getMacros().find("CC_USE_IBL"); + auto iter = pipeline->getMacros().find("CC_USE_IBL"); if (iter != pipeline->getMacros().end()) { const MacroValue ¯oIBL = iter->second; const int32_t * macroIBLPtr = cc::get_if(¯oIBL); @@ -330,7 +330,7 @@ void Skybox::updatePipeline() const { if (valueChanged) { root->onGlobalPipelineStateChanged(); - } + } } void Skybox::updateGlobalBinding() { diff --git a/native/cocos/storage/local-storage/LocalStorage.h b/native/cocos/storage/local-storage/LocalStorage.h index c578389648..5efc54f2e3 100644 --- a/native/cocos/storage/local-storage/LocalStorage.h +++ b/native/cocos/storage/local-storage/LocalStorage.h @@ -28,8 +28,8 @@ #ifndef __JSB_LOCALSTORAGE_H #define __JSB_LOCALSTORAGE_H -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" /** * @addtogroup storage diff --git a/native/cocos/ui/edit-box/EditBox-win32.cpp b/native/cocos/ui/edit-box/EditBox-win32.cpp index bf1a13de32..8fd35a9eaa 100644 --- a/native/cocos/ui/edit-box/EditBox-win32.cpp +++ b/native/cocos/ui/edit-box/EditBox-win32.cpp @@ -100,7 +100,7 @@ ccstd::string getText(HWND hwnd) { GetWindowText(hwnd, str, length + 1); std::wstring_convert> convert; - ccstd::string ret(convert.to_bytes(str)); + ccstd::string ret(convert.to_bytes(str)); free(str); return ret; diff --git a/native/cocos/ui/edit-box/EditBox.h b/native/cocos/ui/edit-box/EditBox.h index a355c40036..630d49f478 100644 --- a/native/cocos/ui/edit-box/EditBox.h +++ b/native/cocos/ui/edit-box/EditBox.h @@ -25,8 +25,8 @@ #pragma once -#include "base/std/container/string.h" #include "base/Macros.h" +#include "base/std/container/string.h" namespace cc { @@ -41,13 +41,13 @@ public: ccstd::string defaultValue; ccstd::string confirmType; ccstd::string inputType; - int maxLength = 0; - int x = 0; - int y = 0; - int width = 0; - int height = 0; - bool confirmHold = false; - bool isMultiline = false; + int maxLength = 0; + int x = 0; + int y = 0; + int width = 0; + int height = 0; + bool confirmHold = false; + bool isMultiline = false; //NEW PROPERTIES uint32_t fontSize = 20; uint32_t fontColor = 0x00000000; diff --git a/native/cocos/ui/videoplayer/VideoPlayer.h b/native/cocos/ui/videoplayer/VideoPlayer.h index f33fe276e5..b4709ae7d0 100644 --- a/native/cocos/ui/videoplayer/VideoPlayer.h +++ b/native/cocos/ui/videoplayer/VideoPlayer.h @@ -27,10 +27,10 @@ #pragma once #include -#include "base/std/container/string.h" #include "base/Macros.h" #include "base/RefCounted.h" #include "base/std/container/map.h" +#include "base/std/container/string.h" #ifndef OBJC_CLASS #ifdef __OBJC__ @@ -164,9 +164,9 @@ protected: bool _keepAspectRatioEnabled; ccstd::string _videoURL; - Source _videoSource; + Source _videoSource; - int _videoPlayerIndex; + int _videoPlayerIndex; ccstd::map _eventCallback; void *_videoView; diff --git a/native/cocos/ui/webview/WebView-inl.h b/native/cocos/ui/webview/WebView-inl.h index 99604a9c81..867ca42f8c 100644 --- a/native/cocos/ui/webview/WebView-inl.h +++ b/native/cocos/ui/webview/WebView-inl.h @@ -25,8 +25,8 @@ ****************************************************************************/ #include "WebView.h" -#include "platform/FileUtils.h" #include "base/memory/Memory.h" +#include "platform/FileUtils.h" #if CC_PLATFORM == CC_PLATFORM_MAC_IOS #include "WebViewImpl-ios.h" @@ -63,7 +63,7 @@ void WebView::setJavascriptInterfaceScheme(const ccstd::string &scheme) { _impl->setJavascriptInterfaceScheme(scheme); } -void WebView::loadData(const cc::Data & data, +void WebView::loadData(const cc::Data & data, const ccstd::string &MIMEType, const ccstd::string &encoding, const ccstd::string &baseURL) { @@ -148,7 +148,7 @@ void WebView::setOnJSCallback(const ccWebViewCallback &callback) { } std::function WebView::getOnShouldStartLoading() const { diff --git a/native/cocos/ui/webview/WebView.h b/native/cocos/ui/webview/WebView.h index be3aa91eda..f45c469617 100644 --- a/native/cocos/ui/webview/WebView.h +++ b/native/cocos/ui/webview/WebView.h @@ -71,7 +71,7 @@ public: * @param encoding The encoding of the data. * @param baseURL The base URL for the content. */ - void loadData(const cc::Data & data, + void loadData(const cc::Data & data, const ccstd::string &mimeType, const ccstd::string &encoding, const ccstd::string &baseURL); diff --git a/native/cocos/ui/webview/WebViewImpl-android.cpp b/native/cocos/ui/webview/WebViewImpl-android.cpp index d89215f612..0f3b1e2fd0 100644 --- a/native/cocos/ui/webview/WebViewImpl-android.cpp +++ b/native/cocos/ui/webview/WebViewImpl-android.cpp @@ -72,7 +72,7 @@ extern "C" { JNIEXPORT jboolean JNICALL Java_com_cocos_lib_CocosWebViewHelper_shouldStartLoading(JNIEnv *env, jclass, jint index, //NOLINT jstring jurl) { - auto charUrl = env->GetStringUTFChars(jurl, nullptr); + auto charUrl = env->GetStringUTFChars(jurl, nullptr); ccstd::string url = charUrl; env->ReleaseStringUTFChars(jurl, charUrl); return cc::WebViewImpl::shouldStartLoading(index, url); @@ -87,7 +87,7 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosWebViewHelper_didFinishLoading(JNIEnv *env, jclass, jint index, //NOLINT jstring jurl) { // LOGD("didFinishLoading"); - auto charUrl = env->GetStringUTFChars(jurl, nullptr); + auto charUrl = env->GetStringUTFChars(jurl, nullptr); ccstd::string url = charUrl; env->ReleaseStringUTFChars(jurl, charUrl); cc::WebViewImpl::didFinishLoading(index, url); @@ -102,7 +102,7 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosWebViewHelper_didFailLoading(JNIEnv *env, jclass, jint index, //NOLINT jstring jurl) { // LOGD("didFailLoading"); - auto charUrl = env->GetStringUTFChars(jurl, nullptr); + auto charUrl = env->GetStringUTFChars(jurl, nullptr); ccstd::string url = charUrl; env->ReleaseStringUTFChars(jurl, charUrl); cc::WebViewImpl::didFailLoading(index, url); @@ -117,7 +117,7 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosWebViewHelper_onJsCallback(JNIEnv *env, jclass, jint index, //NOLINT jstring jmessage) { // LOGD("jsCallback"); - auto charMessage = env->GetStringUTFChars(jmessage, nullptr); + auto charMessage = env->GetStringUTFChars(jmessage, nullptr); ccstd::string message = charMessage; env->ReleaseStringUTFChars(jmessage, charMessage); cc::WebViewImpl::onJsCallback(index, message); @@ -173,7 +173,7 @@ WebViewImpl::~WebViewImpl() { void WebViewImpl::loadData(const Data &data, const ccstd::string &mimeType, const ccstd::string &encoding, const ccstd::string &baseURL) { ccstd::string dataString(reinterpret_cast(data.getBytes()), - static_cast(data.getSize())); + static_cast(data.getSize())); JniHelper::callStaticVoidMethod(CLASS_NAME, "setJavascriptInterfaceScheme", _viewTag, dataString, mimeType, encoding, baseURL); } diff --git a/native/cocos/ui/webview/WebViewImpl-ios.h b/native/cocos/ui/webview/WebViewImpl-ios.h index 175c88feab..53132e5fb6 100644 --- a/native/cocos/ui/webview/WebViewImpl-ios.h +++ b/native/cocos/ui/webview/WebViewImpl-ios.h @@ -46,7 +46,7 @@ public: void setJavascriptInterfaceScheme(const ccstd::string &scheme); - void loadData(const cc::Data & data, + void loadData(const cc::Data & data, const ccstd::string &MIMEType, const ccstd::string &encoding, const ccstd::string &baseURL); diff --git a/native/cocos/ui/webview/WebViewImpl-ohos.cpp b/native/cocos/ui/webview/WebViewImpl-ohos.cpp index 301b5f15f7..778fb4662b 100644 --- a/native/cocos/ui/webview/WebViewImpl-ohos.cpp +++ b/native/cocos/ui/webview/WebViewImpl-ohos.cpp @@ -74,7 +74,7 @@ extern "C" { JNIEXPORT jboolean JNICALL Java_com_cocos_lib_CocosWebViewHelper_shouldStartLoading(JNIEnv *env, jclass, jint index, //NOLINT jstring jurl) { - auto charUrl = env->GetStringUTFChars(jurl, nullptr); + auto charUrl = env->GetStringUTFChars(jurl, nullptr); ccstd::string url = charUrl; env->ReleaseStringUTFChars(jurl, charUrl); return cc::WebViewImpl::shouldStartLoading(index, url); @@ -89,7 +89,7 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosWebViewHelper_didFinishLoading(JNIEnv *env, jclass, jint index, //NOLINT jstring jurl) { // LOGD("didFinishLoading"); - auto charUrl = env->GetStringUTFChars(jurl, nullptr); + auto charUrl = env->GetStringUTFChars(jurl, nullptr); ccstd::string url = charUrl; env->ReleaseStringUTFChars(jurl, charUrl); cc::WebViewImpl::didFinishLoading(index, url); @@ -104,7 +104,7 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosWebViewHelper_didFailLoading(JNIEnv *env, jclass, jint index, //NOLINT jstring jurl) { // LOGD("didFailLoading"); - auto charUrl = env->GetStringUTFChars(jurl, nullptr); + auto charUrl = env->GetStringUTFChars(jurl, nullptr); ccstd::string url = charUrl; env->ReleaseStringUTFChars(jurl, charUrl); cc::WebViewImpl::didFailLoading(index, url); @@ -119,7 +119,7 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosWebViewHelper_onJsCallback(JNIEnv *env, jclass, jint index, //NOLINT jstring jmessage) { // LOGD("jsCallback"); - auto charMessage = env->GetStringUTFChars(jmessage, nullptr); + auto charMessage = env->GetStringUTFChars(jmessage, nullptr); ccstd::string message = charMessage; env->ReleaseStringUTFChars(jmessage, charMessage); cc::WebViewImpl::onJsCallback(index, message); @@ -175,7 +175,7 @@ WebViewImpl::~WebViewImpl() { void WebViewImpl::loadData(const Data &data, const ccstd::string &mimeType, const ccstd::string &encoding, const ccstd::string &baseURL) { ccstd::string dataString(reinterpret_cast(data.getBytes()), - static_cast(data.getSize())); + static_cast(data.getSize())); JniHelper::callStaticVoidMethod(CLASS_NAME, "setJavascriptInterfaceScheme", _viewTag, dataString, mimeType, encoding, baseURL); }