Style. Enum names and typedefs are almost always CamelCase in the LyX

code. At least in the code I see.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32777 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-01-05 20:56:37 +00:00
parent 3eaefc6b1a
commit 787b9eee3b
2 changed files with 22 additions and 22 deletions

View File

@ -74,7 +74,7 @@ LyXAction lyxaction;
void LyXAction::newFunc(FuncCode action, string const & name, void LyXAction::newFunc(FuncCode action, string const & name,
unsigned int attrib, LyXAction::func_type type) unsigned int attrib, LyXAction::FuncType type)
{ {
lyx_func_map[name] = action; lyx_func_map[name] = action;
FuncInfo tmpinfo; FuncInfo tmpinfo;
@ -103,7 +103,7 @@ void LyXAction::init()
FuncCode action; FuncCode action;
char const * name; char const * name;
unsigned int attrib; unsigned int attrib;
func_type type; FuncType type;
}; };
ev_item const items[] = { ev_item const items[] = {
@ -3474,7 +3474,7 @@ FuncRequest LyXAction::lookupFunc(string const & func) const
string cmd; string cmd;
string const arg = split(func2, cmd, ' '); string const arg = split(func2, cmd, ' ');
func_map::const_iterator fit = lyx_func_map.find(cmd); FuncMap::const_iterator fit = lyx_func_map.find(cmd);
return fit != lyx_func_map.end() ? FuncRequest(fit->second, arg) : FuncRequest(LFUN_UNKNOWN_ACTION); return fit != lyx_func_map.end() ? FuncRequest(fit->second, arg) : FuncRequest(LFUN_UNKNOWN_ACTION);
} }
@ -3482,22 +3482,22 @@ FuncRequest LyXAction::lookupFunc(string const & func) const
string const LyXAction::getActionName(FuncCode action) const string const LyXAction::getActionName(FuncCode action) const
{ {
info_map::const_iterator const it = lyx_info_map.find(action); InfoMap::const_iterator const it = lyx_info_map.find(action);
return it != lyx_info_map.end() ? it->second.name : string(); return it != lyx_info_map.end() ? it->second.name : string();
} }
LyXAction::func_type LyXAction::getActionType(FuncCode action) const LyXAction::FuncType LyXAction::getActionType(FuncCode action) const
{ {
info_map::const_iterator const it = lyx_info_map.find(action); InfoMap::const_iterator const it = lyx_info_map.find(action);
return it != lyx_info_map.end() ? it->second.type : Hidden; return it != lyx_info_map.end() ? it->second.type : Hidden;
} }
bool LyXAction::funcHasFlag(FuncCode action, bool LyXAction::funcHasFlag(FuncCode action,
LyXAction::func_attrib flag) const LyXAction::FuncAttribs flag) const
{ {
info_map::const_iterator ici = lyx_info_map.find(action); InfoMap::const_iterator ici = lyx_info_map.find(action);
if (ici == lyx_info_map.end()) { if (ici == lyx_info_map.end()) {
LYXERR0("action: " << action << " is not known."); LYXERR0("action: " << action << " is not known.");

View File

@ -31,7 +31,7 @@ class LyXErr;
class LyXAction { class LyXAction {
public: public:
/// category of an action, used in the Shortcuts dialog /// category of an action, used in the Shortcuts dialog
enum func_type { enum FuncType {
Hidden, //< Not listed for configuration Hidden, //< Not listed for configuration
Edit, //< Cursor and mouse movement, copy/paste etc Edit, //< Cursor and mouse movement, copy/paste etc
Math, //< Mathematics Math, //< Mathematics
@ -48,21 +48,21 @@ private:
/// the func_attrib values set /// the func_attrib values set
unsigned int attrib; unsigned int attrib;
/// the category of this func /// the category of this func
func_type type; FuncType type;
}; };
/// type for map between a function name and its action
typedef std::map<std::string, FuncCode> FuncMap;
/// type for map between an action and its info
typedef std::map<FuncCode, FuncInfo> InfoMap;
public: public:
/// noncopyable /// noncopyable
LyXAction(LyXAction const &); LyXAction(LyXAction const &);
void operator=(LyXAction const &); void operator=(LyXAction const &);
/// type for map between a function name and its action
typedef std::map<std::string, FuncCode> func_map;
/// type for map between an action and its info
typedef std::map<FuncCode, FuncInfo> info_map;
/// possible "permissions" for an action /// possible "permissions" for an action
enum func_attrib { enum FuncAttribs {
Noop = 0, //< Nothing special about this func Noop = 0, //< Nothing special about this func
ReadOnly = 1, //< Can be used in RO mode (perhaps this should change); no automatic markDirty ReadOnly = 1, //< Can be used in RO mode (perhaps this should change); no automatic markDirty
NoBuffer = 2, //< Can be used when there is no document open NoBuffer = 2, //< Can be used when there is no document open
@ -87,13 +87,13 @@ public:
/// Thus: getActionName(LFUN_ERT_INSERT) --> "ert-insert". /// Thus: getActionName(LFUN_ERT_INSERT) --> "ert-insert".
std::string const getActionName(FuncCode action) const; std::string const getActionName(FuncCode action) const;
/// ///
func_type getActionType(FuncCode action) const; FuncType getActionType(FuncCode action) const;
/// True if the command has `flag' set /// True if the command has `flag' set
bool funcHasFlag(FuncCode action, func_attrib flag) const; bool funcHasFlag(FuncCode action, FuncAttribs flag) const;
/// iterator across all real actions /// iterator across all real actions
typedef func_map::const_iterator const_func_iterator; typedef FuncMap::const_iterator const_func_iterator;
/// return an iterator to the start of all real actions /// return an iterator to the start of all real actions
const_func_iterator func_begin() const; const_func_iterator func_begin() const;
@ -105,21 +105,21 @@ private:
/// populate the action container with our actions /// populate the action container with our actions
void init(); void init();
/// add the given action /// add the given action
void newFunc(FuncCode, std::string const & name, unsigned int attrib, func_type type); void newFunc(FuncCode, std::string const & name, unsigned int attrib, FuncType type);
/** /**
* This is a list of all the LyXFunc names with the * This is a list of all the LyXFunc names with the
* coresponding action number. It is usually only used by the * coresponding action number. It is usually only used by the
* minibuffer or when assigning commands to keys during init. * minibuffer or when assigning commands to keys during init.
*/ */
func_map lyx_func_map; FuncMap lyx_func_map;
/** /**
* This is a mapping from action number to an object holding * This is a mapping from action number to an object holding
* info about this action. f.ex. command name (string), * info about this action. f.ex. command name (string),
* command attributes (ro) * command attributes (ro)
*/ */
info_map lyx_info_map; InfoMap lyx_info_map;
}; };
LyXErr & operator<<(LyXErr &, FuncCode); LyXErr & operator<<(LyXErr &, FuncCode);