本文整理汇总了C++中policy函数的典型用法代码示例。如果您正苦于以下问题:C++ policy函数的具体用法?C++ policy怎么用?C++ policy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了policy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clearAllData
void ClipboardGtk::clearAllData()
{
if (policy() != ClipboardWritable)
return;
m_dataObject->clear();
if (m_clipboard)
m_helper->writeClipboardContents(m_clipboard);
}
开发者ID:dslab-epfl,项目名称:warr,代码行数:10,代码来源:ClipboardGtk.cpp
示例2: KDialog
CrossReferenceEditDialog::CrossReferenceEditDialog(CrossReferenceContent *contentNote, QWidget *parent/*, QKeyEvent *ke*/)
: KDialog(parent)
, m_noteContent(contentNote)
{
// KDialog options
setCaption(i18n("Edit Cross Reference"));
setButtons(Ok | Cancel);
setDefaultButton(Ok);
setObjectName("EditCrossReference");
setModal(true);
showButtonSeparator(true);
connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
QWidget *page = new QWidget(this);
setMainWidget(page);
QWidget *wid = new QWidget(page);
QGridLayout *layout = new QGridLayout(page);
m_targetBasket = new KComboBox(wid);
this->generateBasketList(m_targetBasket);
if(m_noteContent->url().isEmpty()){
BasketListViewItem *item = Global::bnpView->topLevelItem(0);
m_noteContent->setCrossReference(KUrl(item->data(0, Qt::UserRole).toString()), m_targetBasket->currentText(), "edit-copy");
this->urlChanged(0);
} else {
QString url = m_noteContent->url().url();
//cannot use findData because I'm using a StringList and I don't have the second
// piece of data to make find work.
for(int i = 0; i < m_targetBasket->count(); ++i) {
if(url == m_targetBasket->itemData(i, Qt::UserRole).toStringList().first()) {
m_targetBasket->setCurrentIndex(i);
break;
}
}
}
QLabel *label1 = new QLabel(page);
label1->setText(i18n("Ta&rget:"));
label1->setBuddy(m_targetBasket);
layout->addWidget(label1, 0, 0, Qt::AlignVCenter);
layout->addWidget(m_targetBasket, 0, 1, Qt::AlignVCenter);
connect(m_targetBasket, SIGNAL(activated(int)), this, SLOT(urlChanged(int)));
QWidget *stretchWidget = new QWidget(page);
QSizePolicy policy(QSizePolicy::Fixed, QSizePolicy::Expanding);
policy.setHorizontalStretch(1);
policy.setVerticalStretch(255);
stretchWidget->setSizePolicy(policy); // Make it fill ALL vertical space
layout->addWidget(stretchWidget, 3, 1, Qt::AlignVCenter);
}
开发者ID:tosky,项目名称:basket,代码行数:55,代码来源:noteedit.cpp
示例3: getValues
void
Basis_HGRAD_TET_COMP12_FEM::
getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
const EOperator operatorType ) {
typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
// Number of evaluation points = dim 0 of inputPoints
const auto loopSize = inputPoints.dimension(0);
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
switch (operatorType) {
case OPERATOR_VALUE: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_GRAD:
case OPERATOR_D1: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_CURL: {
INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_CURL, std::invalid_argument,
">>> ERROR (Basis_HGRAD_TET_COMP12_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
break;
}
case OPERATOR_DIV: {
INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
">>> ERROR (Basis_HGRAD_TET_COMP12_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
break;
}
case OPERATOR_D2:
case OPERATOR_D3:
case OPERATOR_D4:
case OPERATOR_D5:
case OPERATOR_D6:
case OPERATOR_D7:
case OPERATOR_D8:
case OPERATOR_D9:
case OPERATOR_D10: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
default: {
INTREPID2_TEST_FOR_EXCEPTION( true , std::invalid_argument,
">>> ERROR (Basis_HGRAD_TET_COMP12_FEM): Operator type not implemented" );
}
}
}
开发者ID:brian-kelley,项目名称:Trilinos,代码行数:55,代码来源:Intrepid2_HGRAD_TET_COMP12_FEMDef.hpp
示例4: cos_init
void
cos_init(void *arg)
{
printc("thd %d Tmem policy running.....\n", cos_get_thd_id());
INIT_LIST(&threads, next, prev);
init_spds();
#ifdef THD_POOL
printc("<<<Thd Pool with total %d tmems, component size %d>>>\n", MAX_NUM_MEM, THD_POOL);
if (THD_POOL != 1)
thdpool_max_policy();
else
thdpool_1_policy();
#else
printc("<<<Now using Algorithm %d, total number of tmems:%d >>>\n", ALGORITHM, MAX_NUM_MEM);
DOUT("Tmem policy: %d in spd %ld\n", cos_get_thd_id(), cos_spd_id());
init_policy();
#endif
periodic_wake_create(cos_spd_id(), POLICY_PERIODICITY);
/* Wait for all other threads to initialize */
int i = 0, waiting = 100 / POLICY_PERIODICITY, counter = 0, report_period = 100 / POLICY_PERIODICITY;
do {
periodic_wake_wait(cos_spd_id());
} while (i++ < waiting);
init_thds();
//unsigned long long s,e;
while (1) {
if (counter++ % report_period == 0) {
/* report tmems usage */
cbufmgr_buf_report();
stkmgr_stack_report();
}
gather_data(counter % report_period);
#ifdef THD_POOL
if (THD_POOL == 1)
thdpool_1_policy();
else
thdpool_max_policy();
#else
//rdtscll(s);
DOUT("POLICY starts!\n");
policy();
DOUT("POLICY ends!\n");
//rdtscll(e);
//printc("SP:%llu cycles\n",e-s);
#endif
periodic_wake_wait(cos_spd_id());
}
return;
}
开发者ID:HelloCompositeKevin,项目名称:test_merge_conflict,代码行数:55,代码来源:tmem_policy.c
示例5: getValues
void
Basis_HGRAD_LINE_C1_FEM<SpT,OT,PT>::Internal::
getValues( /**/ Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
const EOperator operatorType ) const {
#ifdef HAVE_INTREPID2_DEBUG
Intrepid2::getValues_HGRAD_Args(outputValues,
inputPoints,
operatorType,
obj_->getBaseCellTopology(),
obj_->getCardinality() );
#endif
typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
// Number of evaluation points = dim 0 of inputPoints
const auto loopSize = inputPoints.dimension(0);
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
switch (operatorType) {
case OPERATOR_VALUE: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_GRAD:
case OPERATOR_DIV:
case OPERATOR_CURL:
case OPERATOR_D1: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_D2:
case OPERATOR_D3:
case OPERATOR_D4:
case OPERATOR_D5:
case OPERATOR_D6:
case OPERATOR_D7:
case OPERATOR_D8:
case OPERATOR_D9:
case OPERATOR_D10: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
default: {
INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
">>> ERROR (Basis_HGRAD_LINE_C1_FEM): Invalid operator type");
}
}
}
开发者ID:agrippa,项目名称:Trilinos,代码行数:55,代码来源:Intrepid2_HGRAD_LINE_C1_FEMDef.hpp
示例6: exprToText
std::string exprToText(const clang::Expr * expr)
{
std::string text;
raw_string_ostream stream(text);
LangOptions langOptions;
langOptions.CPlusPlus = 1;
PrintingPolicy policy(langOptions);
policy.SuppressSpecifiers = 0;
expr->printPretty(stream, NULL, policy);
return stream.str();
}
开发者ID:Remscar,项目名称:cpgf,代码行数:11,代码来源:cpputil.cpp
示例7: MOZ_ASSERT
UniquePtr<SandboxBroker::Policy>
SandboxBrokerPolicyFactory::GetContentPolicy(int aPid)
{
// Policy entries that vary per-process (currently the only reason
// that can happen is because they contain the pid) are added here.
MOZ_ASSERT(NS_IsMainThread());
// File broker usage is controlled through a pref.
if (Preferences::GetInt("security.sandbox.content.level") <= 1) {
return nullptr;
}
MOZ_ASSERT(mCommonContentPolicy);
#if defined(MOZ_WIDGET_GONK)
// Allow overriding "unsupported"ness with a pref, for testing.
if (!IsSystemSupported()) {
return nullptr;
}
UniquePtr<SandboxBroker::Policy>
policy(new SandboxBroker::Policy(*mCommonContentPolicy));
// Bug 1029337: where the profiler writes the data.
nsPrintfCString profilerLogPath("/data/local/tmp/profile_%d_%d.txt",
GeckoProcessType_Content, aPid);
policy->AddPath(wrlog, profilerLogPath.get());
// Bug 1198550: the profiler's replacement for dl_iterate_phdr
policy->AddPath(rdonly, nsPrintfCString("/proc/%d/maps", aPid).get());
// Bug 1198552: memory reporting.
policy->AddPath(rdonly, nsPrintfCString("/proc/%d/statm", aPid).get());
policy->AddPath(rdonly, nsPrintfCString("/proc/%d/smaps", aPid).get());
return policy;
#else
UniquePtr<SandboxBroker::Policy>
policy(new SandboxBroker::Policy(*mCommonContentPolicy));
// Return the common policy.
return policy;
#endif
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:41,代码来源:SandboxBrokerPolicyFactory.cpp
示例8: parallel_scan
void parallel_scan(LO n, T f) {
typedef typename T::value_type VT;
static_assert(sizeof(VT) >= sizeof(void*),
"reduction value types need to be at least word-sized");
#ifdef OMEGA_H_USE_KOKKOS
if (n > 0) Kokkos::parallel_scan(policy(n), f);
#else
VT update;
f.init(update);
for (LO i = 0; i < n; ++i) f(i, update, true);
#endif
}
开发者ID:ibaned,项目名称:omega_h,代码行数:12,代码来源:loop.hpp
示例9: QWidget
rectangle::rectangle( QWidget *parent ) : QWidget( parent )
{
m_value = 0;
QSizePolicy policy( QSizePolicy::Expanding, QSizePolicy::Expanding);
policy.setHeightForWidth( true );
setSizePolicy( policy );
setLineSize(1);
setLineColor(Qt::black);
writeFG(Qt::red);
writeBG(Qt::gray);
}
开发者ID:caqtdm,项目名称:caqtdm,代码行数:12,代码来源:rectangle.cpp
示例10: read_tls_policy
std::string read_tls_policy(const std::string& policy_str)
{
const std::string fspath = Test::data_file("tls-policy/" + policy_str + ".txt");
std::ifstream is(fspath.c_str());
if(!is.good())
{
throw Test_Error("Missing policy file " + fspath);
}
Botan::TLS::Text_Policy policy(is);
return policy.to_string();
}
开发者ID:randombit,项目名称:botan,代码行数:13,代码来源:test_tls.cpp
示例11: getData
String ClipboardQt::getData(const String& type, bool& success) const
{
if (policy() != ClipboardReadable) {
success = false;
return String();
}
ASSERT(m_readableData);
QByteArray data = m_readableData->data(QString(type));
success = !data.isEmpty();
return String(data.data(), data.size());
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:13,代码来源:ClipboardQt.cpp
示例12: QWidget
BusyIndicator::BusyIndicator(QWidget *parent) :
QWidget(parent),
startAngle(0),
m_style(StyleArc)
{
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed);
policy.setHeightForWidth(true);
setSizePolicy(policy);
timer.setInterval(50);
connect(&timer, SIGNAL(timeout()), this, SLOT(rotate()));
timer.start();
}
开发者ID:bitwigglers,项目名称:busy-indicator,代码行数:13,代码来源:busyindicator.cpp
示例13: Q_Q
void QCommandLinkButtonPrivate::init()
{
Q_Q(QCommandLinkButton);
QPushButtonPrivate::init();
q->setAttribute(Qt::WA_Hover);
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::PushButton);
policy.setHeightForWidth(true);
q->setSizePolicy(policy);
q->setIconSize(QSize(20, 20));
q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink));
}
开发者ID:Fale,项目名称:qtmoko,代码行数:13,代码来源:qcommandlinkbutton.cpp
示例14: setRange
void QwtThermo::initThermo()
{
d_data = new PrivateData;
setRange( d_data->minValue, d_data->maxValue, false );
QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
if ( d_data->orientation == Qt::Vertical )
policy.transpose();
setSizePolicy( policy );
setAttribute( Qt::WA_WState_OwnSizePolicy, false );
}
开发者ID:PrincetonPAVE,项目名称:old_igvc,代码行数:13,代码来源:qwt_thermo.cpp
示例15: clearAllData
void ClipboardQt::clearAllData()
{
if (policy() != ClipboardWritable)
return;
#ifndef QT_NO_CLIPBOARD
if (!isForDragging())
QApplication::clipboard()->setMimeData(0);
else
#endif
delete m_writableData;
m_writableData = 0;
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:13,代码来源:ClipboardQt.cpp
示例16: parallel_reduce
typename T::value_type parallel_reduce(LO n, T f) {
typedef typename T::value_type VT;
static_assert(sizeof(VT) >= sizeof(void*),
"reduction value types need to be at least word-sized");
VT result;
f.init(result);
#ifdef OMEGA_H_USE_KOKKOS
if (n > 0) Kokkos::parallel_reduce(policy(n), f, result);
#else
for (LO i = 0; i < n; ++i) f(i, result);
#endif
return result;
}
开发者ID:ibaned,项目名称:omega_h,代码行数:13,代码来源:loop.hpp
示例17: get_name
boost::python::str get_name(clang::TemplateArgument* ta)
{
std::string spelling = "";
llvm::raw_string_ostream os(spelling);
clang::LangOptions lang;
lang.CPlusPlus = true;
clang::PrintingPolicy policy(lang);
policy.SuppressSpecifiers = false;
policy.SuppressScope = false;
policy.SuppressUnwrittenScope = true;
ta->print(policy, os);
return boost::python::str(os.str());
}
开发者ID:pfernique,项目名称:PyClangLite,代码行数:13,代码来源:tool.cpp
示例18: QFrame
QT_BEGIN_NAMESPACE
LayoutWidget::LayoutWidget(QWidget *parent) : QFrame(parent)
{
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QGridLayout *grid = new QGridLayout(this);
setLayout(grid);
grid->setContentsMargins(0,0,0,0);
grid->setSpacing(4);
m_topButton = new QPushButton(this);
m_topButton->setCheckable(true);
m_topButton->setSizePolicy(policy);
grid->addWidget(m_topButton, 0, 2, 2, 1, Qt::AlignHCenter);
m_bottomButton = new QPushButton(this);
m_bottomButton->setCheckable(true);
m_bottomButton->setSizePolicy(policy);
grid->addWidget(m_bottomButton, 3, 2, 2, 1, Qt::AlignHCenter);
m_leftButton = new QPushButton(this);
m_leftButton->setCheckable(true);
m_leftButton->setSizePolicy(policy);
grid->addWidget(m_leftButton, 2, 0, 1, 2, Qt::AlignVCenter);
m_rightButton = new QPushButton(this);
m_rightButton->setCheckable(true);
m_rightButton->setSizePolicy(policy);
grid->addWidget(m_rightButton, 2, 3, 1, 2, Qt::AlignVCenter);
m_middleButton = new QPushButton(this);
grid->addWidget(m_middleButton, 2, 2, 1, 1, Qt::AlignCenter);
connect(m_topButton, SIGNAL(toggled(bool)), this, SLOT(setTopAnchor(bool)));
connect(m_bottomButton, SIGNAL(toggled(bool)), this, SLOT(setBottomAnchor(bool)));
connect(m_leftButton, SIGNAL(toggled(bool)), this, SLOT(setLeftAnchor(bool)));
connect(m_rightButton, SIGNAL(toggled(bool)), this, SLOT(setRightAnchor(bool)));
connect(m_middleButton, SIGNAL(pressed()), this, SIGNAL(fill()));
}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:50,代码来源:layoutwidget.cpp
示例19: CreateDatabaseL
void CreateDatabaseL(const TDesC& aDbName)
{
// create the database now
RSqlSecurityPolicy securityPolicy;
CleanupClosePushL(securityPolicy);
TSecurityPolicy policy(TSecurityPolicy::EAlwaysPass);
securityPolicy.Create(policy);
TSecurityPolicy schemaPolicy(TSecurityPolicy::EAlwaysPass);
TSecurityPolicy readPolicy(TSecurityPolicy::EAlwaysPass);
TSecurityPolicy writePolicy(TSecurityPolicy::EAlwaysPass);
User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::ESchemaPolicy, schemaPolicy));
User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EReadPolicy, readPolicy));
User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EWritePolicy, writePolicy));
TheTest.Printf(_L("Creating Database %S\n"), &aDbName);
TInt err = TheDbC.Create(aDbName, securityPolicy, &TheSqlConfigString);
if (KErrAlreadyExists == err)
{
// the file already exists
// make sure we delete the file
User::LeaveIfError(TheDbC.Delete(aDbName));
// try again
err = TheDbC.Create(aDbName, securityPolicy, &TheSqlConfigString);
}
User::LeaveIfError(err);
//Create tables
User::LeaveIfError(TheDbC.Exec(KMusicCreateTable));
User::LeaveIfError(TheDbC.Exec(KAuxiliaryCreateTable));
User::LeaveIfError(TheDbC.Exec(KAlbumCreateTable));
User::LeaveIfError(TheDbC.Exec(KArtistCreateTable));
User::LeaveIfError(TheDbC.Exec(KComposerCreateTable));
User::LeaveIfError(TheDbC.Exec(KGenreCreateTable));
User::LeaveIfError(TheDbC.Exec(KPlaylistCreateTable));
User::LeaveIfError(TheDbC.Exec(KPlaylistSongInfoCreateTable));
User::LeaveIfError(TheDbC.Exec(KPlaylistSongsCreateTable));
TheDbC.Close();
CleanupStack::PopAndDestroy(&securityPolicy);
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:50,代码来源:t_sqlperformance4.cpp
示例20: QwtAbstractScale
/*!
Constructor
\param parent Parent widget
*/
QwtThermo::QwtThermo( QWidget *parent ):
QwtAbstractScale( parent )
{
d_data = new PrivateData;
QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
if ( d_data->orientation == Qt::Vertical )
policy.transpose();
setSizePolicy( policy );
setAttribute( Qt::WA_WState_OwnSizePolicy, false );
layoutThermo( true );
}
开发者ID:151706061,项目名称:sofa,代码行数:18,代码来源:qwt_thermo.cpp
注:本文中的policy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论