Converted from C-style 'typedef' to C++ 'using' where appropriate.

I find the newer syntax more readable, since it acts exactly like
an assignment statement.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3088 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-19 12:10:45 +00:00
parent 0d5ae3acf5
commit 37d9c6c99f
18 changed files with 47 additions and 57 deletions

View File

@ -27,7 +27,7 @@ class OSystem;
#include "bspf.hxx" #include "bspf.hxx"
typedef vector<shared_ptr<Cheat>> CheatList; using CheatList = vector<shared_ptr<Cheat>>;
/** /**
This class provides an interface for performing all cheat operations This class provides an interface for performing all cheat operations

View File

@ -78,7 +78,7 @@ class Variant
static const Variant EmptyVariant; static const Variant EmptyVariant;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
typedef vector<pair<string,Variant>> VariantList; using VariantList = vector<pair<string,Variant>>;
namespace VList { namespace VList {
inline void push_back(VariantList& list, const Variant& name, inline void push_back(VariantList& list, const Variant& name,

View File

@ -30,17 +30,17 @@
#include <cstdint> #include <cstdint>
// Types for 8-bit signed and unsigned integers // Types for 8-bit signed and unsigned integers
typedef int8_t Int8; using Int8 = int8_t;
typedef uint8_t uInt8; using uInt8 = uint8_t;
// Types for 16-bit signed and unsigned integers // Types for 16-bit signed and unsigned integers
typedef int16_t Int16; using Int16 = int16_t;
typedef uint16_t uInt16; using uInt16 = uint16_t;
// Types for 32-bit signed and unsigned integers // Types for 32-bit signed and unsigned integers
typedef int32_t Int32; using Int32 = int32_t;
typedef uint32_t uInt32; using uInt32 = uint32_t;
// Types for 64-bit signed and unsigned integers // Types for 64-bit signed and unsigned integers
typedef int64_t Int64; using Int64 = int64_t;
typedef uint64_t uInt64; using uInt64 = uint64_t;
// The following code should provide access to the standard C++ objects and // The following code should provide access to the standard C++ objects and
// types: cout, cerr, string, ostream, istream, etc. // types: cout, cerr, string, ostream, istream, etc.
@ -58,10 +58,10 @@ typedef uint64_t uInt64;
using namespace std; using namespace std;
// Common array types // Common array types
typedef vector<Int32> IntArray; using IntArray = vector<Int32>;
typedef vector<bool> BoolArray; using BoolArray = vector<bool>;
typedef vector<uInt8> ByteArray; using ByteArray = vector<uInt8>;
typedef vector<string> StringList; using StringList = vector<string>;
// Defines to help with path handling // Defines to help with path handling
#if (defined(BSPF_UNIX) || defined(BSPF_MAC_OSX)) #if (defined(BSPF_UNIX) || defined(BSPF_MAC_OSX))

View File

@ -33,9 +33,9 @@ class CartDebugWidget;
#include "DebuggerSystem.hxx" #include "DebuggerSystem.hxx"
#include "System.hxx" #include "System.hxx"
// Pointer type for CartDebug instance methods // Function type for CartDebug instance methods
class CartDebug; class CartDebug;
typedef int (CartDebug::*CartMethod)(); using CartMethod = int (CartDebug::*)();
class CartState : public DebuggerState class CartState : public DebuggerState
{ {
@ -81,7 +81,7 @@ class CartDebug : public DebuggerSystem
string bytes; string bytes;
bool hllabel; bool hllabel;
}; };
typedef vector<DisassemblyTag> DisassemblyList; using DisassemblyList = vector<DisassemblyTag>;
struct Disassembly { struct Disassembly {
DisassemblyList list; DisassemblyList list;
int fieldwidth; int fieldwidth;
@ -263,8 +263,8 @@ class CartDebug : public DebuggerSystem
void addressTypeAsString(ostream& buf, uInt16 addr) const; void addressTypeAsString(ostream& buf, uInt16 addr) const;
private: private:
typedef map<uInt16, string> AddrToLabel; using AddrToLabel = map<uInt16, string>;
typedef map<string, uInt16> LabelToAddr; using LabelToAddr = map<string, uInt16>;
// Determine 'type' of address (ie, what part of the system accessed) // Determine 'type' of address (ie, what part of the system accessed)
enum AddrType { enum AddrType {
@ -280,8 +280,8 @@ class CartDebug : public DebuggerSystem
uInt16 start; uInt16 start;
uInt16 end; uInt16 end;
}; };
typedef list<uInt16> AddressList; using AddressList = list<uInt16>;
typedef list<DirectiveTag> DirectiveList; using DirectiveList = list<DirectiveTag>;
struct BankInfo { struct BankInfo {
uInt16 start; // start of address space uInt16 start; // start of address space

View File

@ -24,8 +24,8 @@
#include "System.hxx" #include "System.hxx"
#include "DebuggerSystem.hxx" #include "DebuggerSystem.hxx"
// Pointer type for CpuDebug instance methods // Function type for CpuDebug instance methods
typedef int (CpuDebug::*CpuMethod)() const; using CpuMethod = int (CpuDebug::*)() const;
class CpuState : public DebuggerState class CpuState : public DebuggerState
{ {

View File

@ -48,18 +48,8 @@ class ButtonWidget;
#include "Stack.hxx" #include "Stack.hxx"
#include "bspf.hxx" #include "bspf.hxx"
typedef map<string,unique_ptr<Expression>> FunctionMap; using FunctionMap = map<string,unique_ptr<Expression>>;
typedef map<string,string> FunctionDefMap; using FunctionDefMap = map<string,string>;
/*
// These will probably turn out to be unneeded, left for reference for now
// pointer types for Debugger instance methods
typedef uInt8 (Debugger::*DEBUGGER_BYTE_METHOD)();
typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
// call the pointed-to method on the (static) debugger object.
#define CALL_DEBUGGER_METHOD(method) ( ( Debugger::debugger().*method)() )
*/
/** /**

View File

@ -26,9 +26,9 @@ class TIA;
#include "DebuggerSystem.hxx" #include "DebuggerSystem.hxx"
// Pointer type for TIADebug instance methods // Function type for TIADebug instance methods
class TIADebug; class TIADebug;
typedef int (TIADebug::*TiaMethod)() const; using TiaMethod = int (TIADebug::*)() const;
// Indices for various IntArray in TiaState // Indices for various IntArray in TiaState
enum { enum {

View File

@ -263,13 +263,13 @@ class FilesystemNode
* the semantics. * the semantics.
*/ */
typedef vector<AbstractFSNode*> AbstractFSList; using AbstractFSList = vector<AbstractFSNode*>;
class AbstractFSNode class AbstractFSNode
{ {
protected: protected:
friend class FilesystemNode; friend class FilesystemNode;
typedef FilesystemNode::ListMode ListMode; using ListMode = FilesystemNode::ListMode;
public: public:
/** /**

View File

@ -46,15 +46,15 @@
*/ */
// Setup the types used by the MD5 routines // Setup the types used by the MD5 routines
typedef uInt8* POINTER; using POINTER = uInt8*;
// MD5 context. // MD5 context.
typedef struct struct MD5_CTX
{ {
uInt32 state[4]; /* state (ABCD) */ uInt32 state[4]; /* state (ABCD) */
uInt32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ uInt32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
uInt8 buffer[64]; /* input buffer */ uInt8 buffer[64]; /* input buffer */
} MD5_CTX; };
// Constants for MD5Transform routine. // Constants for MD5Transform routine.
#define S11 7 #define S11 7

View File

@ -117,7 +117,7 @@ class PropertiesSet
void print() const; void print() const;
private: private:
typedef map<string, Properties> PropsList; using PropsList = map<string, Properties>;
// The properties read from an external 'stella.pro' file // The properties read from an external 'stella.pro' file
PropsList myExternalProps; PropsList myExternalProps;

View File

@ -128,7 +128,7 @@ class Settings
Variant value; Variant value;
Variant initialValue; Variant initialValue;
}; };
typedef vector<Setting> SettingsArray; using SettingsArray = vector<Setting>;
const SettingsArray& getInternalSettings() const const SettingsArray& getInternalSettings() const
{ return myInternalSettings; } { return myInternalSettings; }

