mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
[ci skip][AUTO]: Automated clang-format update: 771de57fc2c1edbaaf3ae94e77f9801b0379cc6c (#10469) (#10472)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
This commit is contained in:
@@ -160,7 +160,7 @@ private:
|
||||
};
|
||||
|
||||
struct GpuMorphAttribute {
|
||||
ccstd::string attributeName;
|
||||
ccstd::string attributeName;
|
||||
IntrusivePtr<MorphTexture> morphTexture;
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ struct CpuMorphAttributeTarget {
|
||||
using CpuMorphAttributeTargetList = ccstd::vector<CpuMorphAttributeTarget>;
|
||||
|
||||
struct CpuMorphAttribute {
|
||||
ccstd::string name;
|
||||
ccstd::string name;
|
||||
CpuMorphAttributeTargetList targets;
|
||||
};
|
||||
|
||||
|
||||
@@ -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<uint32_t>(seed);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
bool validate() const override;
|
||||
|
||||
private:
|
||||
ccstd::vector<ccstd::string> _joints;
|
||||
ccstd::vector<ccstd::string> _joints;
|
||||
ccstd::vector<Mat4> _bindposes;
|
||||
cc::optional<ccstd::vector<Mat4>> _invBindposes;
|
||||
uint64_t _hash{0};
|
||||
|
||||
@@ -40,7 +40,7 @@ Record<gfx::FormatType, ccstd::string> 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 {
|
||||
|
||||
@@ -178,10 +178,10 @@ cc::optional<IJointTextureHandle *> JointTexturePool::getDefaultPoseTexture(Skel
|
||||
}
|
||||
|
||||
const ccstd::vector<ccstd::string> &joints = skeleton->getJoints();
|
||||
const ccstd::vector<Mat4> & bindPoses = skeleton->getBindposes();
|
||||
Float32Array textureBuffer;
|
||||
bool buildTexture = false;
|
||||
auto jointCount = static_cast<uint32_t>(joints.size());
|
||||
const ccstd::vector<Mat4> & bindPoses = skeleton->getBindposes();
|
||||
Float32Array textureBuffer;
|
||||
bool buildTexture = false;
|
||||
auto jointCount = static_cast<uint32_t>(joints.size());
|
||||
if (!texture.has_value()) {
|
||||
uint32_t bufSize = jointCount * 12;
|
||||
ITextureBufferHandle handle;
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
|
||||
private:
|
||||
ccstd::unordered_map<ccstd::string, IAnimInfo> _pool; // pre node
|
||||
gfx::Device * _device{nullptr};
|
||||
gfx::Device * _device{nullptr};
|
||||
|
||||
CC_DISALLOW_COPY_MOVE_ASSIGN(JointAnimationInfo);
|
||||
};
|
||||
|
||||
@@ -62,10 +62,10 @@ const float AudioEngine::TIME_UNKNOWN = -1.0F;
|
||||
ccstd::unordered_map<ccstd::string, std::list<int>> AudioEngine::sAudioPathIDMap;
|
||||
//profileName,ProfileHelper
|
||||
ccstd::unordered_map<ccstd::string, AudioEngine::ProfileHelper> AudioEngine::sAudioPathProfileHelperMap;
|
||||
unsigned int AudioEngine::sMaxInstances = MAX_AUDIOINSTANCES;
|
||||
AudioEngine::ProfileHelper * AudioEngine::sDefaultProfileHelper = nullptr;
|
||||
ccstd::unordered_map<int, AudioEngine::AudioInfo> AudioEngine::sAudioIDInfoMap;
|
||||
AudioEngineImpl * AudioEngine::sAudioEngineImpl = nullptr;
|
||||
unsigned int AudioEngine::sMaxInstances = MAX_AUDIOINSTANCES;
|
||||
AudioEngine::ProfileHelper * AudioEngine::sDefaultProfileHelper = nullptr;
|
||||
ccstd::unordered_map<int, AudioEngine::AudioInfo> AudioEngine::sAudioIDInfoMap;
|
||||
AudioEngineImpl * AudioEngine::sAudioEngineImpl = nullptr;
|
||||
|
||||
float AudioEngine::sVolumeFactor = 1.0F;
|
||||
uint32_t AudioEngine::sOnPauseListenerID = 0;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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
|
||||
@@ -28,8 +28,8 @@ THE SOFTWARE.
|
||||
#include "audio/android/AudioDecoderSLES.h"
|
||||
#include "platform/FileUtils.h"
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
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<std::mutex> 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");
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "audio/android/AudioDecoder.h"
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#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;
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include <SLES/OpenSLES.h>
|
||||
#include <SLES/OpenSLES_Android.h>
|
||||
#include <functional>
|
||||
#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<int, IAudioPlayer *> _audioPlayers;
|
||||
ccstd::unordered_map<int, IAudioPlayer *> _audioPlayers;
|
||||
ccstd::unordered_map<int, std::function<void(int, const ccstd::string &)>> _callbackMap;
|
||||
|
||||
// UrlAudioPlayers which need to resumed while entering foreground
|
||||
|
||||
@@ -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<AudioFileInfo &>(info);
|
||||
size_t judgeCount = sizeof(gAudioFileIndicator) / sizeof(gAudioFileIndicator[0]);
|
||||
size_t pos = audioFileInfo.url.rfind('.');
|
||||
auto & audioFileInfo = const_cast<AudioFileInfo &>(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);
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
private:
|
||||
struct AudioFileInfo {
|
||||
ccstd::string url;
|
||||
ccstd::string url;
|
||||
std::shared_ptr<AssetFd> assetFd;
|
||||
off_t start{};
|
||||
off_t length;
|
||||
@@ -100,7 +100,7 @@ private:
|
||||
ICallerThreadUtils *_callerThreadUtils;
|
||||
|
||||
ccstd::unordered_map<ccstd::string, PcmData> _pcmCache;
|
||||
std::mutex _pcmCacheMutex;
|
||||
std::mutex _pcmCacheMutex;
|
||||
|
||||
struct PreloadCallbackParam {
|
||||
PreloadCallback callback;
|
||||
@@ -108,7 +108,7 @@ private:
|
||||
};
|
||||
|
||||
ccstd::unordered_map<ccstd::string, ccstd::vector<PreloadCallbackParam>> _preloadCallbackMap;
|
||||
std::mutex _preloadCallbackMutex;
|
||||
std::mutex _preloadCallbackMutex;
|
||||
|
||||
std::mutex _preloadWaitMutex;
|
||||
std::condition_variable _preloadWaitCond;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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, "
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
SLObjectItf _outputMixObj;
|
||||
ICallerThreadUtils *_callerThreadUtils;
|
||||
|
||||
int _id;
|
||||
int _id;
|
||||
ccstd::string _url;
|
||||
|
||||
std::shared_ptr<AssetFd> _assetFd;
|
||||
|
||||
@@ -94,7 +94,7 @@ protected:
|
||||
State _state;
|
||||
|
||||
std::shared_ptr<bool> _isDestroyed;
|
||||
ccstd::string _fileFullPath;
|
||||
ccstd::string _fileFullPath;
|
||||
unsigned int _id;
|
||||
bool _isLoadingFinished;
|
||||
bool _isSkipReadDataTask;
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#include <OpenAL/al.h>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include "base/std/container/string.h"
|
||||
#include <thread>
|
||||
#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<void(int, const ccstd::string &)> _finishCallbak;
|
||||
|
||||
bool _isDestroyed;
|
||||
|
||||
@@ -335,7 +335,7 @@ protected:
|
||||
|
||||
struct AudioInfo {
|
||||
const ccstd::string *filePath;
|
||||
ProfileHelper * profileHelper;
|
||||
ProfileHelper * profileHelper;
|
||||
|
||||
float volume;
|
||||
bool loop;
|
||||
|
||||
@@ -102,7 +102,7 @@ protected:
|
||||
State _state;
|
||||
|
||||
std::shared_ptr<bool> _isDestroyed;
|
||||
ccstd::string _fileFullPath;
|
||||
ccstd::string _fileFullPath;
|
||||
unsigned int _id;
|
||||
bool _isLoadingFinished;
|
||||
bool _isSkipReadDataTask;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include "base/std/container/string.h"
|
||||
#include <thread>
|
||||
#include "base/std/container/string.h"
|
||||
#ifdef OPENAL_PLAIN_INCLUDES
|
||||
#include <al.h>
|
||||
#elif CC_PLATFORM == CC_PLATFORM_WINDOWS
|
||||
@@ -66,8 +66,8 @@ protected:
|
||||
|
||||
AudioCache *_audioCache;
|
||||
|
||||
float _volume;
|
||||
bool _loop;
|
||||
float _volume;
|
||||
bool _loop;
|
||||
std::function<void(int, const ccstd::string &)> _finishCallbak;
|
||||
|
||||
bool _isDestroyed;
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include "base/std/container/string.h"
|
||||
#include <thread>
|
||||
#include "base/std/container/string.h"
|
||||
|
||||
#include "base/CachedArray.h"
|
||||
#include "base/Log.h"
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint> // 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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<ccstd::string> LOG_LEVEL_DESCS{"FATAL", "ERROR", "WARN", "INFO", "DEBUG"};
|
||||
|
||||
void Log::setLogFile(const ccstd::string &filename) {
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base/std/container/string.h"
|
||||
#include "Macros.h"
|
||||
#include "base/std/container/string.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cstdarg>
|
||||
#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<unsigned char *>(const_cast<char *>(_str.c_str()));
|
||||
auto lenOfBase64 = base64Decode(input, static_cast<unsigned int>(_str.size()), &outBase64);
|
||||
auto lenofUnzip = ZipUtils::inflateMemory(outBase64, static_cast<ssize_t>(lenOfBase64), &outGzip);
|
||||
uint8_t * outGzip{nullptr};
|
||||
uint8_t * outBase64{nullptr};
|
||||
auto * input = reinterpret_cast<unsigned char *>(const_cast<char *>(_str.c_str()));
|
||||
auto lenOfBase64 = base64Decode(input, static_cast<unsigned int>(_str.size()), &outBase64);
|
||||
auto lenofUnzip = ZipUtils::inflateMemory(outBase64, static_cast<ssize_t>(lenOfBase64), &outGzip);
|
||||
ccstd::string ret(outGzip, outGzip + lenofUnzip);
|
||||
free(outGzip);
|
||||
free(outBase64);
|
||||
|
||||
@@ -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<ccstd::string> 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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<const uint16_t *>(env->GetStringChars(srcjStr, nullptr));
|
||||
size_t unicodeCharLength = env->GetStringLength(srcjStr);
|
||||
const std::u16string unicodeStr(reinterpret_cast<const char16_t *>(unicodeChar), unicodeCharLength);
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#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<CharUTF8>;
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
#include <cerrno>
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
#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
|
||||
|
||||
@@ -227,7 +227,7 @@ private:
|
||||
double doubleVal;
|
||||
bool boolVal;
|
||||
|
||||
ccstd::string * strVal;
|
||||
ccstd::string * strVal;
|
||||
ValueVector * vectorVal;
|
||||
ValueMap * mapVal;
|
||||
ValueMapIntKey *intKeyMapVal;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -269,7 +269,7 @@ float cssHueToRgb(float m1, float m2, float h) {
|
||||
|
||||
ccstd::vector<ccstd::string> split(const ccstd::string &s, char delim) {
|
||||
ccstd::vector<ccstd::string> elems;
|
||||
std::stringstream ss(s);
|
||||
std::stringstream ss(s);
|
||||
ccstd::string item;
|
||||
while (std::getline(ss, item, delim)) {
|
||||
elems.push_back(item);
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#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();
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ bool inited = false;
|
||||
namespace cc {
|
||||
|
||||
ccstd::unordered_map<ccstd::string, EventDispatcher::Node *> EventDispatcher::listeners;
|
||||
uint32_t EventDispatcher::hashListenerId = 1;
|
||||
uint32_t EventDispatcher::hashListenerId = 1;
|
||||
|
||||
bool EventDispatcher::initialized() {
|
||||
return inited && se::ScriptEngine::getInstance()->isValid();
|
||||
|
||||
@@ -301,7 +301,7 @@ private:
|
||||
struct Node * next = nullptr;
|
||||
};
|
||||
static ccstd::unordered_map<ccstd::string, Node *> listeners;
|
||||
static uint32_t hashListenerId; //simple increment hash
|
||||
static uint32_t hashListenerId; //simple increment hash
|
||||
};
|
||||
|
||||
} // end of namespace cc
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#include <assert.h>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include "base/std/container/string.h"
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "base/std/container/string.h"
|
||||
|
||||
#include "HelperMacros.h"
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include "base/std/container/string.h"
|
||||
#include <vector>
|
||||
#include "base/std/container/string.h"
|
||||
#include "base/std/container/unordered_map.h"
|
||||
|
||||
#include <assert.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 <assert.h>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include "base/std/container/string.h"
|
||||
#include <initializer_list>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <initializer_list>
|
||||
#include "base/std/container/string.h"
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#include <algorithm> // for std::find
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#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"
|
||||
|
||||
@@ -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<v8::FunctionTemplate> _ctorTemplate;
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include "base/std/container/string.h"
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
#include "../ValueArrayPool.h"
|
||||
#include "../config.h"
|
||||
#include "base/Log.h"
|
||||
#include "base/std/container/string.h"
|
||||
|
||||
//#define RECORD_JSB_INVOKING
|
||||
|
||||
|
||||
@@ -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<ccstd::string, unsigned> jsbFunctionInvokedRecords;
|
||||
#endif
|
||||
|
||||
@@ -85,13 +85,13 @@ ccstd::string stackTraceToString(v8::Local<v8::StackTrace> stack) {
|
||||
for (int i = 0, e = stack->GetFrameCount(); i < e; ++i) {
|
||||
v8::Local<v8::StackFrame> frame = stack->GetFrame(v8::Isolate::GetCurrent(), i);
|
||||
v8::Local<v8::String> script = frame->GetScriptName();
|
||||
ccstd::string scriptName;
|
||||
ccstd::string scriptName;
|
||||
if (!script.IsEmpty()) {
|
||||
scriptName = *v8::String::Utf8Value(v8::Isolate::GetCurrent(), script);
|
||||
}
|
||||
|
||||
v8::Local<v8::String> 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<v8::String> 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<v8::String> code = v8::String::NewFromUtf8(_isolate, scriptBuffer.c_str(), v8::NewStringType::kNormal, static_cast<int>(scriptBuffer.length())).ToLocalChecked();
|
||||
v8::Local<v8::Value> scriptPath = v8::String::NewFromUtf8(_isolate, path.data(), v8::NewStringType::kNormal).ToLocalChecked();
|
||||
// create unbound script
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -71,10 +71,10 @@ public:
|
||||
using ValueTypes = ccstd::vector<ValueType>;
|
||||
|
||||
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<jstring>(_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<jstring>(_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<int>(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!");
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -40,9 +40,9 @@ public:
|
||||
|
||||
template <typename T>
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -103,8 +103,8 @@
|
||||
}
|
||||
|
||||
#if CC_ENABLE_CACHE_JSB_FUNC_RESULT
|
||||
#define SE_HOLD_RETURN_VALUE(retCXXValue, thisObject, jsValue) \
|
||||
if (is_jsb_object_v<typename std::decay<decltype(retCXXValue)>::type>) { \
|
||||
#define SE_HOLD_RETURN_VALUE(retCXXValue, thisObject, jsValue) \
|
||||
if (is_jsb_object_v<typename std::decay<decltype(retCXXValue)>::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<ccstd::string, T> *r
|
||||
se::Object *obj = v.toObject();
|
||||
|
||||
ccstd::vector<ccstd::string> 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<Args...> *to, se::Objec
|
||||
////////////// ccstd::unordered_map
|
||||
template <typename V>
|
||||
bool sevalue_to_native(const se::Value &from, ccstd::unordered_map<ccstd::string, V> *to, se::Object *ctx) { //NOLINT
|
||||
se::Object * jsmap = from.toObject();
|
||||
se::Object * jsmap = from.toObject();
|
||||
ccstd::vector<ccstd::string> allKeys;
|
||||
jsmap->getAllKeys(&allKeys);
|
||||
bool ret = true;
|
||||
|
||||
@@ -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<cc::MacroRecord> *to
|
||||
if (!ok || !arrElement.isObject()) {
|
||||
continue;
|
||||
}
|
||||
cc::MacroRecord macroRecord;
|
||||
cc::MacroRecord macroRecord;
|
||||
ccstd::vector<ccstd::string> keys;
|
||||
ok = arrElement.toObject()->getAllKeys(&keys);
|
||||
if (ok) {
|
||||
@@ -1204,7 +1204,7 @@ bool seval_to_Map_string_key(const se::Value &v, cc::RefMap<ccstd::string, cc::m
|
||||
se::Object *obj = v.toObject();
|
||||
|
||||
ccstd::vector<ccstd::string> 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()) {
|
||||
|
||||
@@ -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<bool> *to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming)
|
||||
|
||||
bool sevalue_to_native(const se::Value &from, ccstd::vector<unsigned char> *to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming)
|
||||
bool sevalue_to_native(const se::Value &from, ccstd::vector<unsigned char> *to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming)
|
||||
bool sevalue_to_native(const se::Value &from, cc::variant<ccstd::vector<float>, 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<ccstd::string, cc::middleware::Texture2D *> *ret); // NOLINT(readability-identifier-naming)
|
||||
#endif //USE_MIDDLEWARE
|
||||
#endif //USE_MIDDLEWARE
|
||||
|
||||
#if USE_PHYSICS_PHYSX
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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!");
|
||||
|
||||
@@ -52,9 +52,9 @@ using namespace cc; //NOLINT
|
||||
|
||||
static LegacyThreadPool *gThreadPool = nullptr;
|
||||
|
||||
static std::shared_ptr<cc::network::Downloader> gLocalDownloader = nullptr;
|
||||
static std::shared_ptr<cc::network::Downloader> gLocalDownloader = nullptr;
|
||||
static ccstd::map<ccstd::string, std::function<void(const ccstd::string &, unsigned char *, uint)>> 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<int>(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<unsigned char *>(reinterpret_cast<const unsigned char *>(str.c_str()));
|
||||
arg1 = str.size();
|
||||
arg0 = const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(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<unsigned char *>(reinterpret_cast<const unsigned char *>(str.c_str()));
|
||||
arg1 = str.size();
|
||||
arg0 = const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(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<unsigned char *>(reinterpret_cast<const unsigned char *>(str.c_str()));
|
||||
arg1 = str.size();
|
||||
arg0 = const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(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<unsigned char *>(reinterpret_cast<const unsigned char *>(str.c_str()));
|
||||
arg1 = str.size();
|
||||
arg0 = const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(str.c_str()));
|
||||
arg1 = str.size();
|
||||
} else if (args[0].isObject()) {
|
||||
se::Object *obj = args[0].toObject();
|
||||
if (obj->isArrayBuffer()) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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<ccstd::string, ccstd::string> &getFontFamilyNameMap();
|
||||
|
||||
@@ -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<ccstd::string::const_iterator> results;
|
||||
if (std::regex_search(source.cbegin(), source.cend(), results, re)) {
|
||||
fontFilePath = results[1].str();
|
||||
|
||||
@@ -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<ccstd::string::const_iterator> results;
|
||||
if (std::regex_search(source.cbegin(), source.cend(), results, re)) {
|
||||
fontFilePath = results[1].str();
|
||||
|
||||
@@ -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<ccstd::string::const_iterator> results;
|
||||
if (std::regex_search(source.cbegin(), source.cend(), results, re)) {
|
||||
fontFilePath = results[1].str();
|
||||
|
||||
@@ -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<ccstd::string::const_iterator> results;
|
||||
if (std::regex_search(source.cbegin(), source.cend(), results, re)) {
|
||||
fontFilePath = results[1].str();
|
||||
|
||||
@@ -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<ccstd::string::const_iterator> results;
|
||||
if (std::regex_search(source.cbegin(), source.cend(), results, re)) {
|
||||
fontFilePath = results[1].str();
|
||||
|
||||
@@ -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<cc::network::SIOClient *>(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<cc::network::SIOClient *>(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");
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
|
||||
using namespace cc;
|
||||
|
||||
static spine::Cocos2dTextureLoader textureLoader;
|
||||
static spine::Cocos2dTextureLoader textureLoader;
|
||||
static cc::RefMap<ccstd::string, middleware::Texture2D *> *_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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<void(const ccstd::string &)> 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<void(const ccstd::string &)> callback;
|
||||
std::weak_ptr<WebSocketServer> serverWeak = *cobj;
|
||||
std::weak_ptr<WebSocketServer> 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<void(const ccstd::string &)> callback;
|
||||
|
||||
if (argc == 1) {
|
||||
@@ -449,9 +449,9 @@ static bool WebSocketServer_Connection_close(se::State &s) {
|
||||
}
|
||||
|
||||
std::function<void(const ccstd::string &)> 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);
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <sstream>
|
||||
#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<int>(args.size());
|
||||
if (argc >= 2) {
|
||||
auto * request = static_cast<XMLHttpRequest *>(s.nativeThisObject());
|
||||
bool ok = false;
|
||||
auto * request = static_cast<XMLHttpRequest *>(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<XMLHttpRequest *>(s.nativeThisObject());
|
||||
auto * xhr = static_cast<XMLHttpRequest *>(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<XMLHttpRequest *>(s.nativeThisObject());
|
||||
auto * xhr = static_cast<XMLHttpRequest *>(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<XMLHttpRequest *>(s.nativeThisObject());
|
||||
auto * xhr = static_cast<XMLHttpRequest *>(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<XMLHttpRequest *>(s.nativeThisObject());
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
using UInt8Reader = uint8_t (DataView::*)(uint32_t) const;
|
||||
using ReaderVariant = cc::variant<Int32Reader, UInt32Reader, Int16Reader, UInt16Reader, Int8Reader, UInt8Reader>;
|
||||
static ccstd::unordered_map<ccstd::string, ReaderVariant> 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<ccstd::string, IntWritter> intWritterMap;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base/std/container/string.h"
|
||||
#include <utility>
|
||||
#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;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
namespace cc {
|
||||
|
||||
namespace {
|
||||
ccstd::vector<IJointTransform *> stack; //cjh TODO: how to release ?
|
||||
ccstd::vector<IJointTransform *> stack; //cjh TODO: how to release ?
|
||||
ccstd::unordered_map<ccstd::string, IJointTransform *> 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;
|
||||
|
||||
@@ -57,7 +57,7 @@ ccstd::string Asset::getNativeUrl() const {
|
||||
}
|
||||
return _nativeUrl;
|
||||
}
|
||||
Asset::Asset() = default;
|
||||
Asset::Asset() = default;
|
||||
Asset::~Asset() = default;
|
||||
|
||||
NativeDep Asset::getNativeDep() const {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ ccstd::vector<MacroRecord> EffectAsset::doCombine(const ccstd::vector<MacroRecor
|
||||
}
|
||||
|
||||
const IPreCompileInfoValueType &values = iter->second;
|
||||
const ccstd::string & key = iter->first;
|
||||
const ccstd::string & key = iter->first;
|
||||
|
||||
ccstd::vector<MacroRecord> records;
|
||||
if (cur.empty()) {
|
||||
@@ -259,7 +259,7 @@ ccstd::vector<MacroRecord> EffectAsset::generateRecords(const ccstd::string &key
|
||||
}
|
||||
|
||||
ccstd::vector<MacroRecord> EffectAsset::insertInfoValue(const ccstd::vector<MacroRecord> &records,
|
||||
const ccstd::string & key,
|
||||
const ccstd::string & key,
|
||||
const IPreCompileInfoValueType & value) {
|
||||
ccstd::vector<MacroRecord> ret;
|
||||
for (const auto &record : records) {
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base/std/container/string.h"
|
||||
#include <tuple>
|
||||
#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<DepthStencilStateInfo> depthStencilState;
|
||||
cc::optional<BlendStateInfo> blendState;
|
||||
cc::optional<gfx::DynamicStateFlags> dynamicStates;
|
||||
cc::optional<ccstd::string> phase;
|
||||
cc::optional<ccstd::string> phase;
|
||||
|
||||
IPassStates() = default;
|
||||
explicit IPassStates(const IPassInfoFull &o);
|
||||
@@ -358,12 +358,12 @@ struct IPassInfoFull final { //cjh } : public IPassInfo {
|
||||
cc::optional<DepthStencilStateInfo> depthStencilState;
|
||||
cc::optional<BlendStateInfo> blendState;
|
||||
cc::optional<gfx::DynamicStateFlags> dynamicStates;
|
||||
cc::optional<ccstd::string> phase;
|
||||
cc::optional<ccstd::string> phase;
|
||||
// IPassInfo
|
||||
ccstd::string program; // auto-generated from 'vert' and 'frag'
|
||||
ccstd::string program; // auto-generated from 'vert' and 'frag'
|
||||
cc::optional<MacroRecord> embeddedMacros;
|
||||
index_t propertyIndex{CC_INVALID_INDEX};
|
||||
cc::optional<ccstd::string> switch_;
|
||||
cc::optional<ccstd::string> switch_;
|
||||
cc::optional<PassPropertyInfoMap> properties;
|
||||
|
||||
// IPassInfoFull
|
||||
@@ -393,19 +393,19 @@ using IPassInfo = IPassInfoFull;
|
||||
|
||||
struct ITechniqueInfo {
|
||||
ccstd::vector<IPassInfoFull> passes;
|
||||
cc::optional<ccstd::string> name;
|
||||
cc::optional<ccstd::string> name;
|
||||
};
|
||||
|
||||
struct IBlockInfo {
|
||||
int32_t binding{-1};
|
||||
ccstd::string name;
|
||||
ccstd::string name;
|
||||
ccstd::vector<gfx::Uniform> 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<ccstd::string> defines;
|
||||
};
|
||||
@@ -466,7 +466,7 @@ struct IAttributeInfo {
|
||||
struct IDefineInfo {
|
||||
ccstd::string name;
|
||||
ccstd::string type;
|
||||
cc::optional<ccstd::vector<int32_t>> range; //cjh number is float? ?: number[];
|
||||
cc::optional<ccstd::vector<int32_t>> range; //cjh number is float? ?: number[];
|
||||
cc::optional<ccstd::vector<ccstd::string>> options;
|
||||
cc::optional<ccstd::string> 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<MacroRecord> doCombine(const ccstd::vector<MacroRecord> &cur, const IPreCompileInfo &info, IPreCompileInfo::iterator iter);
|
||||
static ccstd::vector<MacroRecord> generateRecords(const ccstd::string &key, const IPreCompileInfoValueType &value);
|
||||
static ccstd::vector<MacroRecord> insertInfoValue(const ccstd::vector<MacroRecord> &records,
|
||||
const ccstd::string & key,
|
||||
const ccstd::string & key,
|
||||
const IPreCompileInfoValueType & value);
|
||||
|
||||
void precompile();
|
||||
|
||||
@@ -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<uint8_t> &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<uint8_t> _data;
|
||||
ccstd::unordered_map<uint32_t, FontFace *> _faces;
|
||||
};
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include "base/std/container/string.h"
|
||||
#include "Font.h"
|
||||
#include "base/std/container/string.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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<type> &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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
namespace cc {
|
||||
|
||||
struct IRenderTextureCreateInfo {
|
||||
cc::optional<ccstd::string> name;
|
||||
cc::optional<ccstd::string> name;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
cc::optional<gfx::RenderPassInfo> passInfo;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<TextureBase *>(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) {
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -59,7 +59,7 @@ struct ITextureCubeSerializeMipmapData {
|
||||
};
|
||||
|
||||
struct ITextureCubeSerializeData {
|
||||
ccstd::string base;
|
||||
ccstd::string base;
|
||||
bool rgbe{false};
|
||||
ccstd::vector<ITextureCubeSerializeMipmapData> mipmaps;
|
||||
};
|
||||
|
||||
@@ -66,10 +66,10 @@ private:
|
||||
|
||||
static BuiltinResMgr *instance;
|
||||
|
||||
gfx::Device * _device{nullptr};
|
||||
gfx::Device * _device{nullptr};
|
||||
Record<ccstd::string, IntrusivePtr<Asset>> _resources;
|
||||
ccstd::vector<IntrusivePtr<Material>> _materialsToBeCompiled;
|
||||
bool _isInitialized{false};
|
||||
ccstd::vector<IntrusivePtr<Material>> _materialsToBeCompiled;
|
||||
bool _isInitialized{false};
|
||||
|
||||
CC_DISALLOW_COPY_MOVE_ASSIGN(BuiltinResMgr);
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -100,9 +100,9 @@ static IPropertyHandleInfo jsonToPropertyHandleInfo(const rapidjson::Value &hand
|
||||
if (handleInfoVal.IsArray()) {
|
||||
// using IPropertyHandleInfo = std::tuple<ccstd::string, uint32_t, gfx::Type>;
|
||||
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) {
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include "base/std/container/string.h"
|
||||
#include <typeinfo>
|
||||
#include "base/std/container/string.h"
|
||||
#include "base/std/container/unordered_map.h"
|
||||
|
||||
#include "base/Log.h"
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user