Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
ffd57d88
Commit
ffd57d88
authored
May 16, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move all hashtable declarations into include/hashtables.h, prepare for boost usage
parent
4a7b5304
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
31 deletions
+79
-31
dialog_shim.cpp
common/dialog_shim.cpp
+0
-4
hashtables.h
include/hashtables.h
+76
-24
xnode.h
include/xnode.h
+3
-3
No files found.
common/dialog_shim.cpp
View file @
ffd57d88
...
@@ -40,10 +40,6 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
...
@@ -40,10 +40,6 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
#include <base_struct.h> // EDA_RECT
#include <base_struct.h> // EDA_RECT
#include <typeinfo>
#include <typeinfo>
/// hashtable with key: C string and value: EDA_RECT.
/// The key is the classname of the derived wxformbuilder dialog
WX_DECLARE_HASH_MAP
(
char
*
,
EDA_RECT
,
wxStringHash
,
wxStringEqual
,
RECT_MAP
);
static
RECT_MAP
class_map
;
static
RECT_MAP
class_map
;
bool
DIALOG_SHIM
::
Show
(
bool
show
)
bool
DIALOG_SHIM
::
Show
(
bool
show
)
...
...
include/hashtables.h
View file @
ffd57d88
#ifndef HASHTABLES_H_
#ifndef HASHTABLES_H_
#define HASHTABLES_H_
#define HASHTABLES_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_struct.h>
#include <wx/string.h>
// Three strategies for providing a portable hashtable are given.
// C++, boost, and wx, in that order. C++ solution is no good for mingw.
// So will soon try boost for all platforms.
#if 0 // C++
#include <unordered_map>
/// Map a C string to a wxString, used in PLUGINs.
typedef unordered_map< const char*, wxString > PROPERTIES;
/// Map a C string to an integer. Used in DSNLEXER.
typedef unordered_map< const char*, int > KEYWORD_MAP;
/// Map a C string to an EDA_RECT.
/// The key is the classname of the derived wxformbuilder dialog.
typedef unordered_map< const char*, EDA_RECT > RECT_MAP;
#elif
0
// boost::unordered_map
// fix a compile bug at line 97 of boost/detail/container_fwd.hpp
#define BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD
#include <boost/unordered_map.hpp>
// see http://www.boost.org/doc/libs/1_49_0/doc/html/boost/unordered_map.html
/// Map a C string to a wxString, used in PLUGINs.
typedef
boost
::
unordered_map
<
const
char
*
,
wxString
>
PROPERTIES
;
/// Map a C string to an integer. Used in DSNLEXER.
typedef
boost
::
unordered_map
<
const
char
*
,
int
>
KEYWORD_MAP
;
/// Map a C string to an EDA_RECT.
/// The key is the classname of the derived wxformbuilder dialog.
typedef
boost
::
unordered_map
<
const
char
*
,
EDA_RECT
>
RECT_MAP
;
#elif 1 // wx is inconsistent accross platforms, will soon switch to boost
// Declare some hashtables using a MACRO techique from here:
// http://docs.wxwidgets.org/trunk/classwx_hash_map.html
// http://docs.wxwidgets.org/trunk/classwx_hash_map.html
// This simplifies finding the correct hashtable header file.
// Ideally, std::unordered_map is what we are trying to use here,
// but its header file has been a moving target for some time.
// Let wx figure it out.
#include <wx/hashmap.h>
#include <wx/hashmap.h>
/**
/// Map a C string to a wxString, used in PLUGINs.
* Class PROPERTIES
WX_DECLARE_HASH_MAP
(
char
*
,
wxString
,
wxStringHash
,
wxStringEqual
,
PROPERTIES
);
* is an associative array consisting of a key and value tuple.
*/
#if 1
// key: const char*
// value: wxString
WX_DECLARE_HASH_MAP
(
char
*
,
wxString
,
wxStringHash
,
wxStringEqual
,
PROPERTIES
);
#else
// key: wxString
// value: wxString
WX_DECLARE_STRING_HASH_MAP
(
wxString
,
PROPERTIES
);
#endif
/// Map a C string to an integer. Used in DSNLEXER.
WX_DECLARE_HASH_MAP
(
char
*
,
int
,
wxStringHash
,
wxStringEqual
,
KEYWORD_MAP
);
/**
/// Map a C string to an EDA_RECT.
* Class KEYWORD_MAP
/// The key is the classname of the derived wxformbuilder dialog.
* is a hashtable consisting of a key and a value tuple.
WX_DECLARE_HASH_MAP
(
char
*
,
EDA_RECT
,
wxStringHash
,
wxStringEqual
,
RECT_MAP
);
* Key is a C string and value is an integer.
*/
//WX_DECLARE_HASH_MAP( char*, int, wxStringHash, wxStringEqual, KEYWORD_MAP );
#endif
#endif // HASHTABLES_H_
#endif // HASHTABLES_H_
include/xnode.h
View file @
ffd57d88
#ifndef
_
XATTR_H_
#ifndef XATTR_H_
#define
_
XATTR_H_
#define XATTR_H_
/*
/*
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
...
@@ -108,4 +108,4 @@ public:
...
@@ -108,4 +108,4 @@ public:
#endif
#endif
};
};
#endif //
_
XATTR_H_
#endif // XATTR_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment