当前位置: 首页>>代码示例>>C++>>正文


C++ ConfigStorage类代码示例

本文整理汇总了C++中ConfigStorage的典型用法代码示例。如果您正苦于以下问题:C++ ConfigStorage类的具体用法?C++ ConfigStorage怎么用?C++ ConfigStorage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConfigStorage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: changeFlags

bool TraceSvcJrd::changeFlags(ULONG id, int setFlags, int clearFlags)
{
	ConfigStorage* storage = TraceManager::getStorage();
	StorageGuard guard(storage);

	storage->restart();

	TraceSession session(*getDefaultMemoryPool());
	while (storage->getNextSession(session))
	{
		if (id != session.ses_id)
			continue;

		if (m_admin || m_user == session.ses_user)
		{
			const int saveFlags = session.ses_flags;

			session.ses_flags |= setFlags;
			session.ses_flags &= ~clearFlags;

			if (saveFlags != session.ses_flags) {
				storage->updateSession(session);
			}

			return true;
		}

		m_svc.printf(false, "No permissions to change other user trace session\n");
		return false;
	}

	m_svc.printf(false, "Trace session ID %d not found\n", id);
	return false;
}
开发者ID:glaubitz,项目名称:firebird,代码行数:34,代码来源:TraceService.cpp

示例2: checkAliveAndFlags

bool TraceSvcJrd::checkAliveAndFlags(ULONG sesId, int& flags)
{
	ConfigStorage* storage = TraceManager::getStorage();

	bool alive = (m_chg_number == storage->getChangeNumber());
	if (!alive)
	{
		// look if our session still alive
		StorageGuard guard(storage);

		TraceSession readSession(*getDefaultMemoryPool());
		storage->restart();
		while (storage->getNextSession(readSession))
		{
			if (readSession.ses_id == sesId)
			{
				alive = true;
				flags = readSession.ses_flags;
				break;
			}
		}

		m_chg_number = storage->getChangeNumber();
	}

	return alive;
}
开发者ID:glaubitz,项目名称:firebird,代码行数:27,代码来源:TraceService.cpp

示例3: stopSession

void TraceSvcJrd::stopSession(ULONG id)
{
	m_svc.started();

	ConfigStorage* storage = TraceManager::getStorage();
	StorageGuard guard(storage);

	storage->restart();

	TraceSession session(*getDefaultMemoryPool());
	while (storage->getNextSession(session))
	{
		if (id != session.ses_id)
			continue;

		if (m_admin || m_user == session.ses_user)
		{
			storage->removeSession(id);
			m_svc.printf(false, "Trace session ID %ld stopped\n", id);
		}
		else
			m_svc.printf(false, "No permissions to stop other user trace session\n");

		return;
	}

	m_svc.printf(false, "Trace session ID %d not found\n", id);
}
开发者ID:glaubitz,项目名称:firebird,代码行数:28,代码来源:TraceService.cpp

示例4: startSession

void TraceSvcJrd::startSession(TraceSession& session, bool interactive)
{
	if (!TraceManager::pluginsCount())
	{
		m_svc.printf(false, "Can not start trace session. There are no trace plugins loaded\n");
		return;
	}

	ConfigStorage* storage = TraceManager::getStorage();

	{	// scope
		StorageGuard guard(storage);

		session.ses_auth = m_authBlock;
		session.ses_user = m_user;
		MetaName role = m_role;
		UserId::makeRoleName(role, SQL_DIALECT_V6);
		session.ses_role = role.c_str();

		session.ses_flags = trs_active;
		if (m_admin) {
			session.ses_flags |= trs_admin;
		}

		if (interactive)
		{
			Guid guid;
			GenerateGuid(&guid);

			char* buff = session.ses_logfile.getBuffer(GUID_BUFF_SIZE);
			GuidToString(buff, &guid);

			session.ses_logfile.insert(0, "fb_trace.");
		}

		storage->addSession(session);
		m_chg_number = storage->getChangeNumber();
	}

	m_svc.started();
	m_svc.printf(false, "Trace session ID %ld started\n", session.ses_id);

	if (interactive)
	{
		readSession(session);
		{
			StorageGuard guard(storage);
			storage->removeSession(session.ses_id);
		}
	}
}
开发者ID:glaubitz,项目名称:firebird,代码行数:51,代码来源:TraceService.cpp