View File

@ -24,7 +24,7 @@ class CheckboxWidget;
#include "ListWidget.hxx" #include "ListWidget.hxx"
typedef vector<CheckboxWidget*> CheckboxArray; using CheckboxArray = vector<CheckboxWidget*>;
/** CheckListWidget */ /** CheckListWidget */

View File

@ -134,7 +134,7 @@ class Dialog : public GuiObject
Focus(Widget* w = 0); Focus(Widget* w = 0);
virtual ~Focus(); virtual ~Focus();
}; };
typedef vector<Focus> FocusList; using FocusList = vector<Focus>;
struct TabFocus { struct TabFocus {
TabWidget* widget; TabWidget* widget;
@ -148,7 +148,7 @@ class Dialog : public GuiObject
void saveCurrentFocus(Widget* w); void saveCurrentFocus(Widget* w);
Widget* getNewFocus(); Widget* getNewFocus();
}; };
typedef vector<TabFocus> TabFocusList; using TabFocusList = vector<TabFocus>;
Focus _myFocus; // focus for base dialog Focus _myFocus; // focus for base dialog
TabFocusList _myTabList; // focus for each tab (if any) TabFocusList _myTabList; // focus for each tab (if any)

View File

@ -35,7 +35,7 @@ struct BBX
/* builtin C-based proportional/fixed font structure */ /* builtin C-based proportional/fixed font structure */
/* based on The Microwindows Project http://microwindows.org */ /* based on The Microwindows Project http://microwindows.org */
typedef struct struct FontDesc
{ {
const char* name; /* font name */ const char* name; /* font name */
int maxwidth; /* max width in pixels */ int maxwidth; /* max width in pixels */
@ -50,7 +50,7 @@ typedef struct
const BBX* bbx; /* character bounding box or nullptr if fixed */ const BBX* bbx; /* character bounding box or nullptr if fixed */
int defaultchar; /* default char (not glyph index) */ int defaultchar; /* default char (not glyph index) */
long bits_size; /* # words of bitmap_t bits */ long bits_size; /* # words of bitmap_t bits */
} FontDesc; };
namespace GUI { namespace GUI {

View File

@ -30,7 +30,7 @@ class Widget;
#include "Command.hxx" #include "Command.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
typedef vector<Widget*> WidgetArray; using WidgetArray = vector<Widget*>;
// The commands generated by various widgets // The commands generated by various widgets
enum { enum {

View File

@ -59,7 +59,7 @@ class InputTextDialog : public Dialog, public CommandSender
void handleCommand(CommandSender* sender, int cmd, int data, int id); void handleCommand(CommandSender* sender, int cmd, int data, int id);
private: private:
typedef vector<EditTextWidget*> InputWidget; using InputWidget = vector<EditTextWidget*>;
InputWidget myInput; InputWidget myInput;
StaticTextWidget* myTitle; StaticTextWidget* myTitle;

View File

@ -62,14 +62,14 @@ class ScrollBarWidget : public Widget, public CommandSender
int _wheel_lines; int _wheel_lines;
private: private:
typedef enum { enum Part {
kNoPart, kNoPart,
kUpArrowPart, kUpArrowPart,
kDownArrowPart, kDownArrowPart,
kSliderPart, kSliderPart,
kPageUpPart, kPageUpPart,
kPageDownPart kPageDownPart
} Part; };
Part _part; Part _part;
Part _draggingPart; Part _draggingPart;

View File

@ -75,7 +75,7 @@ class TabWidget : public Widget, public CommandSender
Tab(const string& t = "", Widget* first = 0, Widget* parent = 0, bool e = true) Tab(const string& t = "", Widget* first = 0, Widget* parent = 0, bool e = true)
: title(t), firstWidget(first), parentWidget(parent), enabled(e) { } : title(t), firstWidget(first), parentWidget(parent), enabled(e) { }
}; };
typedef vector<Tab> TabList; using TabList = vector<Tab>;
TabList _tabs; TabList _tabs;
int _tabWidth; int _tabWidth;