Skip to content
Permalink
Browse files

Use std::unordered_map instead of wxWidgets's hash map

  • Loading branch information...
jhasse committed Mar 29, 2019
1 parent eff6af9 commit 0ebfe67d57829a66f6efb31788ffd2b5dc024b86
Showing with 5 additions and 4 deletions.
  1. +3 −3 src/codegen/codeparser.cpp
  2. +2 −1 src/codegen/codeparser.h
@@ -171,7 +171,7 @@ void CCodeParser::ParseSourceFunctions(wxString code) {
}
func->SetHeading(heading);

m_functions[RemoveWhiteSpace(heading)] = func;
m_functions[std::string(RemoveWhiteSpace(heading).ToUTF8())] = func;

// find the opening brackets of the function
func->SetContents(ParseBrackets(code, functionStart));
@@ -239,7 +239,7 @@ wxString CodeParser::GetFunctionDocumentation(wxString function) {
wxString contents = wxT("");
Function* func;

m_functionIter = m_functions.find(function);
m_functionIter = m_functions.find(std::string(function.ToUTF8()));
if (m_functionIter != m_functions.end()) {
func = m_functionIter->second;
contents = func->GetDocumentation();
@@ -251,7 +251,7 @@ wxString CodeParser::GetFunctionContents(wxString function) {
wxString contents = wxT("");
Function* func;

m_functionIter = m_functions.find(RemoveWhiteSpace(function));
m_functionIter = m_functions.find(std::string(RemoveWhiteSpace(function).ToUTF8()));
if (m_functionIter != m_functions.end()) {
func = m_functionIter->second;
contents = func->GetContents();
@@ -2,6 +2,7 @@

#include "../utils/debug.h"

#include <unordered_map>
#include <wx/textfile.h>
#include <wx/msgdlg.h>

@@ -58,7 +59,7 @@ class Function {
};

/** map class mapping Function* to function name */
WX_DECLARE_STRING_HASH_MAP(Function*, FunctionMap);
using FunctionMap = std::unordered_map<std::string, Function*>;
#define funcIterator FunctionMap::iterator

/** parses the source and header files for all code added to the generated */

0 comments on commit 0ebfe67

Please sign in to comment.
You can’t perform that action at this time.