コード例 #1
0
 SBVStoreDB()
 : TParent(256)
 {
     DisableNull();
     BindKey("thr_id",   &thr_id);
     BindKey("rec_id",   &rec_id);
 }
コード例 #2
0
ファイル: ns_db.hpp プロジェクト: DmitrySigaev/ncbi
 SEventsDB()
 {
     BindKey("id",              &id);
     BindKey("event_id",        &event_id);
     BindData("event",          &event);
     BindData("status",         &status);
     BindData("timestamp",      &timestamp);
     BindData("node_addr",      &node_addr);
     BindData("ret_code",       &ret_code);
     BindData("client_node",    &client_node, kMaxWorkerNodeIdSize);
     BindData("client_session", &client_session, kMaxWorkerNodeIdSize);
     BindData("err_msg",        &err_msg, kNetScheduleMaxDBErrSize);
 }
コード例 #3
0
ファイル: csnpdb.cpp プロジェクト: DmitrySigaev/ncbi
CSnpDbBase::CSnpDbBase( ESeqIdType type, const string& idprefix, const string& idsuffix ) :
    m_seqIdType( type ),
    m_prefix( idprefix ),
    m_suffix( idsuffix )
{
    switch( type ) {
    case eSeqId_integer: BindKey( "intId", &m_intId ); break;
    case eSeqId_string:  BindKey( "strId", &m_stringId ); break;
    }
    BindKey( "pos", &m_pos );
    BindData( "a", m_prob + 0 );
    BindData( "c", m_prob + 1 );
    BindData( "g", m_prob + 2 );
    BindData( "t", m_prob + 3 );
}
コード例 #4
0
void InputManager::Initialize()
{
#define USEINPUTKEY(e,hashVal,text) \
	_keyNameTable[ToUpper(text)] = e;
#include "InputKeys.h"
#undef USEINPUTKEY

	//Clear Xbox Button States
	ClearXboxButtonStates();
	
	StringList bindings;
	GetLinesFromFile("Config/input_bindings.ini", bindings);
	StringList::iterator it = bindings.begin();
	while (it != bindings.end())
	{
		if (((*it).size() == 0) || ((*it)[0] == ';'))
		{
			it++;
			continue;
		}
		StringList splitBinding = SplitString(*it, "=:", false);
		if (splitBinding.size() >= 2)
		{
			splitBinding[0] = TrimString(splitBinding[0]);
			splitBinding[1] = TrimString(splitBinding[1]);
			BindKey(splitBinding[0], splitBinding[1]);
		}
		it++;
	}
}
コード例 #5
0
ファイル: ns_db.hpp プロジェクト: DmitrySigaev/ncbi
    SJobDB()
    {
        DisableNull();

        BindKey("id",                       &id);

        BindData("passport",                &passport);
        BindData("status",                  &status);
        BindData("timeout",                 &timeout);
        BindData("run_timeout",             &run_timeout);
        BindData("read_timeout",            &read_timeout);

        BindData("subm_notif_port",         &subm_notif_port);
        BindData("subm_notif_timeout",      &subm_notif_timeout);

        BindData("listener_notif_addr",     &listener_notif_addr);
        BindData("listener_notif_port",     &listener_notif_port);
        BindData("listener_notif_abstime",  &listener_notif_abstime);

        BindData("run_counter",     &run_counter);
        BindData("read_counter",    &read_counter);
        BindData("aff_id",          &aff_id);
        BindData("mask",            &mask);
        BindData("group_id",        &group_id);
        BindData("last_touch",      &last_touch);
        BindData("input_overflow",  &input_overflow);
        BindData("output_overflow", &output_overflow);
        BindData("input",           &input,          kNetScheduleSplitSize);
        BindData("output",          &output,         kNetScheduleSplitSize);
        BindData("client_ip",       &client_ip,      kMaxClientIpSize);
        BindData("client_sid",      &client_sid,     kMaxSessionIdSize);
        BindData("ncbi_phid",       &ncbi_phid,      kMaxHitIdSize);
        BindData("progress_msg",    &progress_msg,   kNetScheduleMaxDBDataSize);
    }
