Permalink
Browse files

everything's in the namespace

  • Loading branch information...
1 parent 2c601e5 commit d883067dd8d9d6e2d66f4c887cf260ac495515d2 @grahamboree committed Nov 17, 2012
@@ -46,7 +46,10 @@
#define CXIMAGE_DEFAULT_DPI 96
-static const char* CXIMAGE_ERR_NOFILE = "null file handler";
-static const char* CXIMAGE_ERR_NOIMAGE = "null image!!!";
+namespace CppImage
+{
+ static const char* CXIMAGE_ERR_NOFILE = "null file handler";
+ static const char* CXIMAGE_ERR_NOIMAGE = "null image!!!";
+}
#define CXIMAGE_SUPPORT_EXCEPTION_HANDLING 1
@@ -89,7 +89,8 @@ namespace CppImage
//# define MAX(a,b) (((a) > (b)) ? (a) : (b))
//template<typename T>
//inline static T max(const T& a, const T& b) { return (a > b) ? a : b; }
- using namespace std;
+ using std::min;
+ using std::max;
static const float PI = 3.141592653589793f;
@@ -200,15 +201,19 @@ namespace CppImage
inline uint8_t GetGValue() const { return static_cast<uint8_t>(mValue >> 8); }
inline uint8_t GetBValue() const { return static_cast<uint8_t>(mValue >> 16); }
- inline operator uint8_t() { return static_cast<uint8_t>(mValue); }
+ /*inline operator uint8_t() { return static_cast<uint8_t>(mValue); }
inline operator uint16_t() { return static_cast<uint16_t>(mValue); }
- inline operator uint32_t() { return mValue; }
+ inline operator uint32_t() { return mValue; }*/
inline bool operator==(const COLORREF& color) { return color.mValue == mValue; }
+ inline bool operator==(uint32_t inColor) { return inColor == mValue; }
+
inline uint32_t operator >>(int inShift) const { return mValue >> inShift; }
inline uint32_t operator <<(int inShift) const { return mValue << inShift; }
private:
uint32_t mValue;
};
+
+
// For compatibility..
static inline COLORREF RGB(uint8_t r, uint8_t g, uint8_t b) { return COLORREF(r, g, b); }
@@ -238,7 +243,7 @@ namespace CppImage
return (b * 117 + g * 601 + r * 306) >> 10;
}
-#if 1
+#if 0
//////////////////////////////////////////////////////////////////////////
class Complex
{
View
@@ -1,79 +1,57 @@
-/*
- * File: CxFile.h
- * Purpose: General Purpose File Class
- */
-/*
- --------------------------------------------------------------------------------
+//
+// CxFile.h
+// cppimage
+//
+// Created by Graham Pentheny on 11/10/12.
+// Copyright (c) 2012 Graham Pentheny. All rights reserved.
+//
- COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
-
- CxFile (c) 11/May/2002 Davide Pizzolato - www.xdp.it
- CxFile version 2.00 23/Aug/2002
- CxFile version 2.10 16/Dec/2007
-
- Special thanks to Chris Shearer Cooper for new features, enhancements and bugfixes
-
- Covered code is provided under this license on an "as is" basis, without warranty
- of any kind, either expressed or implied, including, without limitation, warranties
- that the covered code is free of defects, merchantable, fit for a particular purpose
- or non-infringing. The entire risk as to the quality and performance of the covered
- code is with you. Should any covered code prove defective in any respect, you (not
- the initial developer or any other contributor) assume the cost of any necessary
- servicing, repair or correction. This disclaimer of warranty constitutes an essential
- part of this license. No use of any covered code is authorized hereunder except under
- this disclaimer.
-
- Permission is hereby granted to use, copy, modify, and distribute this
- source code, or portions hereof, for any purpose, including commercial applications,
- freely and without fee, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source distribution.
- --------------------------------------------------------------------------------
- */
#pragma once
#if defined (WIN32) || defined (_WIN32_WCE)
# include <windows.h>
#endif
-
#include <stdio.h>
#include <stdlib.h>
#include "CxDefines.h"
-class CxFile
+namespace CppImage
{
-public:
- CxFile() {}
- virtual ~CxFile() {}
-
- virtual bool Close() = 0;
- virtual bool Eof() = 0;
- virtual int32_t Error() = 0;
- virtual bool Flush() = 0;
- virtual int32_t GetC() = 0;
- virtual char* GetS(char* string, int32_t n) = 0;
- virtual bool PutC(uint8_t c);
- virtual size_t Read(void* buffer, size_t size, size_t count) = 0;
- virtual int32_t Scanf(const char* format, void* output) = 0;
- virtual bool Seek(int32_t offset, int32_t origin) = 0;
- virtual int32_t Size() = 0;
- virtual int32_t Tell() = 0;
- virtual size_t Write(const void* buffer, size_t size, size_t count) = 0;
-};
+ //////////////////////////////////////////////////////////////////////////
+ class CxFile
+ {
+ public:
+ CxFile() {}
+ virtual ~CxFile() {}
+
+ virtual bool Close() = 0;
+ virtual bool Eof() = 0;
+ virtual int32_t Error() = 0;
+ virtual bool Flush() = 0;
+ virtual int32_t GetC() = 0;
+ virtual char* GetS(char* string, int32_t n) = 0;
+ virtual bool PutC(uint8_t c);
+ virtual size_t Read(void* buffer, size_t size, size_t count) = 0;
+ virtual int32_t Scanf(const char* format, void* output) = 0;
+ virtual bool Seek(int32_t offset, int32_t origin) = 0;
+ virtual int32_t Size() = 0;
+ virtual int32_t Tell() = 0;
+ virtual size_t Write(const void* buffer, size_t size, size_t count) = 0;
+ private:
+ // Disabled copy constructor and assignment operator.
+ CxFile(const CxFile&);
+ CxFile& operator=(const CxFile&);
+ };
+}
-//////////////////////////////////////////////////////////////////////////
-inline bool CxFile::PutC(uint8_t c)
+namespace CppImage
{
- // Default implementation
- size_t nWrote = Write(&c, 1, 1);
- return (nWrote == 1);
+ //////////////////////////////////////////////////////////////////////////
+ inline bool CxFile::PutC(uint8_t c)
+ {
+ // Default implementation
+ size_t nWrote = Write(&c, 1, 1);
+ return (nWrote == 1);
+ }
}
Oops, something went wrong.

0 comments on commit d883067

Please sign in to comment.