Removed <windows.h>, <commctrl.h> and <algorithm> from Vaca/base.h.

This commit is contained in:
David Capello 2010-03-11 00:44:12 -02:00
parent e8ec41f436
commit cb1b6dc1ad
9 changed files with 65 additions and 73 deletions

View File

@ -18,6 +18,7 @@
#include "config.h"
#include <algorithm>
#include <allegro/file.h>
#include <allegro/fixed.h>
#include <allegro/fmaths.h>
@ -93,12 +94,12 @@ ToolBox::~ToolBox()
{
PRINTF("Toolbox module: uninstalling\n");
for_each(m_tools.begin(), m_tools.end(), deleter());
for_each(m_groups.begin(), m_groups.end(), deleter());
for_each(m_intertwiners.begin(), m_intertwiners.end(), deleter());
for_each(m_pointshapers.begin(), m_pointshapers.end(), deleter());
for_each(m_controllers.begin(), m_controllers.end(), deleter());
for_each(m_inks.begin(), m_inks.end(), deleter());
std::for_each(m_tools.begin(), m_tools.end(), deleter());
std::for_each(m_groups.begin(), m_groups.end(), deleter());
std::for_each(m_intertwiners.begin(), m_intertwiners.end(), deleter());
std::for_each(m_pointshapers.begin(), m_pointshapers.end(), deleter());
std::for_each(m_controllers.begin(), m_controllers.end(), deleter());
std::for_each(m_inks.begin(), m_inks.end(), deleter());
PRINTF("Toolbox module: uninstalled\n");
}

View File

