Document all FOREACH loops.
This commit is contained in:
@@ -33,6 +33,7 @@ enum SongSort
|
||||
SongSort_LowestGrades,
|
||||
NUM_SongSort,
|
||||
};
|
||||
/** @brief Loop through the various Song Sorts. */
|
||||
#define FOREACH_SongSort( i ) FOREACH_ENUM( SongSort, i )
|
||||
const RString& SongSortToString( SongSort ss );
|
||||
const RString& SongSortToLocalizedString( SongSort ss );
|
||||
|
||||
@@ -26,6 +26,7 @@ Difficulty DwiCompatibleStringToDifficulty( const RString& sDC );
|
||||
|
||||
typedef Difficulty CourseDifficulty;
|
||||
const int NUM_CourseDifficulty = NUM_Difficulty;
|
||||
/** @brief Loop through the shown course difficulties. */
|
||||
#define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=Difficulty_Invalid; cd=GetNextShownCourseDifficulty(cd) )
|
||||
|
||||
const RString& CourseDifficultyToLocalizedString( Difficulty dc );
|
||||
|
||||
@@ -23,6 +23,7 @@ enum EditMenuRow
|
||||
ROW_ACTION,
|
||||
NUM_EditMenuRow
|
||||
};
|
||||
/** @brief Loop through each EditMenuRow. */
|
||||
#define FOREACH_EditMenuRow( r ) FOREACH_ENUM( EditMenuRow, r )
|
||||
const RString& EditMenuRowToString( EditMenuRow r );
|
||||
const RString& EditMenuRowToLocalizedString( EditMenuRow r );
|
||||
|
||||
+6
-2
@@ -10,7 +10,9 @@ extern "C"
|
||||
#include "lua-5.1/src/lua.h"
|
||||
}
|
||||
|
||||
/** @brief A general foreach loop for enumerators, going up to a max value. */
|
||||
#define FOREACH_ENUM_N( e, max, var ) for( e var=(e)0; var<max; enum_add<e>( var, +1 ) )
|
||||
/** @brief A general foreach loop for enumerators. */
|
||||
#define FOREACH_ENUM( e, var ) for( e var=(e)0; var<NUM_##e; enum_add<e>( var, +1 ) )
|
||||
|
||||
int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const char *szType, bool bAllowInvalid );
|
||||
@@ -126,8 +128,10 @@ namespace LuaHelpers { template<> void Push<X>( lua_State *L, const X &Object )
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004-2006 Chris Danford, Glenn Maynard
|
||||
/**
|
||||
* @file
|
||||
* @author Chris Danford, Glenn Maynard (c) 2004-2006
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
||||
+17
-2
@@ -1,38 +1,53 @@
|
||||
#ifndef Foreach_H
|
||||
#define Foreach_H
|
||||
|
||||
/** @brief General foreach loop iterating over a vector. */
|
||||
#define FOREACH( elemType, vect, var ) \
|
||||
for( vector<elemType>::iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
/** @brief General foreach loop iterating over a vector, using a constant iterator. */
|
||||
#define FOREACH_CONST( elemType, vect, var ) \
|
||||
for( vector<elemType>::const_iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
|
||||
/** @brief General foreach loop iterating over a deque. */
|
||||
#define FOREACHD( elemType, vect, var ) \
|
||||
for( deque<elemType>::iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
/** @brief General foreach loop iterating over a deque, using a constant iterator. */
|
||||
#define FOREACHD_CONST( elemType, vect, var ) \
|
||||
for( deque<elemType>::const_iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
|
||||
/** @brief General foreach loop iterating over a set. */
|
||||
#define FOREACHS( elemType, vect, var ) \
|
||||
for( set<elemType>::iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
/** @brief General foreach loop iterating over a set, using a constant iterator. */
|
||||
#define FOREACHS_CONST( elemType, vect, var ) \
|
||||
for( set<elemType>::const_iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
|
||||
/** @brief General foreach loop iterating over a list. */
|
||||
#define FOREACHL( elemType, vect, var ) \
|
||||
for( list<elemType>::iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
/** @brief General foreach loop iterating over a list, using a constant iterator. */
|
||||
#define FOREACHL_CONST( elemType, vect, var ) \
|
||||
for( list<elemType>::const_iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
|
||||
/** @brief General foreach loop iterating over a map. */
|
||||
#define FOREACHM( keyType, valType, vect, var ) \
|
||||
for( map<keyType, valType>::iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
/** @brief General foreach loop iterating over a map, using a constant iterator. */
|
||||
#define FOREACHM_CONST( keyType, valType, vect, var ) \
|
||||
for( map<keyType, valType>::const_iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
|
||||
/** @brief General foreach loop iterating over a multimap. */
|
||||
#define FOREACHMM( keyType, valType, vect, var ) \
|
||||
for( multimap<keyType, valType>::iterator var = (vect).begin(); var != (vect).end(); ++var )
|
||||
|
||||
/* Hmm...any reason why there is no FOREACHMM_CONST? */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004-2005 Chris Danford
|
||||
/**
|
||||
* @file
|
||||
* @author Chris Danford (c) 2004-2005
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
||||
@@ -662,6 +662,7 @@ enum CourseType
|
||||
NUM_CourseType,
|
||||
CourseType_Invalid
|
||||
};
|
||||
/** @brief A special iterator for handling the CourseTypes. */
|
||||
#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, i )
|
||||
const RString& CourseTypeToString( CourseType i );
|
||||
const RString& CourseTypeToLocalizedString( CourseType i );
|
||||
|
||||
@@ -58,6 +58,7 @@ RString GameButtonToString( const InputScheme* pInputs, GameButton i );
|
||||
RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i );
|
||||
GameButton StringToGameButton( const InputScheme* pInputs, const RString& s );
|
||||
|
||||
/** @brief A special way to loop through each game button. */
|
||||
#define FOREACH_GameButton_Custom( gb ) for( GameButton gb=GAME_BUTTON_CUSTOM_01; gb<NUM_GameButton; enum_add(gb, +1) )
|
||||
|
||||
#define GAME_BUTTON_NEXT GAME_BUTTON_CUSTOM_01
|
||||
|
||||
+12
-7
@@ -364,16 +364,21 @@ PlayerNumber GetNextHumanPlayer( PlayerNumber pn );
|
||||
PlayerNumber GetNextEnabledPlayer( PlayerNumber pn );
|
||||
PlayerNumber GetNextCpuPlayer( PlayerNumber pn );
|
||||
PlayerNumber GetNextPotentialCpuPlayer( PlayerNumber pn );
|
||||
|
||||
#define FOREACH_HumanPlayer( pn ) for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextHumanPlayer(pn) )
|
||||
#define FOREACH_EnabledPlayer( pn ) for( PlayerNumber pn=GetNextEnabledPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextEnabledPlayer(pn) )
|
||||
#define FOREACH_CpuPlayer( pn ) for( PlayerNumber pn=GetNextCpuPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextCpuPlayer(pn) )
|
||||
#define FOREACH_PotentialCpuPlayer( pn ) for( PlayerNumber pn=GetNextPotentialCpuPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextPotentialCpuPlayer(pn) )
|
||||
|
||||
|
||||
MultiPlayer GetNextEnabledMultiPlayer( MultiPlayer mp );
|
||||
|
||||
/** @brief A foreach loop to act on each human Player. */
|
||||
#define FOREACH_HumanPlayer( pn ) for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextHumanPlayer(pn) )
|
||||
/** @brief A foreach loop to act on each enabled Player. */
|
||||
#define FOREACH_EnabledPlayer( pn ) for( PlayerNumber pn=GetNextEnabledPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextEnabledPlayer(pn) )
|
||||
/** @brief A foreach loop to act on each CPU Player. */
|
||||
#define FOREACH_CpuPlayer( pn ) for( PlayerNumber pn=GetNextCpuPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextCpuPlayer(pn) )
|
||||
/** @brief A foreach loop to act on each potential CPU Player. */
|
||||
#define FOREACH_PotentialCpuPlayer( pn ) for( PlayerNumber pn=GetNextPotentialCpuPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextPotentialCpuPlayer(pn) )
|
||||
/** @brief A foreach loop to act on each Player in MultiPlayer. */
|
||||
#define FOREACH_EnabledMultiPlayer( mp ) for( MultiPlayer mp=GetNextEnabledMultiPlayer((MultiPlayer)-1); mp!=MultiPlayer_Invalid; mp=GetNextEnabledMultiPlayer(mp) )
|
||||
|
||||
|
||||
|
||||
extern GameState* GAMESTATE; // global and accessable from anywhere in our program
|
||||
|
||||
#endif
|
||||
|
||||
@@ -68,6 +68,7 @@ LuaDeclareType( Grade );
|
||||
extern ThemeMetric<int> NUM_GRADE_TIERS_USED;
|
||||
#define NUM_POSSIBLE_GRADES (NUM_GRADE_TIERS_USED+1)
|
||||
Grade GetNextPossibleGrade( Grade g );
|
||||
/** @brief Loop through each possible Grade. */
|
||||
#define FOREACH_PossibleGrade( g ) for( Grade g = (Grade)(0); g != Grade_Invalid; g = GetNextPossibleGrade(g) )
|
||||
|
||||
#endif
|
||||
|
||||
@@ -129,6 +129,7 @@ public:
|
||||
const GameButtonInfo *GetGameButtonInfo( GameButton gb ) const;
|
||||
const char *GetGameButtonName( GameButton gb ) const;
|
||||
};
|
||||
/** @brief A special foreach loop to handle the various GameButtons. */
|
||||
#define FOREACH_GameButtonInScheme( s, var ) for( GameButton var=(GameButton)0; var<s->m_iButtonsPerController; enum_add<GameButton>( var, +1 ) )
|
||||
|
||||
class InputMappings
|
||||
|
||||
@@ -23,6 +23,7 @@ enum CabinetLight
|
||||
NUM_CabinetLight,
|
||||
CabinetLight_Invalid
|
||||
};
|
||||
/** @brief Loop through each CabinetLight on the machine. */
|
||||
#define FOREACH_CabinetLight( i ) FOREACH_ENUM( CabinetLight, i )
|
||||
const RString& CabinetLightToString( CabinetLight cl );
|
||||
CabinetLight StringToCabinetLight( const RString& s);
|
||||
|
||||
+9
-7
@@ -157,19 +157,21 @@ private:
|
||||
LuaReference *m_pOldValue;
|
||||
};
|
||||
|
||||
/* Iterate over all elements in the table. For safety reasons, the key is pushed onto
|
||||
* the stack and can be read (safely) as a string and popped or altered in any way.
|
||||
* Stack management is handled automatically. That is, you need not remove all stack
|
||||
* elements above the key. Once the loop exits normally, the top of the stack will be
|
||||
* where it was before. If you break out of the loop early, you need to handle that
|
||||
* explicitly. */
|
||||
/**
|
||||
* @brief Iterate over all elements in the table.
|
||||
*
|
||||
* For safety reasons, the key is pushed onto the stack and can be read (safely)
|
||||
* as a string and popped or altered in any way. Stack management is handled
|
||||
* automatically. That is, you need not remove all stack elements above the key.
|
||||
* Once the loop exits normally, the top of the stack will be where it was before.
|
||||
* If you break out of the loop early, you need to handle that explicitly. */
|
||||
#define FOREACH_LUATABLE(L,index) \
|
||||
for( const int UNIQUE_NAME(tab) = LuaHelpers::AbsIndex(L,index), \
|
||||
UNIQUE_NAME(top) = (lua_pushnil(L),lua_gettop(L)); \
|
||||
lua_next(L, UNIQUE_NAME(tab)) && (lua_pushvalue(L,-2),true); \
|
||||
lua_settop(L,UNIQUE_NAME(top)) )
|
||||
|
||||
/* Iterate over the array elements of a table. */
|
||||
/** @brief Iterate over the array elements of a table. */
|
||||
#define FOREACH_LUATABLEI(L, index, i) \
|
||||
for( int UNIQUE_NAME(tab) = LuaHelpers::AbsIndex(L,index), \
|
||||
UNIQUE_NAME(top) = lua_gettop(L), i = 1; \
|
||||
|
||||
@@ -74,6 +74,7 @@ enum NSScoreBoardColumn
|
||||
NUM_NSScoreBoardColumn,
|
||||
NSScoreBoardColumn_Invalid
|
||||
};
|
||||
/** @brief A special foreach loop going through each NSScoreBoardColumn. */
|
||||
#define FOREACH_NSScoreBoardColumn( sc ) FOREACH_ENUM( NSScoreBoardColumn, sc )
|
||||
|
||||
struct NetServerInfo
|
||||
|
||||
+7
-2
@@ -1,5 +1,3 @@
|
||||
/* NoteData - Holds data about the notes that the player is supposed to hit. */
|
||||
|
||||
#ifndef NOTE_DATA_H
|
||||
#define NOTE_DATA_H
|
||||
|
||||
@@ -8,17 +6,24 @@
|
||||
#include <set>
|
||||
#include <iterator>
|
||||
|
||||
/** @brief Act on each non empty row in the specific track. */
|
||||
#define FOREACH_NONEMPTY_ROW_IN_TRACK( nd, track, row ) \
|
||||
for( int row = -1; (nd).GetNextTapNoteRowForTrack(track,row); )
|
||||
/** @brief Act on each non empty row in the specified track within the specified range. */
|
||||
#define FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( nd, track, row, start, last ) \
|
||||
for( int row = start-1; (nd).GetNextTapNoteRowForTrack(track,row) && row < (last); )
|
||||
/** @brief Act on each non empty row in the specified track within the specified range,
|
||||
going in reverse order. */
|
||||
#define FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE_REVERSE( nd, track, row, start, last ) \
|
||||
for( int row = last; (nd).GetPrevTapNoteRowForTrack(track,row) && row >= (start); )
|
||||
/** @brief Act on each non empty row for all of the tracks. */
|
||||
#define FOREACH_NONEMPTY_ROW_ALL_TRACKS( nd, row ) \
|
||||
for( int row = -1; (nd).GetNextTapNoteRowForAllTracks(row); )
|
||||
/** @brief Act on each non empty row for all of the tracks within the specified range. */
|
||||
#define FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( nd, row, start, last ) \
|
||||
for( int row = start-1; (nd).GetNextTapNoteRowForAllTracks(row) && row < (last); )
|
||||
|
||||
/** @brief Holds data about the notes that the player is supposed to hit. */
|
||||
class NoteData
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "RageMath.h"
|
||||
|
||||
const RString& NoteNotePartToString( NotePart i );
|
||||
/** @brief A foreach loop going through the different NoteParts. */
|
||||
#define FOREACH_NotePart( i ) FOREACH_ENUM( NotePart, i )
|
||||
|
||||
static const char *NotePartNames[] = {
|
||||
|
||||
@@ -56,6 +56,7 @@ enum HoldType
|
||||
NUM_HoldType,
|
||||
HoldType_Invalid
|
||||
};
|
||||
/** @brief Loop through each HoldType. */
|
||||
#define FOREACH_HoldType( i ) FOREACH_ENUM( HoldType, i )
|
||||
const RString &HoldTypeToString( HoldType ht );
|
||||
|
||||
@@ -66,6 +67,7 @@ enum ActiveType
|
||||
NUM_ActiveType,
|
||||
ActiveType_Invalid
|
||||
};
|
||||
/** @brief Loop through each ActiveType. */
|
||||
#define FOREACH_ActiveType( i ) FOREACH_ENUM( ActiveType, i )
|
||||
const RString &ActiveTypeToString( ActiveType at );
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ const PlayerNumber PLAYER_INVALID = PlayerNumber_Invalid;
|
||||
const RString& PlayerNumberToString( PlayerNumber pn );
|
||||
const RString& PlayerNumberToLocalizedString( PlayerNumber pn );
|
||||
LuaDeclareType( PlayerNumber );
|
||||
|
||||
/** @brief A foreach loop to handle the different players. */
|
||||
#define FOREACH_PlayerNumber( pn ) FOREACH_ENUM( PlayerNumber, pn )
|
||||
|
||||
const PlayerNumber OPPOSITE_PLAYER[NUM_PLAYERS] = { PLAYER_2, PLAYER_1 };
|
||||
@@ -65,7 +65,7 @@ enum MultiPlayer
|
||||
const RString& MultiPlayerToString( MultiPlayer mp );
|
||||
const RString& MultiPlayerToLocalizedString( MultiPlayer mp );
|
||||
LuaDeclareType( MultiPlayer );
|
||||
|
||||
/** @brief A foreach loop to handle the different Players in MultiPlayer. */
|
||||
#define FOREACH_MultiPlayer( pn ) FOREACH_ENUM( MultiPlayer, pn )
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,8 +48,9 @@ enum InputDevice
|
||||
DEVICE_MIDI,
|
||||
DEVICE_MOUSE,
|
||||
NUM_InputDevice, // leave this at the end
|
||||
InputDevice_Invalid // means this is NULL
|
||||
InputDevice_Invalid // means this is NULL
|
||||
};
|
||||
/** @brief A special foreach loop for each input device. */
|
||||
#define FOREACH_InputDevice( i ) FOREACH_ENUM( InputDevice, i )
|
||||
const RString& InputDeviceToString( InputDevice i );
|
||||
InputDevice StringToInputDevice( const RString& s );
|
||||
|
||||
@@ -136,6 +136,7 @@ enum EditButton
|
||||
NUM_EditButton, // leave this at the end
|
||||
EditButton_Invalid
|
||||
};
|
||||
/** @brief A special foreach loop for the different edit buttons. */
|
||||
#define FOREACH_EditButton( e ) FOREACH_ENUM( EditButton, e )
|
||||
const int NUM_EDIT_TO_DEVICE_SLOTS = 2;
|
||||
const int NUM_EDIT_TO_MENU_SLOTS = 2;
|
||||
|
||||
@@ -296,10 +296,15 @@ vector<PlayerInfo>::iterator GetNextEnabledPlayerNumberInfo ( vector<PlayerInfo>
|
||||
vector<PlayerInfo>::iterator GetNextPlayerNumberInfo ( vector<PlayerInfo>::iterator iter, vector<PlayerInfo> &v );
|
||||
vector<PlayerInfo>::iterator GetNextVisiblePlayerInfo ( vector<PlayerInfo>::iterator iter, vector<PlayerInfo> &v );
|
||||
|
||||
/** @brief Get each enabled Player's info. */
|
||||
#define FOREACH_EnabledPlayerInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextEnabledPlayerInfo (v.begin(),v); pi != v.end(); pi = GetNextEnabledPlayerInfo(++pi,v) )
|
||||
/** @brief Get each enabled Player's info as long as it's not a dummy player. */
|
||||
#define FOREACH_EnabledPlayerInfoNotDummy( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextEnabledPlayerInfoNotDummy (v.begin(),v); pi != v.end(); pi = GetNextEnabledPlayerInfoNotDummy(++pi,v) )
|
||||
/** @brief Get each enabled Player Number's info. */
|
||||
#define FOREACH_EnabledPlayerNumberInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextEnabledPlayerNumberInfo (v.begin(),v); pi != v.end(); pi = GetNextEnabledPlayerNumberInfo(++pi,v) )
|
||||
/** @brief Get each Player Number's info, regardless of whether it's enabled or not. */
|
||||
#define FOREACH_PlayerNumberInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextPlayerNumberInfo (v.begin(),v); pi != v.end(); pi = GetNextPlayerNumberInfo(++pi,v) )
|
||||
/** @brief Get each visible Player's info. */
|
||||
#define FOREACH_VisiblePlayerInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextVisiblePlayerInfo (v.begin(),v); pi != v.end(); pi = GetNextVisiblePlayerInfo(++pi,v) )
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ static const char *StepsEditActionNames[] = {
|
||||
"Delete",
|
||||
};
|
||||
XToString( StepsEditAction );
|
||||
/** @brief Loop through each StepsEditAction. */
|
||||
#define FOREACH_StepsEditAction( i ) FOREACH_ENUM( StepsEditAction, i )
|
||||
|
||||
static MenuDef g_TempMenu(
|
||||
|
||||
@@ -42,6 +42,7 @@ static const char *ProfileActionNames[] = {
|
||||
};
|
||||
XToString( ProfileAction );
|
||||
XToLocalizedString( ProfileAction );
|
||||
/** @brief Loop through each ProfileAction. */
|
||||
#define FOREACH_ProfileAction( i ) FOREACH_ENUM( ProfileAction, i )
|
||||
|
||||
static MenuDef g_TempMenu(
|
||||
|
||||
@@ -16,6 +16,7 @@ enum MenuDir
|
||||
MenuDir_Auto, // when players join and the selection becomes invalid
|
||||
NUM_MenuDir,
|
||||
};
|
||||
/** @brief A special foreach loop through the different menu directions. */
|
||||
#define FOREACH_MenuDir( md ) FOREACH_ENUM( MenuDir, md )
|
||||
const RString& MenuDirToString( MenuDir md );
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ static const char *SetTimeSelectionNames[] = {
|
||||
"Second",
|
||||
};
|
||||
XToString( SetTimeSelection );
|
||||
/** @brief A foreach iterator through the time selections. */
|
||||
#define FOREACH_SetTimeSelection( s ) FOREACH_ENUM( SetTimeSelection, s )
|
||||
|
||||
const float g_X[NUM_SetTimeSelection] =
|
||||
|
||||
+20
-5
@@ -1,5 +1,3 @@
|
||||
/* ScreenTextEntry - Displays a text entry box over the top of another screen. */
|
||||
|
||||
#ifndef SCREEN_TEXT_ENTRY_H
|
||||
#define SCREEN_TEXT_ENTRY_H
|
||||
|
||||
@@ -9,20 +7,34 @@
|
||||
#include "ThemeMetric.h"
|
||||
#include "InputEventPlus.h"
|
||||
|
||||
/** @brief The list of possible keyboard rows. */
|
||||
enum KeyboardRow
|
||||
{
|
||||
R1, R2, R3, R4, R5, R6, R7,
|
||||
R1,
|
||||
R2,
|
||||
R3,
|
||||
R4,
|
||||
R5,
|
||||
R6,
|
||||
R7,
|
||||
KEYBOARD_ROW_SPECIAL,
|
||||
NUM_KeyboardRow,
|
||||
KeyboardRow_Invalid
|
||||
};
|
||||
/** @brief A special foreach loop for the KeyboardRow enum. */
|
||||
#define FOREACH_KeyboardRow( i ) FOREACH_ENUM( KeyboardRow, i )
|
||||
/** @brief The maximum number of keys per row. */
|
||||
const int KEYS_PER_ROW = 13;
|
||||
/** @brief The list of very special keys inside some rows. */
|
||||
enum KeyboardRowSpecialKey
|
||||
{
|
||||
SPACEBAR=2, BACKSPACE=5, CANCEL=8, DONE=11
|
||||
SPACEBAR=2, /**< The space bar key. */
|
||||
BACKSPACE=5, /**< The backspace key. */
|
||||
CANCEL=8,
|
||||
DONE=11
|
||||
};
|
||||
|
||||
/** @brief Displays a text entry box over the top of another screen. */
|
||||
class ScreenTextEntry : public ScreenWithMenuElements
|
||||
{
|
||||
public:
|
||||
@@ -64,7 +76,10 @@ public:
|
||||
RString sQuestion;
|
||||
RString sInitialAnswer;
|
||||
int iMaxInputLength;
|
||||
bool bPassword; // (optional)
|
||||
/** @brief Is there a password involved with this setting?
|
||||
*
|
||||
* This parameter doesn't have to be used. */
|
||||
bool bPassword;
|
||||
LuaReference Validate; // (RString sAnswer, RString sErrorOut; optional)
|
||||
LuaReference OnOK; // (RString sAnswer; optional)
|
||||
LuaReference OnCancel; // (optional)
|
||||
|
||||
@@ -21,6 +21,7 @@ enum ElementCategory
|
||||
NUM_ElementCategory,
|
||||
ElementCategory_Invalid
|
||||
};
|
||||
/** @brief A special foreach loop going through each ElementCategory. */
|
||||
#define FOREACH_ElementCategory( ec ) FOREACH_ENUM( ElementCategory, ec )
|
||||
const RString& ElementCategoryToString( ElementCategory ec );
|
||||
ElementCategory StringToElementCategory( const RString& s );
|
||||
|
||||
+4
-4
@@ -55,24 +55,24 @@ public:
|
||||
typedef map<RString,XNodeValue*> XAttrs;
|
||||
class XNode;
|
||||
typedef vector<XNode*> XNodes;
|
||||
|
||||
/** @brief Loop through each node. */
|
||||
#define FOREACH_Attr( pNode, Var ) \
|
||||
for( XAttrs::iterator Var = (pNode)->m_attrs.begin(); \
|
||||
Var != (pNode)->m_attrs.end(); \
|
||||
++Var )
|
||||
|
||||
/** @brief Loop through each node, using a constant iterator. */
|
||||
#define FOREACH_CONST_Attr( pNode, Var ) \
|
||||
for( XAttrs::const_iterator Var = (pNode)->m_attrs.begin(); \
|
||||
Var != (pNode)->m_attrs.end(); \
|
||||
++Var )
|
||||
|
||||
/** @brief Loop through each child. */
|
||||
#define FOREACH_Child( pNode, Var ) \
|
||||
XNode *Var = NULL; \
|
||||
for( XNodes::iterator Var##Iter = (pNode)->m_childs.begin(); \
|
||||
Var = (Var##Iter != (pNode)->m_childs.end())? *Var##Iter:NULL, \
|
||||
Var##Iter != (pNode)->m_childs.end(); \
|
||||
++Var##Iter )
|
||||
|
||||
/** @brief Loop through each child, using a constant iterator. */
|
||||
#define FOREACH_CONST_Child( pNode, Var ) \
|
||||
const XNode *Var = NULL; \
|
||||
for( XNodes::const_iterator Var##Iter = (pNode)->m_childs.begin(); \
|
||||
|
||||
Reference in New Issue
Block a user