Skip to content
Permalink
Browse files

Added dll-interface declarations to support using DLLs built via VS20…

…0X. Linking projects need to define TICPP_DLL to use the DLL.
  • Loading branch information...
mjanisz@gmail.com
mjanisz@gmail.com committed Oct 18, 2012
1 parent 761c895 commit e81f4b54f3579fd90a3d9d0cdbd41a08b4fa24a1
Showing with 141 additions and 50 deletions.
  1. +1 −1 build_instructions.txt
  2. +2 −0 changes.txt
  3. +26 −18 ticpp.h
  4. +3 −0 ticpp.lua
  5. +3 −0 ticpp4.lua
  6. +55 −0 ticppapi.h
  7. +11 −4 ticpprc.h
  8. +9 −2 tinystr.h
  9. +31 −25 tinyxml.h
@@ -22,7 +22,7 @@ Introduction:
Build Steps:
1) Download Premake from http://premake.sf.net/download
2) Checkout the source for TinyXML++ using Subversion.
- svn checkout http://ticpp.googlecode.com/svn/trunk/ ticpp
- svn checkout https://ticpp.googlecode.com/svn/trunk/ ticpp
3) Place the Premake executable in the root directory of TiCPP or somewhere in your
path.
4) To create the needed build files navigate to the TinyXML++ directory (ticpp)
@@ -267,3 +267,5 @@ Changes in version 2.1.5
Comments should not, in fact, parse entities. Fixed the code path and added tests.
- We were not catching all the returns from ftell. Thanks to Bernard for catching that.

2.5.4
- Added dll-interface declarations to support using DLLs built via VS200X.
44 ticpp.h
@@ -38,13 +38,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@todo add TYPECOUNT support. See ticpp::NodeFactory.
@todo Add a quick reference
*/

/*
* THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012.
*
* - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X
*/

#ifndef TIXML_USE_TICPP
#define TIXML_USE_TICPP
#endif

#ifndef TICPP_INCLUDED
#define TICPP_INCLUDED