コード例 #6
0
ファイル: KeyConfig.cpp プロジェクト: transacid/CenterIM5
void KeyConfig::RegisterDefaultKeyBinds()
{
  Clear();

  for (DefaultKeyBinds::iterator i = default_key_binds.begin();
      i != default_key_binds.end(); i++)
    if (!BindKey(i->context.c_str(), i->action.c_str(), i->key.c_str()))
      g_warning(_("Unrecognized key '%s' in default keybinds."),
          i->key.c_str());
}
コード例 #7
0
ファイル: demo1.cpp プロジェクト: DmitrySigaev/ncbi
    // Constructor binds field variables.
    SPhoneBookDB()
    {
        // Bind int primary key. Cannot be NULL.
        BindKey("PersonId", &person_id);

        //  Bind non-PK data fields
        BindData("FirstName", &first_name, 64, eNotNullable);
        BindData("LastName",  &last_name, 64, eNotNullable);
        BindData("Zip",       &zip_code);  // NULLable by default
        BindData("Phone",     &phone, 32); // NULLable by default
    }
コード例 #8
0
ファイル: KeyConfig.cpp プロジェクト: transacid/CenterIM5
void KeyConfig::start_element(GMarkupParseContext *context,
    const char *element_name, const char **attribute_names,
    const char **attribute_values, GError **error)
{
  const GSList *stack = g_markup_parse_context_get_element_stack(context);
  guint size = g_slist_length(const_cast<GSList*>(stack));
  if (size == 1) {
    if (strcmp(element_name, "keyconfig")) {
      *error = g_error_new(g_markup_error_quark(), G_MARKUP_ERROR_PARSE,
          _("Expected 'keyconfig' element, found '%s'"), element_name);
    }
  }
  else if (size == 2) {
    if (strcmp(element_name, "bind")) {
      *error = g_error_new(g_markup_error_quark(), G_MARKUP_ERROR_PARSE,
          _("Expected 'bind' element, found '%s'"), element_name);
      return;
    }

    const char *context;
    const char *action;
    const char *key;
    if (!g_markup_collect_attributes (element_name, attribute_names,
          attribute_values, error,
          G_MARKUP_COLLECT_STRING, "context", &context,
          G_MARKUP_COLLECT_STRING, "action", &action,
          G_MARKUP_COLLECT_STRING, "key", &key,
          G_MARKUP_COLLECT_INVALID))
      return;

    if (!BindKey(context, action, key)) {
      *error = g_error_new(g_markup_error_quark(), G_MARKUP_ERROR_INVALID_CONTENT,
          _("Unrecognized key '%s'"), key);
      return;
    }
  }
  else
    *error = g_error_new(g_markup_error_quark(), G_MARKUP_ERROR_PARSE,
        _("Unexpected element '%s'"), element_name);
}
コード例 #9
0
void FileSelectionDialogState::Initialize() {
	Engine::Logger::Urgent(Engine::LogOrigin::STATE, "Initializing FileSelectionDialogState.");

	mBackgroundShape = sf::Shape::Rectangle(0,0,800,600,sf::Color(0,0,0,128));

	CreateGuiSystem();

	// Load Resources
	auto resmgr = Engine::Root::get_mutable_instance().GetResourceManagerPtr();

	// GUI
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"button.svg", 0.48f, 0.48f, "gui.button");
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"button_hover.svg",	0.48f,	0.48f,	"gui.button_hover");
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"button_focus.svg", 0.48f, 0.48f,	"gui.button_focus");
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"textfield2.svg", 0.24f, 0.24f, "gui.textfield");


	// Gui grid for buttons
	Engine::GuiGrid* grid = new Engine::GuiGrid("debug_grid");
	grid->SetDimension(Engine::Vector2D(160, 100));
	Engine::Vector2D size(Engine::Root::get_mutable_instance().GetWindowSize());
	size -= grid->GetDimension();
	size /= 2;
	grid->SetPosition(size.x, size.y);

	// Resume button
	Engine::GuiButton* b;

	Engine::GuiTextfield* t;

	t = new Engine::GuiTextfield("filename_input");
	grid->AddControl(t);

	Engine::GuiGrid* btn_grid = new Engine::GuiGrid("btn_grid");
	btn_grid->SetDimension(Engine::Vector2D(160, 25));
	btn_grid->SetColumns(2);

	b = new Engine::GuiButton("resume_button");
	b->SetText("Ok");
	b->SetFont(sf::Font::GetDefaultFont());
	b->SetFontSize(13);
	b->SetFontStyle(sf::Text::Regular);
	b->SetFontColor(sf::Color::White);
	b->BindOnClick(boost::bind(&FileSelectionDialogState::OkButton_OnClick, this, _1));
	btn_grid->AddControl(b);

	b = new Engine::GuiButton("exit_button");
	b->SetText("Cancel");
	b->SetFont(sf::Font::GetDefaultFont());
	b->SetFontSize(13);
	b->SetFontStyle(sf::Text::Regular);
	b->SetFontColor(sf::Color::White);
	b->BindOnClick(boost::bind(&FileSelectionDialogState::ExitButton_OnClick, this, _1));
	btn_grid->AddControl(b);

	grid->AddControl(btn_grid);

	mGuiSystems.begin()->AddControl(grid);

	auto inputmgr = Engine::Root::get_mutable_instance().GetInputManagerPtr();
	// Bind Keys
	Engine::KeyBindingCallback cb = boost::bind(&FileSelectionDialogState::OnPressEscape, this);
	inputmgr->BindKey( cb, Engine::KEY_PRESSED, sf::Key::Escape );
}
コード例 #10
0
ファイル: bdb_map.hpp プロジェクト: DmitrySigaev/ncbi
 File(CBDB_File::EDuplicateKeys dup_keys)
 : CBDB_File(dup_keys)
 {
     BindKey("Key", &key);
     BindData("Value", &value, 1024);
 }
