本文整理汇总了C++中nsTArray::AppendElements方法的典型用法代码示例。如果您正苦于以下问题:C++ nsTArray::AppendElements方法的具体用法?C++ nsTArray::AppendElements怎么用?C++ nsTArray::AppendElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsTArray
的用法示例。
在下文中一共展示了nsTArray::AppendElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
nsSVGTextContainerFrame::GetEffectiveXY(nsTArray<float> &aX,
nsTArray<float> &aY)
{
aX.AppendElements(mX);
aY.AppendElements(mY);
}
示例2: autoLock
void
nsHtml5TreeOpStage::MoveOpsAndSpeculativeLoadsTo(nsTArray<nsHtml5TreeOperation>& aOpQueue,
nsTArray<nsHtml5SpeculativeLoad>& aSpeculativeLoadQueue)
{
mozilla::MutexAutoLock autoLock(mMutex);
aOpQueue.AppendElements(Move(mOpQueue));
aSpeculativeLoadQueue.AppendElements(Move(mSpeculativeLoadQueue));
}
示例3:
void
HTMLOptionsCollection::GetSupportedNames(nsTArray<nsString>& aNames)
{
AutoTArray<nsIAtom*, 8> atoms;
for (uint32_t i = 0; i < mElements.Length(); ++i) {
HTMLOptionElement* content = mElements.ElementAt(i);
if (content) {
// Note: HasName means the names is exposed on the document,
// which is false for options, so we don't check it here.
const nsAttrValue* val = content->GetParsedAttr(nsGkAtoms::name);
if (val && val->Type() == nsAttrValue::eAtom) {
nsIAtom* name = val->GetAtomValue();
if (!atoms.Contains(name)) {
atoms.AppendElement(name);
}
}
if (content->HasID()) {
nsIAtom* id = content->GetID();
if (!atoms.Contains(id)) {
atoms.AppendElement(id);
}
}
}
}
uint32_t atomsLen = atoms.Length();
nsString* names = aNames.AppendElements(atomsLen);
for (uint32_t i = 0; i < atomsLen; ++i) {
atoms[i]->ToString(names[i]);
}
}
示例4:
nsresult
MockMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
{
aRanges.Clear();
aRanges.AppendElements(mRanges);
return NS_OK;
}
示例5: mutex
void
Service::getConnections(/* inout */ nsTArray<RefPtr<Connection> >& aConnections)
{
mRegistrationMutex.AssertNotCurrentThreadOwns();
MutexAutoLock mutex(mRegistrationMutex);
aConnections.Clear();
aConnections.AppendElements(mConnections);
}
示例6: if
bool
CopyArrayBufferViewOrArrayBufferData(const ArrayBufferViewOrArrayBuffer& aBufferOrView,
nsTArray<uint8_t>& aOutData)
{
if (aBufferOrView.IsArrayBuffer()) {
const ArrayBuffer& buffer = aBufferOrView.GetAsArrayBuffer();
buffer.ComputeLengthAndData();
aOutData.AppendElements(buffer.Data(), buffer.Length());
} else if (aBufferOrView.IsArrayBufferView()) {
const ArrayBufferView& bufferview = aBufferOrView.GetAsArrayBufferView();
bufferview.ComputeLengthAndData();
aOutData.AppendElements(bufferview.Data(), bufferview.Length());
} else {
return false;
}
return true;
}
示例7: sizeof
static void
AACAudioSpecificConfigToUserData(uint8_t aAACProfileLevelIndication,
const uint8_t* aAudioSpecConfig,
uint32_t aConfigLength,
nsTArray<BYTE>& aOutUserData)
{
MOZ_ASSERT(aOutUserData.IsEmpty());
// The MF_MT_USER_DATA for AAC is defined here:
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd742784%28v=vs.85%29.aspx
//
// For MFAudioFormat_AAC, MF_MT_USER_DATA contains the portion of
// the HEAACWAVEINFO structure that appears after the WAVEFORMATEX
// structure (that is, after the wfx member). This is followed by
// the AudioSpecificConfig() data, as defined by ISO/IEC 14496-3.
// [...]
// The length of the AudioSpecificConfig() data is 2 bytes for AAC-LC
// or HE-AAC with implicit signaling of SBR/PS. It is more than 2 bytes
// for HE-AAC with explicit signaling of SBR/PS.
//
// The value of audioObjectType as defined in AudioSpecificConfig()
// must be 2, indicating AAC-LC. The value of extensionAudioObjectType
// must be 5 for SBR or 29 for PS.
//
// HEAACWAVEINFO structure:
// typedef struct heaacwaveinfo_tag {
// WAVEFORMATEX wfx;
// WORD wPayloadType;
// WORD wAudioProfileLevelIndication;
// WORD wStructType;
// WORD wReserved1;
// DWORD dwReserved2;
// }
const UINT32 heeInfoLen = 4 * sizeof(WORD) + sizeof(DWORD);
// The HEAACWAVEINFO must have payload and profile set,
// the rest can be all 0x00.
BYTE heeInfo[heeInfoLen] = {0};
WORD* w = (WORD*)heeInfo;
w[0] = 0x0; // Payload type raw AAC packet
w[1] = aAACProfileLevelIndication;
aOutUserData.AppendElements(heeInfo, heeInfoLen);
aOutUserData.AppendElements(aAudioSpecConfig, aConfigLength);
}
示例8:
void
MP4Reader::ExtractCryptoInitData(nsTArray<uint8_t>& aInitData)
{
MOZ_ASSERT(mCrypto.valid);
const nsTArray<mp4_demuxer::PsshInfo>& psshs = mCrypto.pssh;
for (uint32_t i = 0; i < psshs.Length(); i++) {
aInitData.AppendElements(psshs[i].data);
}
}
示例9: DummyArray
const nsTArray<int>& DummyArray()
{
static nsTArray<int> sArray;
if (sArray.IsEmpty()) {
const int data[] = {4, 1, 2, 8};
sArray.AppendElements(data, ArrayLength(data));
}
return sArray;
}
示例10:
bool
TouchBlockState::GetAllowedTouchBehaviors(nsTArray<TouchBehaviorFlags>& aOutBehaviors) const
{
if (!mAllowedTouchBehaviorSet) {
return false;
}
aOutBehaviors.AppendElements(mAllowedTouchBehaviors);
return true;
}
示例11:
static void
GetPluginMimeTypes(const nsTArray<RefPtr<nsPluginElement> >& aPlugins,
nsTArray<RefPtr<nsMimeType> >& aMimeTypes)
{
for (uint32_t i = 0; i < aPlugins.Length(); ++i) {
nsPluginElement *plugin = aPlugins[i];
aMimeTypes.AppendElements(plugin->MimeTypes());
}
}
示例12:
void
URLSearchParams::GetAll(const nsAString& aName, nsTArray<nsString>& aRetval)
{
nsTArray<nsString>* array;
if (!mSearchParams.Get(aName, &array)) {
return;
}
aRetval.AppendElements(*array);
}
示例13:
nsresult
FragmentBuffer::GetCSD(nsTArray<uint8_t>& aCSD)
{
if (!mCSDFrame) {
return NS_ERROR_FAILURE;
}
aCSD.AppendElements(mCSDFrame->GetFrameData().Elements(),
mCSDFrame->GetFrameData().Length());
return NS_OK;
}
示例14:
void
TableToArray(const nsTHashtable<nsPtrHashKey<void>>& aTable,
nsTArray<void*>& aArray)
{
uint32_t i = 0;
void** elements = aArray.AppendElements(aTable.Count());
for (auto iter = aTable.ConstIter(); !iter.Done(); iter.Next()) {
elements[i] = iter.Get()->GetKey();
++i;
}
}
示例15: GetArrayBufferViewOrArrayBufferData
void
CopyArrayBufferViewOrArrayBufferData(const dom::ArrayBufferViewOrArrayBuffer& aBufferOrView,
nsTArray<uint8_t>& aOutData)
{
ArrayData data = GetArrayBufferViewOrArrayBufferData(aBufferOrView);
aOutData.Clear();
if (!data.IsValid()) {
return;
}
aOutData.AppendElements(data.mData, data.mLength);
}