IfcParse dynamic linking, IFCPARSE_NO_REGEX, fixes for three memory leaks (#76)

* CMake: moved setting link directories before all the projects.

* Added IfcParse_Export header for declaring export macro.

* Added IFCPARSE_STATIC_DEFINE macro to all projects.

* Added include for export macro to swig file.

* Added IfcParse_EXPORT macro for all classes in headers generated by express parser.

* Allow removing boost.regex dependency by defining macro IFCPARSE_NO_REGEX.

* Fixed bug in deletion of ICU converter.

* Added export macro to most of the classes across headers

* Fixed memory leak: delete nested IfcAbstractEntity in EntityArgument.

* Fixed memory leak in destructor of IfcWritableEntity (args values).
This commit is contained in:
stgatilov
2016-05-29 18:12:57 +06:00
committed by Thomas Krijnen
parent a298903fdd
commit b5c4eb3b6f
22 changed files with 1784 additions and 1718 deletions
+14 -8
View File
@@ -26,6 +26,8 @@
#include <sstream>
#include <algorithm>
#include "../ifcparse/IfcParse_Export.h"
#ifdef USE_IFC4
#include "../ifcparse/Ifc4enum.h"
#else
@@ -34,7 +36,9 @@
#include <boost/shared_ptr.hpp>
#include <boost/dynamic_bitset.hpp>
#include <boost/regex.hpp>
#ifndef IFCPARSE_NO_REGEX //allow builds without boost.regex
#include <boost/regex.hpp>
#endif
#include <boost/foreach.hpp>
#define foreach BOOST_FOREACH
@@ -75,7 +79,7 @@ namespace IfcUtil {
const char* ArgumentTypeToString(ArgumentType argument_type);
class IfcBaseClass {
class IfcParse_EXPORT IfcBaseClass {
public:
IfcAbstractEntity* entity;
virtual bool is(IfcSchema::Type::Enum v) const = 0;
@@ -102,11 +106,11 @@ namespace IfcUtil {
}
};
class IfcBaseEntity : public IfcBaseClass {
class IfcParse_EXPORT IfcBaseEntity : public IfcBaseClass {
};
// TODO: Investigate whether these should be template classes instead
class IfcBaseType : public IfcBaseEntity {
class IfcParse_EXPORT IfcBaseType : public IfcBaseEntity {
public:
unsigned int getArgumentCount() const;
Argument* getArgument(unsigned int i) const;
@@ -116,7 +120,9 @@ namespace IfcUtil {
bool valid_binary_string(const std::string& s);
#ifndef IFCPARSE_NO_REGEX
boost::regex wildcard_string_to_regex(std::string str);
#endif
/// Replaces spaces and potentially other problem causing characters with underscores.
void sanitate_material_name(std::string &str);
@@ -127,7 +133,7 @@ namespace IfcUtil {
template <class T>
class IfcTemplatedEntityList;
class IfcEntityList {
class IfcParse_EXPORT IfcEntityList {
std::vector<IfcUtil::IfcBaseClass*> ls;
public:
typedef boost::shared_ptr<IfcEntityList> ptr;
@@ -185,7 +191,7 @@ public:
template <class T>
class IfcTemplatedEntityListList;
class IfcEntityListList {
class IfcParse_EXPORT IfcEntityListList {
std::vector< std::vector<IfcUtil::IfcBaseClass*> > ls;
public:
typedef boost::shared_ptr< IfcEntityListList > ptr;
@@ -283,7 +289,7 @@ namespace IfcParse {
class IfcFile;
}
class Argument {
class IfcParse_EXPORT Argument {
public:
virtual operator int() const = 0;
virtual operator bool() const = 0;
@@ -312,7 +318,7 @@ public:
virtual ~Argument() {};
};
class IfcAbstractEntity {
class IfcParse_EXPORT IfcAbstractEntity {
public:
IfcParse::IfcFile* file;
virtual IfcEntityList::ptr getInverse(IfcSchema::Type::Enum type, int attribute_index) = 0;