#include "ticppapi.h"
#include "tinyxml.h"
#include <sstream>
#include <vector>
@@ -67,7 +75,7 @@ namespace ticpp
/**
This is a ticpp exception class
*/
class Exception : public std::exception
class TICPP_API Exception : public std::exception
{
public:
/**
@@ -97,16 +105,16 @@ namespace ticpp
}

// Forward Declarations for Visitor, and others.
class Document;
class Element;
class Declaration;
class StylesheetReference;
class Text;
class Comment;
class Attribute;
class TICPP_API Document;
class TICPP_API Element;
class TICPP_API Declaration;
class TICPP_API StylesheetReference;
class TICPP_API Text;
class TICPP_API Comment;
class TICPP_API Attribute;

/** Wrapper around TiXmlVisitor */
class Visitor : public TiXmlVisitor
class TICPP_API Visitor : public TiXmlVisitor
{
public:
// Overload the TiXmlVisitor functions, wrap objects, call ticpp::Visitor functions
@@ -149,7 +157,7 @@ namespace ticpp
};

/** Wrapper around TiXmlBase */
class Base
class TICPP_API Base
{
public:

@@ -300,7 +308,7 @@ namespace ticpp
/**
Wrapper around TiXmlAttribute
*/
class Attribute : public Base
class TICPP_API Attribute : public Base
{
private:
TiXmlAttribute* m_tiXmlPointer;
@@ -467,7 +475,7 @@ namespace ticpp
/**
Wrapper around TiXmlNode
*/
class Node : public Base
class TICPP_API Node : public Base
{
public:

@@ -1319,7 +1327,7 @@ namespace ticpp
};

/** Wrapper around TiXmlComment */
class Comment : public NodeImp< TiXmlComment >
class TICPP_API Comment : public NodeImp< TiXmlComment >
{
public:

@@ -1340,7 +1348,7 @@ namespace ticpp
};

/** Wrapper around TiXmlText */
class Text : public NodeImp< TiXmlText >
class TICPP_API Text : public NodeImp< TiXmlText >
{
public:

@@ -1379,7 +1387,7 @@ namespace ticpp
};

/** Wrapper around TiXmlDocument */
class Document : public NodeImp< TiXmlDocument >
class TICPP_API Document : public NodeImp< TiXmlDocument >
{
public:
/**
@@ -1458,7 +1466,7 @@ namespace ticpp
};

/** Wrapper around TiXmlElement */
class Element : public NodeImp< TiXmlElement >
class TICPP_API Element : public NodeImp< TiXmlElement >
{
public:
/**
@@ -1837,7 +1845,7 @@ namespace ticpp
};

/** Wrapper around TiXmlDeclaration */
class Declaration : public NodeImp< TiXmlDeclaration >
class TICPP_API Declaration : public NodeImp< TiXmlDeclaration >
{
public:
/**
@@ -1872,7 +1880,7 @@ namespace ticpp
};

/** Wrapper around TiXmlStylesheetReference */
class StylesheetReference : public NodeImp< TiXmlStylesheetReference >
class TICPP_API StylesheetReference : public NodeImp< TiXmlStylesheetReference >
{
public:
/**
@@ -116,3 +116,6 @@ else
table.insert( package.buildoptions, "-fPIC" )
end

if ( package.kind == "dll" ) then
table.insert( package.defines, "BUILD_TICPP_DLL" )
end
@@ -66,6 +66,9 @@ project "TiCPP"
--
if _OPTIONS["ticpp-shared"] then
kind "SharedLib"

-- Define BUILD_TICPP_DLL to provide dll-interface declarations.
defines { "BUILD_TICPP_DLL" }
else
kind "StaticLib"
if not ticpp.GetCustomValue( "targetdir" ) then
@@ -0,0 +1,55 @@
/*
Copyright (c) 2012 Matt Janisz
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef TICPP_API_INCLUDED
#define TICPP_API_INCLUDED

#undef TICPP_API

#if defined(_WIN32) | defined(WIN32) | defined(WINDOWS) | defined(_WINDOWS)
//windows dll defines
#include <windows.h>

// define BUILD_TICPP_DLL when building TiCPP dll.
#ifdef BUILD_TICPP_DLL
#define TICPP_API __declspec(dllexport)
#endif

// define TICPP_DLL when linking TiCPP dll.
#ifdef TICPP_DLL
#define TICPP_API __declspec(dllimport)
#endif

// Disable dll-interface warning
#ifdef TICPP_API
#pragma warning( push )
#pragma warning( disable : 4251 ) // X needs to have dll-interface to be used by clients of class Y
#pragma warning( disable : 4275 ) // X is derived from class Y but only X is exported
#endif

#endif

#ifndef TICPP_API
//linux or windows-static library defines
#define TICPP_API
#endif

#endif // TICPP_API_INCLUDED
@@ -20,26 +20,33 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/*
* THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012.
*
* - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X
*/

#ifdef TIXML_USE_TICPP

#ifndef TICPPRC_INCLUDED
#define TICPPRC_INCLUDED

#include "ticppapi.h"
#include <vector>

// Forward declare ticpp::Node, so it can be made a friend of TiCppRC
namespace ticpp
{
class Base;
class TICPP_API Base;
}

// Forward declare TiCppRCImp so TiCppRC can hold a pointer to it
class TiCppRCImp;
class TICPP_API TiCppRCImp;

/**
Base class for reference counting functionality
*/
class TiCppRC
class TICPP_API TiCppRC
{
// Allow ticpp::Node to directly modify reference count
friend class ticpp::Base;
@@ -71,7 +78,7 @@ class TiCppRC
void DeleteSpawnedWrappers();
};

class TiCppRCImp
class TICPP_API TiCppRCImp
{
private:

@@ -34,11 +34,18 @@ distribution.
* - added swap(), clear(), size(), capacity(), operator+().
*/

/*
* THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012.
*
* - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X
*/

#ifndef TIXML_USE_STL

#ifndef TIXML_STRING_INCLUDED
#define TIXML_STRING_INCLUDED

#include "ticppapi.h"
#include <assert.h>
#include <string.h>

@@ -64,7 +71,7 @@ distribution.
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
a string and there's no more room, we allocate a buffer twice as big as we need.
*/
class TiXmlString
class TICPP_API TiXmlString
{
public :
// The size type used
@@ -295,7 +302,7 @@ TiXmlString operator + (const char* a, const TiXmlString & b);
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
Only the operators that we need for TinyXML have been developped.
*/
class TiXmlOutStream : public TiXmlString
class TICPP_API TiXmlOutStream : public TiXmlString
{
public :

0 comments on commit e81f4b5

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