示例5: listSessions

void TraceSvcJrd::listSessions()
{
	m_svc.started();

	ConfigStorage* storage = TraceManager::getStorage();
	StorageGuard guard(storage);

	storage->restart();

	TraceSession session(*getDefaultMemoryPool());
	while (storage->getNextSession(session))
	{
		if (m_admin || m_user == session.ses_user)
		{
			m_svc.printf(false, "\nSession ID: %d\n", session.ses_id);
			if (!session.ses_name.empty()) {
				m_svc.printf(false, "  name:  %s\n", session.ses_name.c_str());
			}
			m_svc.printf(false, "  user:  %s\n", session.ses_user.c_str());

			struct tm* t = localtime(&session.ses_start);
			m_svc.printf(false, "  date:  %04d-%02d-%02d %02d:%02d:%02d\n",
					t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
					t->tm_hour, t->tm_min, t->tm_sec);

			string flags;
			if (session.ses_flags & trs_active) {
				flags = "active";
			}
			else {
				flags = "suspend";
			}
			if (session.ses_flags & trs_admin) {
				flags += ", admin";
			}
			if (session.ses_flags & trs_system) {
				flags += ", system";
			}
			if (session.ses_logfile.empty()) {
				flags += ", audit";
			}
			else {
				flags += ", trace";
			}
			if (session.ses_flags & trs_log_full) {
				flags += ", log full";
			}
			m_svc.printf(false, "  flags: %s\n", flags.c_str());
		}
	}
}
开发者ID:glaubitz,项目名称:firebird,代码行数:51,代码来源:TraceService.cpp

示例6: CredentialsManager