@ -58,6 +58,11 @@ void VACA_DLL trace(const char* filename, size_t line, const char* msg, ...);
void VACA_DLL closeLogFile();
#ifndef __GNUC__
#include <cstdarg>
#pragma warning(disable: 4996)
/**
@internal
Dirty trick for compilers that does not support
@ -75,12 +80,14 @@ struct trace_t {
Vaca::details::trace(filename, line, buf);
}
};
inline trace_t make_trace(const char* filename, size_t line) {
trace_t tmp;
tmp.filename = filename;
tmp.line = line;
return tmp;
}
#endif
} // namespace details

View File

@ -34,6 +34,11 @@
#include "Vaca/base.h"
#ifdef VACA_WINDOWS
struct tagPOINT;
struct tagPOINTS;
#endif
namespace Vaca {
/**
@ -69,9 +74,9 @@ public:
bool operator!=(const Point& pt) const;
#ifdef VACA_WINDOWS
explicit Point(CONST LPPOINT pt);
explicit Point(CONST LPPOINTS pt);
operator POINT() const;
explicit Point(const tagPOINT* pt);
explicit Point(const tagPOINTS* pt);
operator tagPOINT() const;
#endif
};

View File

@ -34,6 +34,10 @@
#include "Vaca/base.h"
#ifdef VACA_WINDOWS
struct tagRECT;
#endif
namespace Vaca {
/**
@ -110,8 +114,8 @@ public:
bool operator!=(const Rect& rc) const;
#ifdef VACA_WINDOWS
explicit Rect(LPCRECT rc);
operator RECT() const;
explicit Rect(const tagRECT* rc);
operator tagRECT() const;
#endif
};

View File

@ -34,6 +34,10 @@
#include "Vaca/base.h"
#ifdef VACA_WINDOWS
struct tagSIZE;
#endif
namespace Vaca {
/**
@ -72,8 +76,8 @@ public:
bool operator!=(const Size& sz) const;
#ifdef VACA_WINDOWS
explicit Size(CONST LPSIZE sz);
operator SIZE() const;
explicit Size(const tagSIZE* sz);
operator tagSIZE() const;
#endif
};

View File

@ -37,62 +37,18 @@
#define VACA_WINDOWS
#endif
#pragma warning(disable: 4251)
#pragma warning(disable: 4275)
#pragma warning(disable: 4355)
#pragma warning(disable: 4996)
#include <algorithm>
#include <stdarg.h>
#include <string>
#ifdef VACA_WINDOWS
#include <windows.h>
#include <commctrl.h>
#endif
#include "Vaca/Enum.h"
// memory leaks
#ifdef MEMORY_LEAK_DETECTOR
#include "debug_new.h"
#endif
namespace Vaca {
#define VACA_VERSION 0
#define VACA_SUB_VERSION 0
#define VACA_WIP_VERSION 8
/**
@def VACA_MAIN()
@brief Defines the name and arguments that the main routine
of the program should contain.
You can use it as:
@code
int VACA_MAIN()
{
...
}
@endcode
@win32
It is the signature of @msdn{WinMain}. In other
operating systems this could be @c "main(int argc, char* argv[])".
@endwin32
*/
#ifdef VACA_WINDOWS
#define VACA_MAIN() \
PASCAL WinMain(HINSTANCE hInstance, \
HINSTANCE hPrevInstance, \
LPSTR lpCmdLine, \
int nCmdShow)
#else
#define VACA_MAIN() \
int main(int argc, char* argv[])
#endif
/**
@def VACA_DLL
@brief Used to export/import symbols to/from the dynamic library.
@ -374,13 +330,16 @@ template<typename ContainerType>
void remove_from_container(ContainerType& container,
typename ContainerType::const_reference element)
{
typename ContainerType::iterator
it = std::find(container.begin(),
container.end(),
element);
if (it != container.end())
container.erase(it);
for (typename ContainerType::iterator
it = container.begin(),
end = container.end(); it != end; ) {
if (*it == element) {
it = container.erase(it);
end = container.end();
}
else
++it;
}
}
// ======================================================================

View File

@ -32,6 +32,10 @@
#include "Vaca/Point.h"
#include "Vaca/Size.h"
#ifdef VACA_WINDOWS
#include <windef.h>
#endif
using namespace Vaca;
Point::Point()
@ -154,19 +158,19 @@ bool Point::operator!=(const Point& pt) const
#ifdef VACA_WINDOWS
Point::Point(CONST LPPOINT pt)
Point::Point(const tagPOINT* pt)
{
x = pt->x;
y = pt->y;
}
Point::Point(CONST LPPOINTS pt)
Point::Point(const tagPOINTS* pt)
{
x = pt->x;
y = pt->y;
}
Point::operator POINT() const
Point::operator tagPOINT() const
{
POINT pt;
pt.x = x;

View File

@ -33,6 +33,10 @@
#include "Vaca/Point.h"
#include "Vaca/Size.h"
#ifdef VACA_WINDOWS
#include <windef.h>
#endif
using namespace Vaca;
/**
@ -422,7 +426,7 @@ bool Rect::operator!=(const Rect& rc) const
@internal
*/
Rect::Rect(LPCRECT rc)
Rect::Rect(const tagRECT rc)
{
x = rc->left;
y = rc->top;
@ -436,9 +440,9 @@ Rect::Rect(LPCRECT rc)
@internal
*/
Rect::operator RECT() const
Rect::operator tagRECT() const
{
RECT rc;
tagRECT rc;
rc.left = x;
rc.top = y;
rc.right = x+w;

View File

@ -32,6 +32,10 @@
#include "Vaca/Size.h"
#include "Vaca/Point.h"
#ifdef VACA_WINDOWS
#include <windef.h>
#endif
using namespace Vaca;
Size::Size()
@ -166,15 +170,15 @@ bool Size::operator!=(const Size& sz) const
#ifdef VACA_WINDOWS
Size::Size(CONST LPSIZE sz)
Size::Size(const tagSIZE* sz)
{
w = sz->cx;
h = sz->cy;
}
Size::operator SIZE() const
Size::operator tagSIZE() const
{
SIZE sz;
tagSIZE sz;
sz.cx = w;
sz.cy = h;
return sz;