Patched PyCXX 6.2.5 with original FreeCAD changes made in 6.2.0

This commit is contained in:
Yorik van Havre
2014-09-18 18:40:40 -03:00
parent f5e87dd358
commit 29cadd9681
23 changed files with 621 additions and 472 deletions

View File

@@ -52,7 +52,7 @@
namespace Py
{
typedef int sequence_index_type; // type of an index into a sequence
typedef size_t sequence_index_type; // type of an index into a sequence
// Forward declarations
class Object;
@@ -141,7 +141,7 @@ namespace Py
// which you can use in accepts when writing a wrapper class.
// See Demo/range.h and Demo/range.cxx for an example.
class Object
class PYCXX_EXPORT Object
{
private:
// the pointer to the Python object
@@ -469,11 +469,11 @@ namespace Py
// TMM: 31May'01 - Added the #ifndef so I can exlude iostreams.
#ifndef CXX_NO_IOSTREAMS
std::ostream& operator<< (std::ostream& os, const Object& ob);
PYCXX_EXPORT std::ostream& operator<< (std::ostream& os, const Object& ob);
#endif
// Class Type
class Type: public Object
class PYCXX_EXPORT Type: public Object
{
public:
explicit Type (PyObject* pyob, bool owned = false): Object(pyob, owned)
@@ -519,7 +519,7 @@ namespace Py
// ===============================================
// class boolean
class Boolean: public Object
class PYCXX_EXPORT Boolean: public Object
{
public:
// Constructor
@@ -582,7 +582,7 @@ namespace Py
// ===============================================
// class Int
class Int: public Object
class PYCXX_EXPORT Int: public Object
{
public:
// Constructor
@@ -695,7 +695,7 @@ namespace Py
// ===============================================
// class Long
class Long: public Object
class PYCXX_EXPORT Long: public Object
{
public:
// Constructor
@@ -798,7 +798,7 @@ namespace Py
#ifdef HAVE_LONG_LONG
// ===============================================
// class LongLong
class LongLong: public Object
class PYCXX_EXPORT LongLong: public Object
{
public:
// Constructor
@@ -927,7 +927,7 @@ namespace Py
// ===============================================
// class Float
//
class Float: public Object
class PYCXX_EXPORT Float: public Object
{
public:
// Constructor
@@ -1004,7 +1004,7 @@ namespace Py
// ===============================================
// class Complex
class Complex: public Object
class PYCXX_EXPORT Complex: public Object
{
public:
// Constructor
@@ -1115,7 +1115,7 @@ namespace Py
{
protected:
SeqBase<T>& s; // the sequence
int offset; // item number
size_t offset; // item number
T the_item; // lvalue
public:
@@ -1130,7 +1130,7 @@ namespace Py
// TMM: added this seqref ctor for use with STL algorithms
seqref (Object& obj)
: s(dynamic_cast< SeqBase<T>&>(obj))
, offset( NULL )
, offset( 0 )
, the_item(s.getItem(offset))
{}
~seqref()
@@ -1449,7 +1449,7 @@ namespace Py
protected:
friend class SeqBase<T>;
SeqBase<T>* seq;
int count;
size_type count;
public:
~iterator ()
@@ -1460,7 +1460,7 @@ namespace Py
, count( 0 )
{}
iterator (SeqBase<T>* s, int where)
iterator (SeqBase<T>* s, size_type where)
: seq( s )
, count( where )
{}
@@ -1587,7 +1587,7 @@ namespace Py
sequence_index_type count;
private:
const_iterator (const SeqBase<T>* s, int where)
const_iterator (const SeqBase<T>* s, size_type where)
: seq( s )
, count( where )
{}
@@ -1724,19 +1724,19 @@ namespace Py
template <TEMPLATE_TYPENAME T> bool operator<=(const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& left, const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& right);
template <TEMPLATE_TYPENAME T> bool operator>=(const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& left, const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& right);
extern bool operator==(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator!=(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator< (const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator> (const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator<=(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator>=(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator==(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator!=(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator< (const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator> (const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator<=(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator>=(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator==(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator!=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator< (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator> (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator<=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator>=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator==(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator!=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator< (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator> (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator<=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator>=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
// ==================================================
// class Char
@@ -1746,7 +1746,7 @@ namespace Py
typedef std::basic_string<Py_UNICODE> unicodestring;
extern Py_UNICODE unicode_null_string[1];
class Char: public Object
class PYCXX_EXPORT Char: public Object
{
public:
explicit Char (PyObject *pyob, bool owned = false): Object(pyob, owned)
@@ -1833,7 +1833,7 @@ namespace Py
// String and Bytes compatible with Python3 version in 6.0.0 PyCXX
class Bytes;
class String: public SeqBase<Char>
class PYCXX_EXPORT String: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -1982,7 +1982,7 @@ namespace Py
}
}
};
class Bytes: public SeqBase<Char>
class PYCXX_EXPORT Bytes: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -2108,7 +2108,7 @@ namespace Py
#else
// original PyCXX 5.4.x version of String
class String: public SeqBase<Char>
class PYCXX_EXPORT String: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -2270,7 +2270,7 @@ namespace Py
// ==================================================
// class Tuple
class Tuple: public Sequence
class PYCXX_EXPORT Tuple: public Sequence
{
public:
virtual void setItem (sequence_index_type offset, const Object&ob)
@@ -2294,7 +2294,7 @@ namespace Py
}
// New tuple of a given size
explicit Tuple (int size = 0)
explicit Tuple (sequence_index_type size = 0)
{
set(PyTuple_New (size), true);
validate ();
@@ -2348,11 +2348,11 @@ namespace Py
};
class TupleN: public Tuple
class PYCXX_EXPORT TupleN: public Tuple
{
public:
TupleN()
: Tuple( 0 )
: Tuple( (sequence_index_type)0 )
{
}
@@ -2463,7 +2463,7 @@ namespace Py
// ==================================================
// class List
class List: public Sequence
class PYCXX_EXPORT List: public Sequence
{
public:
// Constructor
@@ -2476,7 +2476,7 @@ namespace Py
validate();
}
// Creation at a fixed size
List (int size = 0)
List (sequence_index_type size = 0)
{
set(PyList_New (size), true);
validate();
@@ -2492,7 +2492,7 @@ namespace Py
// List from a sequence
List (const Sequence& s): Sequence()
{
int n = (int)s.length();
sequence_index_type n = s.length();
set(PyList_New (n), true);
validate();
for (sequence_index_type i=0; i < n; i++)
@@ -2838,7 +2838,7 @@ namespace Py
return mapref<T>(*this, key);
}
int length () const
size_type length () const
{
return PyMapping_Length (ptr());
}
@@ -2936,7 +2936,7 @@ namespace Py
//
MapBase<T>* map;
List keys; // for iterating over the map
int pos; // index into the keys
size_type pos; // index into the keys
private:
iterator( MapBase<T>* m, List k, int p )
@@ -3039,7 +3039,7 @@ namespace Py
friend class MapBase<T>;
const MapBase<T>* map;
List keys; // for iterating over the map
int pos; // index into the keys
size_type pos; // index into the keys
private:
const_iterator( const MapBase<T>* m, List k, int p )
@@ -3128,15 +3128,15 @@ namespace Py
template <TEMPLATE_TYPENAME T> bool operator==(const EXPLICIT_TYPENAME MapBase<T>::const_iterator& left, const EXPLICIT_TYPENAME MapBase<T>::const_iterator& right);
template <TEMPLATE_TYPENAME T> bool operator!=(const EXPLICIT_TYPENAME MapBase<T>::const_iterator& left, const EXPLICIT_TYPENAME MapBase<T>::const_iterator& right);
extern bool operator==(const Mapping::iterator& left, const Mapping::iterator& right);
extern bool operator!=(const Mapping::iterator& left, const Mapping::iterator& right);
extern bool operator==(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
extern bool operator!=(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
PYCXX_EXPORT extern bool operator==(const Mapping::iterator& left, const Mapping::iterator& right);
PYCXX_EXPORT extern bool operator!=(const Mapping::iterator& left, const Mapping::iterator& right);
PYCXX_EXPORT extern bool operator==(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
PYCXX_EXPORT extern bool operator!=(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
// ==================================================
// class Dict
class Dict: public Mapping
class PYCXX_EXPORT Dict: public Mapping
{
public:
// Constructor
@@ -3174,7 +3174,7 @@ namespace Py
}
};
class Callable: public Object
class PYCXX_EXPORT Callable: public Object
{
public:
// Constructor
@@ -3227,7 +3227,7 @@ namespace Py
}
};
class Module: public Object
class PYCXX_EXPORT Module: public Object
{
public:
explicit Module (PyObject* pyob, bool owned = false): Object (pyob, owned)
@@ -3272,7 +3272,7 @@ namespace Py
inline Object Object::callMemberFunction( const std::string &function_name ) const
{
Callable target( getAttr( function_name ) );
Tuple args( 0 );
Tuple args( (sequence_index_type)0 );
return target.apply( args );
}