void
AccountManager::loadFromConfig()
{
    m_creds = new CredentialsManager( this );

    ConfigStorage* localCS = new LocalConfigStorage( this );
    m_configStorageById.insert( localCS->id(), localCS );

    QList< QObject* > configStoragePlugins = Tomahawk::Utils::PluginLoader( "configstorage" ).loadPlugins().values();
    foreach( QObject* plugin, configStoragePlugins )
    {
        ConfigStorage* cs = qobject_cast< ConfigStorage* >( plugin );
        if ( !cs )
            continue;

        m_configStorageById.insert( cs->id(), cs );
    }
开发者ID:ajgappmark,项目名称:tomahawk,代码行数:17,代码来源:AccountManager.cpp

示例7: liveSessions

void TraceManager::update_sessions()
{
	SortedArray<ULONG> liveSessions(*getDefaultMemoryPool());

	{	// scope
		ConfigStorage* storage = getStorage();

		StorageGuard guard(storage);
		storage->restart();

		TraceSession session(*getDefaultMemoryPool());
		while (storage->getNextSession(session))
		{
			if ((session.ses_flags & trs_active) && !(session.ses_flags & trs_log_full))
			{
				update_session(session);
				liveSessions.add(session.ses_id);
			}
		}

		changeNumber = storage->getChangeNumber();
	}

	// remove sessions not present in storage
	FB_SIZE_T i = 0;
	while (i < trace_sessions.getCount())
	{
		FB_SIZE_T pos;
		if (liveSessions.find(trace_sessions[i].ses_id, pos)) {
			i++;
		}
		else
		{
			trace_sessions[i].plugin->release();
			trace_sessions.remove(i);
		}
	}

	// nothing to trace, clear needs
	if (trace_sessions.getCount() == 0)
	{
		trace_needs = 0;
	}
}
开发者ID:Alexpux,项目名称:firebird,代码行数:44,代码来源:TraceManager.cpp

示例8: exit

void MultiBouncerGame::initGUI()
{	
	//TODO: Filesystem tools
	//Clear file names
	m_MapFiles.clear();
	
	if( !filesystem::exists( "maps" ) )
	{
		std::cout << "Directory maps does not exist!" << std::endl;
		exit( EXIT_FAILURE );
	}
	
	//Read bouncer and map file names
	filesystem::directory_iterator end;
	for( filesystem::directory_iterator x( "maps" ); x != end; x++ )
		m_MapFiles.push_back( x->path() );
	
	for( unsigned int x = 0; x < m_MapFiles.size(); x++ )
	{
		ConfigStorage *conf = new ConfigStorage();
		conf->parseXMLFile( m_MapFiles.at( x ).string().c_str(), "Data" );
		m_MapData.push_back( conf );
	}
	
	//Get gui environment
	//TODO: Add a better method for gui management
	IGUIEnvironment *gui = m_Engine->getIrrlichtDevice()->getGUIEnvironment();
	
	//some defines for easier size definitions
	#define W mWinWidth
	#define H mWindHeight
	#define W2 (W/2)
	#define H2 (H/2)
	#define W4 (W/4)
	#define H4 (H/4)
	
	//Add main menu window
	m_MainMenu = gui->addWindow( 
		recti( 20, 20, W - 20, H - 20 ),
		false, L"MainMenu" );
	m_MainMenu->getCloseButton()->setVisible( false );
	m_MainMenu->setDraggable( false );
	m_MainMenu->setDrawTitlebar( false );

	//Add the reconnect button
	mReconnectButton = gui->addButton( recti( 10, 10, 410, 60 ),
		m_MainMenu, -1, L"(Re)connect wiimotes" );
	mReconnectButton->setVisible( m_Engine->getConfig()->get<bool>( "UseWiimotes", false ) );
	
	//Add the bouncer list
	m_MapList = gui->addListBox( recti( W4, H4, 3 * W4, 3 * H4 ), 
		m_MainMenu, -1, true );
	for( unsigned int x = 0; x < m_MapFiles.size(); x++ )
		m_MapList->addItem( stringw( 
		m_MapData.at( x )->get<String>( "MapName", "No Name!" ) ).c_str() );
	
	m_OkButton = gui->addButton( recti( W4, 3 * H4 + 10, W2 - 5, 3 * H4 + 60 ), 
		m_MainMenu, -1, L"Start" );
	
	m_PlayerCounter = gui->addSpinBox( L"Spieleranzahl:", 
		recti( W2 + 4, 3 * H4 + 10, 3 * W4, 3 * H4 + 60 ), true, m_MainMenu );
	m_PlayerCounter->getEditBox()->setTextAlignment( irr::gui::EGUIA_CENTER, 
		irr::gui::EGUIA_CENTER );
	m_PlayerCounter->setDecimalPlaces( 0 );
	m_PlayerCounter->setRange( 1.f, 32.f );
	m_PlayerCounter->setValue( 2.f );
	
	//Create ingame gui
	
	//Upper window for scores etc.
	mScoreWindow = gui->addWindow( recti( 0, 0, W, 50 ) );
	mScoreWindow->setDraggable( false );
	mScoreWindow->setDrawTitlebar( false );
	mScoreWindow->getCloseButton()->setVisible( false );
	
	mScoreCounter = gui->addStaticText( TEXT_SCORE_ZERO, 
		recti( W4, 0, 3 * W4, 50 ), false, false, mScoreWindow );
	mScoreCounter->setTextAlignment( irr::gui::EGUIA_CENTER, 
		irr::gui::EGUIA_CENTER );
	mScoreCounter->setOverrideColor( SColor( 255, 255, 255, 255 ) );
	
	//undefine sizes
	#undef W
	#undef H
	#undef W2
	#undef H2
	#undef W4
	#undef H4
	
	//hide all windows
	m_MainMenu->setVisible( false );
	mScoreWindow->setVisible( false );
}
开发者ID:feelx88,项目名称:PulsarEngine,代码行数:93,代码来源:MultiBouncerGame.cpp


注:本文中的ConfigStorage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。