Public Member Functions | Private Attributes | List of all members
Mapper Class Reference

#include <cmdmapper.h>

Public Member Functions

int map (const char *n)
 
QString find (const int n)
 
 Mapper (const CommandMap *cm, bool caseSensitive)
 

Private Attributes

QDict< int > m_map
 
bool m_cs
 

Detailed Description

Class representing a mapping from command names to command IDs.

Definition at line 204 of file cmdmapper.h.

Constructor & Destructor Documentation

Mapper::Mapper ( const CommandMap cm,
bool  caseSensitive 
)

Definition at line 243 of file cmdmapper.cpp.

243  : m_map(89), m_cs(caseSensitive)
244 {
245  m_map.setAutoDelete(TRUE);
246  const CommandMap *p = cm;
247  while (p->cmdName)
248  {
249  m_map.insert(p->cmdName,new int(p->cmdId));
250  p++;
251  }
252 }
static constexpr double cm
Definition: Units.h:68
bool m_cs
Definition: cmdmapper.h:212
QDict< int > m_map
Definition: cmdmapper.h:211
p
Definition: test.py:223
const char * cmdName
Definition: cmdmapper.cpp:24
const bool TRUE
Definition: qglobal.h:371

Member Function Documentation

QString Mapper::find ( const int  n)

Definition at line 233 of file cmdmapper.cpp.

234 {
235  QDictIterator<int> mapIterator(m_map);
236  for (int *curVal = mapIterator.toFirst();(curVal = mapIterator.current());++mapIterator)
237  {
238  if (*curVal == n || (*curVal == (n | SIMPLESECT_BIT))) return mapIterator.currentKey();
239  }
240  return NULL;
241 }
const int SIMPLESECT_BIT
Definition: cmdmapper.h:26
QDict< int > m_map
Definition: cmdmapper.h:211
std::void_t< T > n
int Mapper::map ( const char *  n)

Definition at line 225 of file cmdmapper.cpp.

226 {
227  QCString name=n;
228  if (!m_cs) name=name.lower();
229  int *result;
230  return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0;
231 }
static QCString name
Definition: declinfo.cpp:673
static QCString result
bool isEmpty() const
Definition: qcstring.h:189
bool m_cs
Definition: cmdmapper.h:212
QDict< int > m_map
Definition: cmdmapper.h:211
std::void_t< T > n
QCString lower() const
Definition: qcstring.cpp:263

Member Data Documentation

bool Mapper::m_cs
private

Definition at line 212 of file cmdmapper.h.

QDict<int> Mapper::m_map
private

Definition at line 211 of file cmdmapper.h.


The documentation for this class was generated from the following files: