Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
ConversionTool.cpp
Go to the documentation of this file.
1 
12 #include "stdafx.h"
13 #include "ConversionTool.h"
14 
15 
16 using namespace kome::core;
17 
18 
19 #include <crtdbg.h>
20 #ifdef _DEBUG
21  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
22  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
23 #endif // _DEBUG
24 
25 
26 
27 // get name from array
29  const int id,
30  IDInfo* idInfoArray,
31  const unsigned int arraySize
32 ) {
33  // string object
34  std::string name;
35 
36  // check parameters
37  if( idInfoArray == NULL || arraySize == 0 ) {
38  return name;
39  }
40 
41  // find ID
42  for( unsigned int i = 0; i < arraySize && name.empty(); i++ ) {
43  if( idInfoArray[ i ].id == id ) { // matched
44  name = std::string( NVL( idInfoArray[ i ].name, "" ) );
45  }
46  }
47 
48  return name;
49 }
interfaces of IDTool class
static std::string getIdName(const int id, IDInfo *idInfoArray, const unsigned int arraySize)
gets name from id number
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99
#define NULL
Definition: CoreMacros.h:18