本文整理汇总了C++中SharedArray::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedArray::reset方法的具体用法?C++ SharedArray::reset怎么用?C++ SharedArray::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedArray
的用法示例。
在下文中一共展示了SharedArray::reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runOpenPanel
void ChromeClientBlackBerry::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser)
{
SharedArray<WebString> initialFiles;
unsigned int initialFileSize = chooser->settings().selectedFiles.size();
if (initialFileSize > 0)
initialFiles.reset(new WebString[initialFileSize]);
for (unsigned i = 0; i < initialFileSize; ++i)
initialFiles[i] = chooser->settings().selectedFiles[i];
SharedArray<WebString> chosenFiles;
unsigned int chosenFileSize;
{
PageGroupLoadDeferrer deferrer(m_webPagePrivate->m_page, true);
TimerBase::fireTimersInNestedEventLoop();
// FIXME: Use chooser->settings().acceptMIMETypes instead of WebString() for the second parameter.
if (!m_webPagePrivate->m_client->chooseFilenames(chooser->settings().allowsMultipleFiles, WebString(), initialFiles, initialFileSize, chosenFiles, chosenFileSize))
return;
}
Vector<String> files(chosenFileSize);
for (unsigned i = 0; i < chosenFileSize; ++i)
files[i] = chosenFiles[i];
chooser->chooseFiles(files);
}
示例2: runOpenPanel
void ChromeClientBlackBerry::runOpenPanel(WebCore::Frame*, WTF::PassRefPtr<WebCore::FileChooser> chooser)
{
SharedArray<WebString> initialFiles;
unsigned int initialFileSize = chooser->filenames().size();
if (initialFileSize > 0)
initialFiles.reset(new WebString[initialFileSize]);
for (unsigned i = 0; i < initialFileSize; ++i)
initialFiles[i] = chooser->filenames()[i];
SharedArray<WebString> chosenFiles;
unsigned int chosenFileSize;
{
PageGroupLoadDeferrer deferrer(m_webPage->d->m_page, true);
TimerBase::fireTimersInNestedEventLoop();
if (!m_webPage->client()->chooseFilenames(chooser->allowsMultipleFiles(), chooser->acceptTypes(), initialFiles, initialFileSize, chosenFiles, chosenFileSize))
return;
}
Vector<WTF::String> files(chosenFileSize);
for (unsigned i = 0; i < chosenFileSize; ++i)
files[i] = chosenFiles[i];
chooser->chooseFiles(files);
}
示例3: loadBspDirEntry
bool BspSceneFile::loadBspDirEntry(std::istream& bspStream, const Q3Bsp::DirEntry& entry, SharedArray<uint8_t>::Type& outData) {
if (!bspStream.seekg(entry.offset, std::ios::beg)) {
return false;
}
outData.reset(new uint8_t[entry.length]);
if (!bspStream.read(reinterpret_cast<char*>(outData.get()), entry.length)) {
return false;
}
return true;
}
示例4: basicSample
void basicSample()
{
poco_assert( UDT_use_count == 0 ); // reality check
// test shared_array with a built-in type
char * cap = new char [ 100 ];
SharedArray<char> ca ( cap );
poco_assert( ca.get() == cap );
poco_assert( cap == ca.get() );
poco_assert( &ca[0] == cap );
strcpy( ca.get(), "Hot Dog with mustard and relish" );
poco_assert( strcmp( ca.get(), "Hot Dog with mustard and relish" ) == 0 );
poco_assert( strcmp( cap, "Hot Dog with mustard and relish" ) == 0 );
poco_assert( ca[0] == 'H' );
poco_assert( ca[30] == 'h' );
SharedArray<char> ca2 ( ca );
SharedArray<char> ca3 ( ca2 );
ca[0] = 'N';
ca[4] = 'd';
poco_assert( strcmp( ca.get(), "Not dog with mustard and relish" ) == 0 );
poco_assert( strcmp( ca2.get(), "Not dog with mustard and relish" ) == 0 );
poco_assert( strcmp( ca3.get(), "Not dog with mustard and relish" ) == 0 );
ca2.reset();
ca.reset();
poco_assert( ca.get() == 0 );
SharedArray<char> ca4;
swap( ca3, ca4 );
poco_assert( strcmp( ca4.get(), "Not dog with mustard and relish" ) == 0 );
poco_assert( ca3.get() == 0 );
std::set< SharedArray<char> > sca;
sca.insert(ca4);
poco_assert( sca.find(ca4) != sca.end() );
poco_assert( sca.find(ca4) == sca.find( SharedArray<char>(ca4) ) );
// test shared_array with user defined type
SharedArray<UDT> udta ( new UDT[3] );
udta[0].value( 111 );
udta[1].value( 222 );
udta[2].value( 333 );
SharedArray<UDT> udta2 ( udta );
poco_assert( udta[0].value() == 111 );
poco_assert( udta[1].value() == 222 );
poco_assert( udta[2].value() == 333 );
poco_assert( udta2[0].value() == 111 );
poco_assert( udta2[1].value() == 222 );
poco_assert( udta2[2].value() == 333 );
udta2.reset();
poco_assert( udta2.get() == 0 );
poco_assert( UDT_use_count == 3 ); // reality check
std::cout << "OK\n";
}