本文整理汇总了C++中SetKeyValue函数的典型用法代码示例。如果您正苦于以下问题:C++ SetKeyValue函数的具体用法?C++ SetKeyValue怎么用?C++ SetKeyValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetKeyValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetModelNumbers
/*
============
SetModelNumbers
============
*/
void SetModelNumbers (void)
{
int i;
int models;
char value[10];
models = 1;
for ( i=1 ; i<num_entities ; i++ ) {
if ( entities[i].brushes || entities[i].patches ) {
sprintf ( value, "*%i", models );
models++;
SetKeyValue (&entities[i], "model", value);
}
}
}
示例2: GetMetaValue
int Ardb::ListInsert(Context& ctx, const std::string& key, const std::string* match, const std::string& value,
bool head, bool abort_nonexist)
{
ValueObject meta;
int err = GetMetaValue(ctx, key, LIST_META, meta);
CHECK_ARDB_RETURN_VALUE(ctx.reply, err);
BatchWriteGuard guard(GetKeyValueEngine(), meta.meta.Encoding() != COLLECTION_ENCODING_ZIPLIST);
if (0 != err && abort_nonexist)
{
fill_int_reply(ctx.reply, 0);
return 0;
}
ListInsert(ctx, meta, match, value, head, abort_nonexist);
SetKeyValue(ctx, meta);
return 0;
}
示例3: AddCommandDlgProc
BOOL CALLBACK AddCommandDlgProc (
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
char key[64];
char value[128];
switch (uMsg)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
if (!GetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key, 64))
{
common->Printf ("Command not added\n");
return FALSE;
}
if (!GetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value, 64))
{
common->Printf ("Command not added\n");
return FALSE;
}
if (key[0] == 'b' && key[1] == 's' && key[2] == 'p')
{
SetKeyValue (g_qeglobals.d_project_entity, key, value);
FillBSPMenu ();
}
else
common->Printf ("BSP commands must be preceded by \"bsp\"");
EndDialog(hwndDlg, 1);
return TRUE;
case IDCANCEL:
EndDialog(hwndDlg, 0);
return TRUE;
}
}
return FALSE;
}
示例4: UpdateEntLump
/*
=================
UpdateEntLump
=================
*/
void UpdateEntLump (void)
{
int m, entnum;
char mod[80];
m = 1;
for (entnum = 1 ; entnum < num_entities ; entnum++)
{
if (!entities[entnum].brushes)
continue;
sprintf (mod, "*%i", m);
SetKeyValue (&entities[entnum], "model", mod);
m++;
}
UnparseEntities();
}
示例5: EditCommandDlgProc
BOOL CALLBACK EditCommandDlgProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
) {
char key[1024];
char value[1024];
const char *temp;
int index;
HWND hOwner;
hOwner = GetParent( hwndDlg );
switch( uMsg ) {
case WM_INITDIALOG:
index = SendDlgItemMessage( hOwner, IDC_CMD_LIST, LB_GETCURSEL, 0, 0 );
if( index >= 0 ) {
SendDlgItemMessage( hOwner, IDC_CMD_LIST, LB_GETTEXT, index, ( LPARAM )( LPCTSTR ) key );
temp = ValueForKey( g_qeglobals.d_project_entity, key );
strcpy( value, temp );
SetDlgItemText( hwndDlg, IDC_CMDMENUTEXT, key );
SetDlgItemText( hwndDlg, IDC_CMDCOMMAND, value );
}
return FALSE;
break;
case WM_COMMAND:
switch( LOWORD( wParam ) ) {
case IDOK:
if( !GetDlgItemText( hwndDlg, IDC_CMDMENUTEXT, key, 64 ) ) {
common->Printf( "Command not added\n" );
return FALSE;
}
if( !GetDlgItemText( hwndDlg, IDC_CMDCOMMAND, value, 64 ) ) {
common->Printf( "Command not added\n" );
return FALSE;
}
SetKeyValue( g_qeglobals.d_project_entity, key, value );
FillBSPMenu();
EndDialog( hwndDlg, 1 );
return TRUE;
case IDCANCEL:
EndDialog( hwndDlg, 0 );
return TRUE;
}
}
return FALSE;
}
示例6: sprintf
int QIniFileImpl::WriteMultiFloat(const char* lpSection,
const char* lpKeyName, float *pValues, int nCount)
{
if (nCount > 0 && nCount <= INI_MAX_SUPPORT_MULTI_VALUE_COUNT)
{
char Buffer[INI_MAX_SUPPORT_VALUE_SIZE];
int nPos = sprintf(Buffer, "%f", *pValues);
while(--nCount)
{
pValues++;
Buffer[nPos++] = ',';
nPos += sprintf(Buffer + nPos, "%f", *pValues);
}
return SetKeyValue(lpSection, lpKeyName, Buffer);
}
return false;
}
示例7: Map_New
/*
=======================================================================================================================
Map_New
=======================================================================================================================
*/
void Map_New( void ) {
common->Printf( "Map_New\n" );
Map_Free();
Patch_Cleanup();
g_Inspectors->entityDlg.SetEditEntity( NULL );
world_entity = Entity_New();
world_entity->brushes.onext = world_entity->brushes.oprev = &world_entity->brushes;
SetKeyValue( world_entity, "classname", "worldspawn" );
world_entity->eclass = Eclass_ForName( "worldspawn", true );
g_pParentWnd->GetCamera()->Camera().angles[YAW] = 0;
g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0;
VectorCopy( vec3_origin, g_pParentWnd->GetCamera()->Camera().origin );
g_pParentWnd->GetCamera()->Camera().origin[2] = 48;
VectorCopy( vec3_origin, g_pParentWnd->GetXYWnd()->GetOrigin() );
Map_RestoreBetween();
Sys_UpdateWindows( W_ALL );
mapModified = 0;
g_qeglobals.mapVersion = MAP_VERSION;
}
示例8: SetLightStyles
void SetLightStyles( void ){
int stylenum;
char *t;
entity_t *e;
int i, j;
char value[10];
char lighttargets[MAX_SWITCHED_LIGHTS][64];
// any light that is controlled (has a targetname)
// must have a unique style number generated for it
stylenum = 0;
for ( i = 1 ; i < num_entities ; i++ )
{
e = &entities[i];
t = ValueForKey( e, "classname" );
if ( Q_strncasecmp( t, "light", 5 ) ) {
continue;
}
t = ValueForKey( e, "targetname" );
if ( !t[0] ) {
continue;
}
// find this targetname
for ( j = 0 ; j < stylenum ; j++ )
if ( !strcmp( lighttargets[j], t ) ) {
break;
}
if ( j == stylenum ) {
if ( stylenum == MAX_SWITCHED_LIGHTS ) {
Error( "stylenum == MAX_SWITCHED_LIGHTS" );
}
strcpy( lighttargets[j], t );
stylenum++;
}
sprintf( value, "%i", 32 + j );
SetKeyValue( e, "style", value );
}
}
示例9: UpdateEntLump
/*
=================
UpdateEntLump
=================
*/
void UpdateEntLump (void)
{
int m, entnum;
char mod[80];
m = 1;
for (entnum = 1 ; entnum < num_entities ; entnum++)
{
if (!entities[entnum].brushes)
continue;
sprintf (mod, "*%i", m);
SetKeyValue (&entities[entnum], "model", mod);
m++;
}
printf ("Updating entities lump...\n");
LoadBSPFile (bspfilename);
WriteEntitiesToString();
WriteBSPFile (bspfilename);
}
示例10: QE_LoadProject
/*
=======================================================================================================================
QE_LoadProject
=======================================================================================================================
*/
bool QE_LoadProject(char *projectfile) {
char *data;
ID_TIME_T time;
common->Printf("QE_LoadProject (%s)\n", projectfile);
if ( fileSystem->ReadFile( projectfile, reinterpret_cast < void ** > (&data), &time) <= 0 ) {
return false;
}
g_strProject = projectfile;
g_PrefsDlg.m_strLastProject = projectfile;
g_PrefsDlg.SavePrefs();
CString strData = data;
fileSystem->FreeFile( data );
StartTokenParsing(strData.GetBuffer(0));
g_qeglobals.d_project_entity = Entity_Parse(true);
if (!g_qeglobals.d_project_entity) {
Error("Couldn't parse %s", projectfile);
}
// set here some default project settings you need
if (strlen(ValueForKey(g_qeglobals.d_project_entity, "brush_primit")) == 0) {
SetKeyValue(g_qeglobals.d_project_entity, "brush_primit", "0");
}
g_qeglobals.m_bBrushPrimitMode = IntForKey(g_qeglobals.d_project_entity, "brush_primit");
Eclass_InitForSourceDirectory(ValueForKey(g_qeglobals.d_project_entity, "entitypath"));
g_Inspectors->FillClassList(); // list in entity window
Map_New();
// FillTextureMenu();
FillBSPMenu();
return true;
}
示例11: Entity_Parse
void Entity_Parse( entity_t *pEntity ){
brush_t *pBrush;
// CPtrArray *brushes = NULL;
char temptoken[1024];
char *token = Token();
while ( 1 )
{
GetToken( true ); // { or } or epair
if ( !strcmp( token, "}" ) ) {
break;
}
else if ( !strcmp( token, "{" ) ) {
pBrush = Brush_Alloc();
if ( Primitive_Parse( pBrush ) ) {
( (CPtrArray*)pEntity->pData )->Add( pBrush );
}
else {
Brush_Free( pBrush, true );
}
}
else {
strcpy( temptoken, token );
GetToken( false );
SetKeyValue( pEntity, temptoken, token );
if ( g_MapVersion == MAPVERSION_HL ) {
// if we've not god a "wads" key/pair already, then break it into a list.
if ( !g_WadList && ( stricmp( temptoken,"wad" ) == 0 ) ) {
BuildWadList( token );
}
}
}
}
}
示例12: SetKeyValue
int Ardb::ZipListConvert(Context& ctx, ValueObject& meta)
{
meta.meta.SetEncoding(COLLECTION_ENCODING_RAW);
meta.meta.SetFlag(COLLECTION_FLAG_SEQLIST);
meta.meta.min_index.SetInt64(0);
meta.meta.max_index.SetInt64(meta.meta.ziplist.size() - 1);
for (uint32 i = 0; i < meta.meta.ziplist.size(); i++)
{
ValueObject v;
v.type = LIST_ELEMENT;
v.element = meta.meta.ziplist[i];
v.key.type = LIST_ELEMENT;
v.key.key = meta.key.key;
v.key.db = ctx.currentDB;
v.key.score.SetInt64(i);
SetKeyValue(ctx, v);
}
meta.meta.len = meta.meta.ziplist.size();
meta.meta.ziplist.clear();
return 0;
}
示例13: SetModelNumbers
/*
============
SetModelNumbers
============
*/
void SetModelNumbers (void)
{
int i;
int models;
char value[10];
models = 1;
for (i=1 ; i<num_entities ; i++)
{
if (!entities[i].numbrushes)
continue;
if ( !IsFuncOccluder(i) )
{
sprintf (value, "*%i", models);
models++;
}
else
{
sprintf (value, "");
}
SetKeyValue (&entities[i], "model", value);
}
}
示例14: SetLightStyles
void SetLightStyles( void )
{
int i, j, style, numStyles;
qboolean keepLights;
const char *t;
entity_t *e;
epair_t *ep, *next;
char value[ 10 ];
char lightTargets[ MAX_SWITCHED_LIGHTS ][ 64 ];
int lightStyles[ MAX_SWITCHED_LIGHTS ];
/* ydnar: determine if we keep lights in the bsp */
t = ValueForKey( &entities[ 0 ], "_keepLights" );
keepLights = (t[ 0 ] == '1') ? qtrue : qfalse;
/* any light that is controlled (has a targetname) must have a unique style number generated for it */
numStyles = 0;
for( i = 1; i < numEntities; i++ )
{
e = &entities[ i ];
t = ValueForKey( e, "classname" );
if( Q_strncasecmp( t, "light", 5 ) )
continue;
t = ValueForKey( e, "targetname" );
if( t[ 0 ] == '\0' )
{
/* ydnar: strip the light from the BSP file */
if( keepLights == qfalse )
{
ep = e->epairs;
while( ep != NULL )
{
next = ep->next;
free( ep->key );
free( ep->value );
free( ep );
ep = next;
}
e->epairs = NULL;
numStrippedLights++;
}
/* next light */
continue;
}
/* get existing style */
style = IntForKey( e, "style" );
if( style < LS_NORMAL || style > LS_NONE )
Error( "Invalid lightstyle (%d) on entity %d", style, i );
/* find this targetname */
for( j = 0; j < numStyles; j++ )
if( lightStyles[ j ] == style && !strcmp( lightTargets[ j ], t ) )
break;
/* add a new style */
if( j >= numStyles )
{
if( numStyles == MAX_SWITCHED_LIGHTS )
Error( "MAX_SWITCHED_LIGHTS (%d) exceeded, reduce the number of lights with targetnames", MAX_SWITCHED_LIGHTS );
strcpy( lightTargets[ j ], t );
lightStyles[ j ] = style;
numStyles++;
}
/* set explicit style */
sprintf( value, "%d", 32 + j );
SetKeyValue( e, "style", value );
/* set old style */
if( style != LS_NORMAL )
{
sprintf( value, "%d", style );
SetKeyValue( e, "switch_style", value );
}
}
/* emit some statistics */
Sys_FPrintf( SYS_VRB, "%9d light entities stripped\n", numStrippedLights );
}
示例15: Map_ImportEntities
//.........这里部分代码省略.........
}
Brush_Resize( b, mins, maxs );
Brush_Build( b );
}
}
#endif
// add brush for fixedsize entity
if ( e->eclass->fixedsize ) {
vec3_t mins, maxs;
VectorAdd( e->eclass->mins, e->origin, mins );
VectorAdd( e->eclass->maxs, e->origin, maxs );
b = Brush_Create( mins, maxs, &e->eclass->texdef );
Entity_LinkBrush( e, b );
Brush_Build( b );
}
for ( b = e->brushes.onext; b != &e->brushes; b = b->onext )
Brush_AddToList( b, pBrushList );
if ( strcmp( e->eclass->name, "worldspawn" ) == 0 ) {
if ( world_entity ) {
while ( e->brushes.onext != &e->brushes )
{
b = e->brushes.onext;
Entity_UnlinkBrush( b );
Entity_LinkBrush( world_entity, b );
}
Entity_Free( e );
}
else
{
world_entity = e;
}
}
else if ( strcmp( e->eclass->name, "group_info" ) == 0 ) {
// it's a group thing!
Group_Add( e );
Entity_Free( e );
}
else
{
// fix target/targetname collisions
if ( ( g_PrefsDlg.m_bDoTargetFix ) && ( strcmp( ValueForKey( e, "target" ), "" ) != 0 ) ) {
GPtrArray *t_ents = g_ptr_array_new();
entity_t *e_target;
const char *target = ValueForKey( e, "target" );
qboolean bCollision = FALSE;
// check the current map entities for an actual collision
for ( e_target = entities.next; e_target != &entities; e_target = e_target->next )
{
if ( !strcmp( target, ValueForKey( e_target, "target" ) ) ) {
bCollision = TRUE;
// make sure the collision is not between two imported entities
for ( j = 0; j < (int)new_ents->len; j++ )
{
if ( e_target == g_ptr_array_index( new_ents, j ) ) {
bCollision = FALSE;
}
}
}
}
// find the matching targeted entity(s)
if ( bCollision ) {
for ( j = num_ents - 1; j > 0; j-- )
{
e_target = (entity_t*)ents->GetAt( j );
if ( e_target != NULL && e_target != e ) {
const char *targetname = ValueForKey( e_target, "targetname" );
if ( ( targetname != NULL ) && ( strcmp( target, targetname ) == 0 ) ) {
g_ptr_array_add( t_ents, (gpointer)e_target );
}
}
}
if ( t_ents->len > 0 ) {
// link the first to get a unique target/targetname
Entity_Connect( e, (entity_t*)g_ptr_array_index( t_ents,0 ) );
// set the targetname of the rest of them manually
for ( j = 1; j < (int)t_ents->len; j++ )
SetKeyValue( (entity_t*)g_ptr_array_index( t_ents, j ), "targetname", ValueForKey( e, "target" ) );
}
g_ptr_array_free( t_ents, FALSE );
}
}
// add the entity to the end of the entity list
Entity_AddToList( e, &entities );
g_qeglobals.d_num_entities++;
// keep a list of ents added to avoid testing collisions against them
g_ptr_array_add( new_ents, (gpointer)e );
}
}
g_ptr_array_free( new_ents, FALSE );
ents->RemoveAll();
g_qeglobals.bNeedConvert = false;
}