本文整理汇总了C++中Interface类的典型用法代码示例。如果您正苦于以下问题:C++ Interface类的具体用法?C++ Interface怎么用?C++ Interface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void RuleOptionsDialog::fillInterfaces(QComboBox* cb)
{
QSet<QString> deduplicated_interface_names;
list<FWObject*> interfaces = firewall->getByTypeDeep(Interface::TYPENAME);
for (list<FWObject*>::iterator i=interfaces.begin(); i!=interfaces.end(); ++i)
{
Interface *iface = Interface::cast(*i);
assert(iface);
if (iface->isLoopback()) continue;
deduplicated_interface_names.insert(iface->getName().c_str());
if (Cluster::isA(firewall))
{
FailoverClusterGroup *failover_group =
FailoverClusterGroup::cast(
iface->getFirstByType(FailoverClusterGroup::TYPENAME));
if (failover_group)
{
for (FWObject::iterator it=failover_group->begin();
it!=failover_group->end(); ++it)
{
FWObject *mi = FWReference::getObject(*it);
if (Interface::isA(mi) && ! iface->isLoopback())
{
deduplicated_interface_names.insert(mi->getName().c_str());
}
}
}
}
}
QStringList sorted_interfaces;
QSetIterator<QString> it(deduplicated_interface_names);
while (it.hasNext())
{
sorted_interfaces << it.next();
}
sorted_interfaces.sort();
cb->clear();
cb->addItem("");
cb->addItems(sorted_interfaces);
}
示例2: write_to_coords
ErrorCode DeformMeshRemap::write_to_coords(Range &elems, Tag tagh, Tag tmp_tag)
{
// Write the tag to coordinates
Range verts;
ErrorCode rval = mbImpl->get_adjacencies(elems, 0, false, verts, Interface::UNION);MB_CHK_SET_ERR(rval, "Failed to get adj vertices");
vector<double> coords(3*verts.size());
if (tmp_tag) {
// Save the coords to tmp_tag first
rval = mbImpl->get_coords(verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to get tmp copy of coords");
rval = mbImpl->tag_set_data(tmp_tag, verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to save tmp copy of coords");
}
rval = mbImpl->tag_get_data(tagh, verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to get tag data");
rval = mbImpl->set_coords(verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to set coordinates");
return MB_SUCCESS;
}
示例3: CheckCancel
void Unreal3DExport::Init()
{
// Init
CheckCancel();
pScene = GetIGameInterface();
GetConversionManager()->SetUserCoordSystem(UnrealCoords);
if( bExportSelected )
{
Tab<INode*> selnodes;;
for( int i=0; i<pInt->GetSelNodeCount(); ++i )
{
INode* n = pInt->GetSelNode(i);
selnodes.Append(1,&n);
}
if( !pScene->InitialiseIGame(selnodes,false) )
throw MAXException(GetString(IDS_ERR_IGAME));
}
else
{
if( !pScene->InitialiseIGame() )
throw MAXException(GetString(IDS_ERR_IGAME));
}
// Enumerate scene
NodeCount = pScene->GetTotalNodeCount();
for( int i=0; i<pScene->GetTopLevelNodeCount(); ++i )
{
IGameNode * n = pScene->GetTopLevelNode(i);
ExportNode(n);
}
Progress += U3D_PROGRESS_ENUM;
// Get animation info
FrameStart = pScene->GetSceneStartTime() / pScene->GetSceneTicks();
FrameEnd = pScene->GetSceneEndTime() / pScene->GetSceneTicks();
FrameCount = FrameEnd - FrameStart+1;
if( FrameCount <= 0 || FrameEnd < FrameStart )
{
ProgressMsg.printf(GetString(IDS_ERR_FRAMERANGE),FrameStart,FrameEnd);
throw MAXException(ProgressMsg.data());
}
pScene->SetStaticFrame(FrameStart);
}
示例4: main
int main(int argc,char *argv[])
{
QDir::setCurrent(QFileInfo(QString::fromLocal8Bit(argv[0])).absolutePath());
Local::addLibraryPath("./plugins");
Local::setStyle("Fusion");
Local a(argc,argv);
Config::load();
int single;
if((single=Config::getValue("/Interface/Single",1))){
QLocalSocket socket;
socket.connectToServer("BiliLocalInstance");
if(socket.waitForConnected()){
QDataStream s(&socket);
s<<a.arguments().mid(1);
socket.waitForBytesWritten();
return 0;
}
}
Shield::load();
loadTranslator();
setDefaultFont();
setToolTipBase();
a.connect(&a,&Local::aboutToQuit,[](){
Shield::save();
Config::save();
});
qsrand(QTime::currentTime().msec());
Interface w;
Plugin::loadPlugins();
w.show();
w.tryLocal(a.arguments().mid(1));
QLocalServer *server=NULL;
if(single){
server=new QLocalServer(qApp);
server->listen("BiliLocalInstance");
QObject::connect(server,&QLocalServer::newConnection,[&](){
QLocalSocket *r=server->nextPendingConnection();
r->waitForReadyRead();
QDataStream s(r);
QStringList args;
s>>args;
r->deleteLater();
w.tryLocal(args);
});
}
示例5: get_next_arr
ErrorCode VectorSetIterator::get_next_arr(std::vector<EntityHandle> &arr,
bool &atend)
{
int count;
const EntityHandle *ptr;
WriteUtilIface *iface;
Interface *mbImpl = dynamic_cast<Interface*>(myCore);
ErrorCode rval = mbImpl->query_interface(iface);
if (MB_SUCCESS != rval) return rval;
rval = iface->get_entity_list_pointers( &entSet, 1, &ptr, WriteUtilIface::CONTENTS, &count);
if (MB_SUCCESS != rval) return rval;
mbImpl->release_interface(iface);
if (!count || iterPos >= count) {
atend = true;
return MB_SUCCESS;
}
std::vector<EntityHandle> tmp_arr;
std::vector<EntityHandle> *tmp_ptr = &arr;
if (checkValid) tmp_ptr = &tmp_arr;
// just get the next chunkSize entities, or as many as you can
int this_ct = 0;
while (this_ct < (int)chunkSize && iterPos < count) {
if ((MBMAXTYPE == entType || TYPE_FROM_HANDLE(ptr[iterPos]) == entType) &&
(-1 == entDimension || CN::Dimension(TYPE_FROM_HANDLE(ptr[iterPos])) == entDimension)) {
arr.push_back(ptr[iterPos]);
this_ct++;
}
iterPos++;
}
atend = (iterPos == count);
if (checkValid) {
for (std::vector<EntityHandle>::iterator vit = tmp_ptr->begin(); vit != tmp_ptr->end(); vit++) {
if (myCore->is_valid(*vit)) arr.push_back(*vit);
}
}
// step along list, adding entities
return MB_SUCCESS;
}
示例6: add_interface
bool add_interface(Interface interface)
{
if (interface.validate()) {
_interfaces.push_back(interface);
_sub.notify(dynamic_cast<Module*>(&interface), Subscriber::Interface, Event::ADD);
return true;
}
return false;
}
示例7: main
int main()
{
BroadcastReceiver *broadcastReceiver = new BroadcastReceiver();
broadcastReceiver->start();
UnicastReceiver *unicastReceiver = new UnicastReceiver();
unicastReceiver->start();
Controller *controller = new Controller();
controller->start();
Interface interf;
interf.start();
//ResourceIdentifier *ri = new ResourceIdentifier("Victory.mp3", 503200);
//char *address = "25.9.227.212";
//ResourceManager::getInstance().addRemoteResource(*ri, *(new Source(address)));
//ResourceManager::getInstance().addDownloadedResource(*ri);
//ResourceManager::getInstance().addLocalResource("Victory2.mp3");
getchar();
return 0;
}
示例8: options
void Preference::supprproxy(void)
{
if(combo_proxy->count()) //on s'assure qu'on essai pas de vider une liste vide
{
QSettings options("proxy.ini", QSettings::IniFormat); //on enregistre dans le fichier proxy
nom_proxy->clear();
champ_ip->clear();
champ_port->clear();
type_proxy->setCurrentIndex(0);
champ_pseudo->clear();
champ_pass->clear();
combo_proxy->removeItem(combo_proxy->currentIndex());
options.remove("ProxyList/"+combo_proxy->currentText());
Interface * navigateur = (Interface *) this->parentWidget()->window(); //on modifie la liste déroulante du prog principale
navigateur->setListeProxy(combo_proxy);
}
}
示例9:
StreamNameIO::StreamNameIO( const Interface &iface,
const shared_ptr<Cipher> &cipher,
const CipherKey &key )
: _interface( iface.major() )
, _cipher( cipher )
, _key( key )
{
}
示例10: qCDebug
void MainWindow::dropEvent(QDropEvent * event)
{
qCDebug(ARK) << "dropEvent" << event;
Interface *iface = qobject_cast<Interface*>(m_part);
if (iface->isBusy()) {
return;
}
if ((event->source() == NULL) &&
(isValidArchiveDrag(event->mimeData()))) {
event->acceptProposedAction();
}
//TODO: if this call provokes a message box the drag will still be going
//while the box is onscreen. looks buggy, do something about it
openUrl(event->mimeData()->urls().at(0));
}
示例11: main
int main()
{
Interface* userInterface = new Interface();
string input = "";
cout << "Welcome to Budget Tracker." << endl;
do
{
cout << "******************************************" << endl;
cout << "Please select one of the options below." << endl;
cout << "1. Add an item." << endl;
cout << "2. Remove and item." << endl;
cout << "3. Display all itmes." << endl;
cout << "4. Save changes." << endl;
cout << "Q. Quit." << endl;
cout << "******************************************" << endl;
cin >> input;
cin.sync();
if (input == "1")
{
userInterface->add();
}
else if (input == "2")
{
if (!userInterface->remove())
cout << "No item was removed." << endl;
}
else if (input == "3")
{
userInterface->displayAll();
}
else if (input == "4")
{
userInterface->save();
cout << "<<saved>>" << endl;
}
} while (input != "Q");
return 0;
}
示例12: if
/*
* looks for objects with address 0.0.0.0 and aborts compilation if
* finds such object
*/
bool PolicyCompiler::checkForZeroAddr::processNext()
{
PolicyRule *rule=getNext(); if (rule==NULL) return false;
Address *a=NULL;
a = findHostWithNoInterfaces( rule->getSrc() );
if (a==NULL) a = findHostWithNoInterfaces( rule->getDst() );
if (a!=NULL)
compiler->abort(
rule, "Object '"+a->getName()+
"' has no interfaces, therefore it does not have "
"address and can not be used in the rule.");
a = findZeroAddress( rule->getSrc() );
if (a==NULL) a = findZeroAddress( rule->getDst() );
if (a!=NULL)
{
string err="Object '"+a->getName()+"'";
if (IPv4::cast(a)!=NULL) // || IPv6::cast(a)!=NULL
{
FWObject *p=a->getParent();
Interface *iface = Interface::cast(p);
if (iface!=NULL)
{
err+=" (an address of interface ";
if (iface->getLabel()!="") err+=iface->getLabel();
else err+=iface->getName();
err+=" )";
}
}
err += " has address or netmask 0.0.0.0, which is equivalent to 'any'. "
"This is likely an error.";
compiler->abort(rule, err);
}
tmp_queue.push_back(rule);
return true;
}
示例13: GetSceneLights
static void GetSceneLights(Tab<INode*> & lights)
{
Interface *ip = GetCOREInterface();
TimeValue t = ip->GetTime();
INode * Root = ip->GetRootNode();
int Count = Root->NumberOfChildren();
int i=0;
for( i=0; i < Count; i++)
{
INode * node = Root->GetChildNode(i);
ObjectState Os = node->EvalWorldState(t);
if(Os.obj && Os.obj->SuperClassID() == LIGHT_CLASS_ID)
{
lights.Append(1, &node);
}
}
}
示例14: InitializeLibSettings
void InitializeLibSettings()
{
Interface *gi = GetCOREInterface();
TCHAR iniName[MAX_PATH];
if (gi) {
LPCTSTR pluginDir = gi->GetDir(APP_PLUGCFG_DIR);
PathCombine(iniName, pluginDir, "MaxNifTools.ini");
} else {
GetModuleFileName(NULL, iniName, _countof(iniName));
if (LPTSTR fname = PathFindFileName(iniName))
fname = NULL;
PathAddBackslash(iniName);
PathAppend(iniName, "plugcfg");
PathAppend(iniName, "MaxNifTools.ini");
}
libVersion = GetIniValue("MaxNifExport", "MaxSDKVersion", libVersion, iniName);
if (libVersion == 0)
libVersion = VERSION_3DSMAX;
}
示例15: get_interface
Interface*
get_interface(net_domain* domain, uint32 index)
{
RecursiveLocker locker(sLock);
Interface* interface;
if (index == 0)
interface = sInterfaces.First();
else
interface = find_interface(index);
if (interface == NULL || interface->IsBusy())
return NULL;
if (interface->CreateDomainDatalinkIfNeeded(domain) != B_OK)
return NULL;
interface->AcquireReference();
return interface;
}