本文整理汇总了C++中registerObject函数的典型用法代码示例。如果您正苦于以下问题:C++ registerObject函数的具体用法?C++ registerObject怎么用?C++ registerObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerObject
AIDA::IHistogram3D*
AIDA_ROOT::AIDA_HistogramFactory::createHistogram3D( const std::string& name, const std::string& title, int nBinsX, double lowerEdgeX, double upperEdgeX, int nBinsY, double lowerEdgeY, double upperEdgeY, int nBinsZ, double lowerEdgeZ, double upperEdgeZ, const std::string& options )
{
#ifdef AIDA_ROOT_HISTOGRAM_NO_EXCEPTIONS_TO_USER
try{
#endif
AIDA::Dev::IDevHistogram3D* p = m_factory.createHistogram3D( title, nBinsX, lowerEdgeX, upperEdgeX, nBinsY, lowerEdgeY, upperEdgeY, nBinsZ, lowerEdgeZ, upperEdgeZ, options );
return registerObject( p, name );
#ifdef AIDA_ROOT_HISTOGRAM_NO_EXCEPTIONS_TO_USER
}
catch( std::exception& e ) {
HISTOGRAM_REPORT_ERROR( e.what() );
return 0;
}
#endif
}
示例2: QObject
Server::Server ()
: QObject ()
{
qInstallMsgHandler (Write);
const auto pid = QCoreApplication::applicationPid ();
RegisterTypes ();
auto sb = QDBusConnection::sessionBus ();
const auto& serviceName = QString ("org.LeechCraft.Wrapper_%1").arg (pid);
qDebug () << "registering service..." << sb.registerService (serviceName);
qDebug () << "registering primary object..." << sb.registerObject ("/org/LeechCraft/Control",
this, QDBusConnection::ExportAllContents);
QLocalSocket socket;
socket.connectToServer (QString ("lc_waiter_%1").arg (pid));
qDebug () << "notifying master..." << socket.waitForConnected ();
}
示例3: IOobject
Foam::regIOobject::regIOobject
(
const IOobject& io,
const regIOobject& rio
)
:
IOobject(io),
registered_(false),
ownedByRegistry_(false),
watchIndex_(-1),
eventNo_(db().getEvent()),
isPtr_(NULL)
{
if (registerObject())
{
checkIn();
}
}
示例4: findObject
AudioOutputPort *AudioOutputPortCache::getAudioOutputPort(const char* portName, const char* connection)
{
int key = std::hash<std::string>()(portName);
// see if port already exists in map
AudioOutputPort *port = findObject(key);
if(!port) {
// create system port
jack_port_t *jackPort = AudioEngine::instance().registerAudioOutputPort(portName);
if(!jackPort) {
throw std::logic_error(std::string("Failed to register port ") + portName);
}
port = new AudioOutputPort(jackPort);
registerObject(key, port);
}
if(connection) {
port->systemConnect(connection);
}
return port;
}
示例5: checkOut
// Assign to IOobject
void Foam::regIOobject::operator=(const IOobject& io)
{
if (isPtr_)
{
delete isPtr_;
isPtr_ = NULL;
}
// Check out of objectRegistry
checkOut();
IOobject::operator=(io);
if (registerObject())
{
// Re-register object with objectRegistry
checkIn();
}
}
示例6: AkLoggerLog
void AkVCam::PluginInterface::destroyDevice(const std::string &deviceId)
{
AkLoggerLog("AkVCam::PluginInterface::destroyDevice");
for (auto it = this->m_devices.begin(); it != this->m_devices.end(); it++) {
auto device = *it;
std::string curDeviceId;
device->properties().getProperty(kCMIODevicePropertyDeviceUID,
&curDeviceId);
if (curDeviceId == deviceId) {
device->stopStreams();
device->registerObject(false);
device->registerStreams(false);
this->m_devices.erase(it);
break;
}
}
}
示例7: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setOrganizationName("kylin");
a.setApplicationName("Kylin Weather (indication-china-weather)");
a.setApplicationVersion("3.0.1");
a.setQuitOnLastWindowClosed(false);//Avoid that after hiding mainwindow, close the sub window would cause the program exit
QString locale = QLocale::system().name();
QTranslator translator;
if(locale == "zh_CN") {
if(!translator.load("indicator-china-weather_" + locale + ".qm",
":/qm/translation/"))
qDebug() << "Load translation file:"<< "indicator-china-weather_" + locale + ".qm" << " failed!";
else
a.installTranslator(&translator);
}
// QTranslator qtTranslator;
// qtTranslator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
// a.installTranslator(&qtTranslator);
MainWindow w;
DbusAdaptor adaptor(&w);
Q_UNUSED(adaptor);
auto connection = QDBusConnection::sessionBus();
if (!connection.registerService("com.kylin.weather") || !connection.registerObject("/com/kylin/weather", &w/*, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals*/)) {
//qCritical() << "QDbus register service failed reason:" << connection.lastError();
QDBusInterface iface("com.kylin.weather",
"/com/kylin/weather",
"com.kylin.weather",
connection);
iface.call("showMainWindow");
return 0;
}//QDBusConnection::sessionBus().unregisterService("com.kylin.weather");
//w.show();
return a.exec();
}
示例8: LBASSERT
bool MasterConfig::init()
{
LBASSERT( !_objects );
_objects = new ObjectMap( *this, *getApplication( ));
co::Object* initData = getInitData();
if( initData )
LBCHECK( _objects->register_( initData, OBJECTTYPE_INITDATA ));
_objects->setInitData( initData );
LBCHECK( registerObject( _objects ));
if( !eq::Config::init( _objects->getID( )))
{
LBWARN << "Error during initialization" << std::endl;
exit();
return false;
}
_redraw = true;
return true;
}
示例9: mainMenu
int mainMenu(void)
{
int option = -1;
//system("clear");
printf("Welcome\n");
printf("1. Register\n");
printf("2. Unregister\n");
printf("3. Query\n");
printf("4. Exit\n");
printf("\nOption: ");
scanf("%d", &option);
switch (option)
{
case 1:
registerObject();
break;
case 2:
unregisterObject();
break;
case 3:
query();
break;
case 4:
printf("All done!\n");
break;
default:
// no point printing message; system("clear") will erase it.
//printf("Enter a valid Option, 1 - 4");
// this will flush the input stream
while (getchar() != '\n');
break;
}
return option;
}
示例10: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
auto props = new PropertiesServer(&a);
new PropertiesAdaptor(props);
new AccountsUserAdaptor(props);
auto accounts = new AccountsServer(props, &a);
new AccountsAdaptor(accounts);
new SecurityPrivacyAdaptor(accounts);
new LocationAdaptor(accounts);
new AccountsPrivateAdaptor(accounts);
// We use the session bus for testing. The real plugin uses the system bus
auto connection = QDBusConnection::sessionBus();
if (!connection.registerObject("/org/freedesktop/Accounts", accounts))
return 1;
if (!connection.registerService("org.freedesktop.Accounts"))
return 1;
return a.exec();
}
示例11: m_engine
ScriptEngine::ScriptEngine()
: m_engine(asCreateScriptEngine())
{
if (!m_engine)
return;
// Set the message callback to receive information on errors in human readable form.
int r = m_engine->SetMessageCallback(asFUNCTION(MessageCallback), &m_errorString, asCALL_CDECL); assert(r >= 0);
RegisterStdString(m_engine);
// RegisterStdStringUtils(engine);
// The scripts can directly print text
r = m_engine->RegisterGlobalFunction("void print(const string &in message)", asMETHOD(ScriptEngine, print), asCALL_THISCALL_ASGLOBAL, this); assert(r >= 0);
RegisterScriptMath(m_engine);
aatc::RegisterAllContainers(m_engine);
registerObject(m_engine);
registerAllTypes(m_engine);
generateReference();
}
示例12: debugsupport_registerMonitorCommand
void debugsupport_registerMonitorCommand(ObjectDesc * self, ObjectDesc * name, ObjectDesc * cmd)
{
#if defined(MONITOR)
#if defined(JAVA_MONITOR_COMMANDS)
char value[128];
Proxy *proxy;
u4_t quota = 1000;
DomainDesc *domain = CALLERDOMAIN;
if (name == 0 || cmd == 0)
return;
stringToChar(name, value, sizeof(value));
DISABLE_IRQ;
#ifdef COPY_TO_DOMAINZERO
proxy = cmd;
#else
proxy = copy_reference(domain, curdom(), cmd, "a);
#endif
RESTORE_IRQ;
register_command(value, registerObject(curdom(), proxy), domain);
#endif
#endif /* MONITOR */
}
示例13: setParent
BattleScripting::BattleScripting(QScriptEngine *engine, BaseBattleWindowInterface *_interface)
{
myinterface = _interface;
myengine = engine;
myengine->setParent(this);
setParent(_interface);
registerObject(ProxyDataContainer);
registerObject(TeamProxy);
registerObject(PokeProxy);
registerObject(MoveProxy);
registerObject(AuxPokeDataProxy);
registerObject(FieldProxy);
qScriptRegisterMetaType<BattleChoice>(engine, &toBattleChoice, &fromBattleChoice);
advbattledata_proxy *data = _interface->getBattleData();
ProxyDataContainer *pdata = data->exposedData();
int me = data->isPlayer(1) ? 1 : 0;
int opp = !me;
QScriptValue battle = myengine->newQObject(_interface);
myengine->globalObject().setProperty("battle", battle);
battle.setProperty("data", myengine->newQObject(dynamic_cast<QObject*>(pdata)));
battle.setProperty("me", QScriptValue(me));
battle.setProperty("opp", QScriptValue(opp));
battle.setProperty("id", _interface->battleId());
/* Removes clientscripting' print function and add ours. Client scripting's print function
can still be accessed with sys.print() */
QScriptValue printfun = myengine->newFunction(nativePrint);
printfun.setData(myengine->newQObject(this));
myengine->globalObject().setProperty("print", myengine->nullValue());
myengine->globalObject().setProperty("print", printfun);
_interface->addOutput(this);
}
示例14: registerObject
InputObject::InputObject()
{
registerObject(this) ;
}
示例15: parent
QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& par, const QString& layout )
{
QString parent( par );
if ( parent == "this" && isMainWindow ) {
if ( !createdCentralWidget )
out << indent << "setCentralWidget( new QWidget( this, \"qt_central_widget\" ) );" << endl;
createdCentralWidget = TRUE;
parent = "centralWidget()";
}
QDomElement n;
QString objClass, objName;
int numItems = 0;
int numColumns = 0;
int numRows = 0;
if ( layouts.contains( e.tagName() ) )
return createLayoutImpl( e, parentClass, parent, layout );
objClass = getClassName( e );
if ( objClass.isEmpty() )
return objName;
objName = getObjectName( e );
QString definedName = objName;
bool isTmpObject = objName.isEmpty() || objClass == "QLayoutWidget";
if ( isTmpObject ) {
if ( objClass[0] == 'Q' )
objName = objClass.mid(1);
else
objName = objClass.lower();
objName.prepend( "private" );
}
bool isLine = objClass == "Line";
if ( isLine )
objClass = "QFrame";
out << endl;
if ( objClass == "QLayoutWidget" ) {
if ( layout.isEmpty() ) {
// register the object and unify its name
objName = registerObject( objName );
out << " QWidget* " << objName << " = new QWidget( " << parent << ", \"" << definedName << "\" );" << endl;
} else {
// the layout widget is not necessary, hide it by creating its child in the parent
QString result;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if (tags.contains( n.tagName() ) )
result = createObjectImpl( n, parentClass, parent, layout );
}
return result;
}
} else if ( objClass != "QToolBar" && objClass != "QMenuBar" ) {
// register the object and unify its name
objName = registerObject( objName );
out << " ";
if ( isTmpObject )
out << objClass << "* ";
out << objName << " = new " << createObjectInstance( objClass, parent, objName ) << ";" << endl;
}
if ( objClass == "QAxWidget" ) {
QString controlId;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" && n.attribute( "name" ) == "control" ) {
controlId = n.firstChild().toElement().text();
}
}
out << " ";
out << objName << "->setControl(\"" << controlId << "\");" << endl;
}
lastItem = "0";
// set the properties and insert items
bool hadFrameShadow = FALSE;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" ) {
bool stdset = stdsetdef;
if ( n.hasAttribute( "stdset" ) )
stdset = toBool( n.attribute( "stdset" ) );
QString prop = n.attribute( "name" );
if ( prop == "database" )
continue;
QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset );
if ( value.isEmpty() )
continue;
if ( prop == "name" )
continue;
if ( isLine && prop == "frameShadow" )
hadFrameShadow = TRUE;
if ( prop == "buddy" && value.startsWith("\"") && value.endsWith("\"") ) {
buddies << Buddy( objName, value.mid(1, value.length() - 2 ) );
continue;
}
if ( isLine && prop == "orientation" ) {
prop = "frameShape";
if ( value.right(10) == "Horizontal" )
value = "QFrame::HLine";
else
value = "QFrame::VLine";
//.........这里部分代码省略.........