コード例 #11
0
 SDemoDB()
 {
     BindKey("key",     &key, 256);
     BindKey("subkey",  &subkey, 256);
 }
コード例 #12
0
 SPhoneBookZipIDX()
 {
     BindKey("Zip", &zip_code);
     BindKey("PersonId", &person_id);
 }
コード例 #13
0
ファイル: KeyBindings.cpp プロジェクト: Belsepubi/naali
 void KeyBindings::BindKey(QKeySequence sequence, std::pair<int,int> event_ids)
 {
     Binding binding(sequence, EventPair(event_ids.first, event_ids.second));
     BindKey(binding);
 }
コード例 #14
0
ファイル: config.c プロジェクト: dimovich/netrix
/*
=====================
	cfExecute
=====================
*/
BOOL cfExecute( char *buffer, int length ) {
	script_t *script;
	token_t token;
	int id;
	BOOL bPerfect, bRes;
	int r, g, b;
	int type;
	TCHAR key[25];
	TCHAR action[25];
	
	
	//check arguments
	if( !buffer ) {
		return FALSE;
	}

	script = L_LoadScriptMemory( buffer, length, "cfg" );
	if( !script ) {
		return FALSE;
	}
	
	script->flags |= SCFL_NOSTRINGWHITESPACES;
	
	bPerfect = TRUE;
	bRes = FALSE;
	while( L_ExpectTokenType( script, TT_IDENTIFIER, 0, &token ) ) {
		//
		//bind
		//
		if( !N_Strnicmp( token.string, CF_BIND, N_Strlen( CF_BIND ) ) ) {
			if( L_ExpectTokenType( script, TT_STRING, 0, &token ) ) {
				L_StripDoubleQuotes( token.string );
				N_Strcpy( key, token.string );
				if( L_ExpectTokenType( script, TT_STRING, 0, &token ) ) {
					L_StripDoubleQuotes( token.string );
					N_Strcpy( action, token.string );
					BindKey( key, action );
				}
			}
		}
		//
		//set
		//
		else if( !N_Strnicmp( token.string, CF_SET, N_Strlen( CF_SET ) ) ) {
	
			if( L_ExpectTokenType( script, TT_IDENTIFIER, 0, &token ) ) {
	
				id = cfSeeID( token.string );
				if( id == INVALID_ID ) {
					bPerfect = FALSE;
					continue;
				}
				type = kcfTable[id].type;
				bRes = FALSE;
				
				switch( type ) {
					//
					//TYPE_COLOR
					//
					case TYPE_COLOR:
						if( !L_ExpectTokenType( script, TT_NUMBER, TT_INTEGER, &token ) ) {
							break;
						}
						r = token.intvalue;
						
						if( !L_ExpectTokenType( script, TT_NUMBER, TT_INTEGER, &token ) ) {
							break;
						}
						g = token.intvalue;
						
						if( !L_ExpectTokenType( script, TT_NUMBER, TT_INTEGER, &token ) ) {
							break;
						}
						b = token.intvalue;

						kcfTable[id].v.dw = RGB( (r+MAX_CLAMP)%MAX_CLAMP,
							(g+MAX_CLAMP)%MAX_CLAMP, (b+MAX_CLAMP)%MAX_CLAMP );

						bRes = TRUE;
						break;
					//
					//TYPE_LONG
					//
					case TYPE_LONG:
						if( !L_ExpectTokenType( script, TT_NUMBER, TT_INTEGER, &token ) ) {
							break;
						}
						kcfTable[id].v.dw = token.intvalue;
						bRes = TRUE;
						break;
					//
					//TYPE_FLOAT
					//
					case TYPE_FLOAT:
						if( !L_ExpectTokenType( script, TT_NUMBER, TT_INTEGER | TT_FLOAT, &token ) ) {
							break;
						}
						kcfTable[id].v.f = token.floatvalue;
						bRes = TRUE;
						break;
					//
					//TYPE_BOOL
					//
					case TYPE_BOOL:
						if( !L_ExpectTokenType( script, TT_NUMBER, TT_INTEGER, &token ) ) {
							break;
						}
						if( token.intvalue ) {
							kcfTable[id].v.b = 1;
						}
						else {
							kcfTable[id].v.b = 0;
						}
						bRes = TRUE;
						break;
					//
					//TYPE_STRING
					//
					case TYPE_STRING:
						if( !L_ExpectTokenType( script, TT_STRING, 0, &token ) ) {
							break;
						}
						L_StripDoubleQuotes( token.string );

						kcfTable[id].v.s = N_Malloc( N_Strlen( token.string ) + 1 );
						N_Strncpy( kcfTable[id].v.s, token.string, N_Strlen( token.string ) );
						bRes = TRUE;
						break;
					
					default:
						break;

				}//switch
				
				if( bRes ) {
					kcfTable[id].modified = TRUE;
				}
				else {
					bPerfect = FALSE;
				}
			}
		}//set
	}//while
	
	L_FreeScript( script );
	
	return bPerfect;
}
コード例 #15
0
ファイル: ns_db.hpp プロジェクト: DmitrySigaev/ncbi
 SJobInfoDB()
 {
     BindKey("id", &id);
     BindData("input",  &input,  kNetScheduleMaxOverflowSize);
     BindData("output", &output, kNetScheduleMaxOverflowSize);
 }
コード例 #16
0
ファイル: bdb_ext_blob.cpp プロジェクト: svn2github/ncbi_tk
CBlobMetaDB::CBlobMetaDB()
: CBDB_BLobFile()
{
    BindKey("id_from", &id_from);
    BindKey("id_to",   &id_to);
}
コード例 #17
0
ファイル: bdb_blob.cpp プロジェクト: DmitrySigaev/ncbi
CBDB_IdBlobFile::CBDB_IdBlobFile(EDuplicateKeys dup_keys,
                                 EDBType        db_type)
: CBDB_BLobFile(dup_keys, db_type)
{
    BindKey("id", &id);
}
コード例 #18
0
ファイル: config.cpp プロジェクト: gamecip/em-fceux
// Bind a HTML5 keyCode with an input ID.
void FCEM_BindKey(int id, int keyIdx)
{
	BindKey(id, keyIdx);
}