lib
cxxsupport.cxx00001
00002
00003
00004
00005
00006 #include "Objects.hxx"
00007 namespace Py {
00008
00009 Py_UNICODE unicode_null_string[1] = { 0 };
00010
00011 Type Object::type () const
00012 {
00013 return Type (PyObject_Type (p), true);
00014 }
00015
00016 String Object::str () const
00017 {
00018 return String (PyObject_Str (p), true);
00019 }
00020
00021 String Object::repr () const
00022 {
00023 return String (PyObject_Repr (p), true);
00024 }
00025
00026 std::string Object::as_string() const
00027 {
00028 return static_cast<std::string>(str());
00029 }
00030
00031 List Object::dir () const
00032 {
00033 return List (PyObject_Dir (p), true);
00034 }
00035
00036 bool Object::isType (const Type& t) const
00037 {
00038 return type ().ptr() == t.ptr();
00039 }
00040
00041 Char::operator String() const
00042 {
00043 return String(ptr());
00044 }
00045
00046
00047
00048
00049 bool operator==(const Sequence::iterator& left, const Sequence::iterator& right)
00050 {
00051 return left.eql( right );
00052 }
00053
00054 bool operator!=(const Sequence::iterator& left, const Sequence::iterator& right)
00055 {
00056 return left.neq( right );
00057 }
00058
00059 bool operator< (const Sequence::iterator& left, const Sequence::iterator& right)
00060 {
00061 return left.lss( right );
00062 }
00063
00064 bool operator> (const Sequence::iterator& left, const Sequence::iterator& right)
00065 {
00066 return left.gtr( right );
00067 }
00068
00069 bool operator<=(const Sequence::iterator& left, const Sequence::iterator& right)
00070 {
00071 return left.leq( right );
00072 }
00073
00074 bool operator>=(const Sequence::iterator& left, const Sequence::iterator& right)
00075 {
00076 return left.geq( right );
00077 }
00078
00079
00080 bool operator==(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
00081 {
00082 return left.eql( right );
00083 }
00084
00085 bool operator!=(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
00086 {
00087 return left.neq( right );
00088 }
00089
00090 bool operator< (const Sequence::const_iterator& left, const Sequence::const_iterator& right)
00091 {
00092 return left.lss( right );
00093 }
00094
00095 bool operator> (const Sequence::const_iterator& left, const Sequence::const_iterator& right)
00096 {
00097 return left.gtr( right );
00098 }
00099
00100 bool operator<=(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
00101 {
00102 return left.leq( right );
00103 }
00104
00105 bool operator>=(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
00106 {
00107 return left.geq( right );
00108 }
00109
00110
00111 bool operator==(const Mapping::iterator& left, const Mapping::iterator& right)
00112 {
00113 return left.eql( right );
00114 }
00115
00116 bool operator!=(const Mapping::iterator& left, const Mapping::iterator& right)
00117 {
00118 return left.neq( right );
00119 }
00120
00121
00122 bool operator==(const Mapping::const_iterator& left, const Mapping::const_iterator& right)
00123 {
00124 return left.eql( right );
00125 }
00126
00127 bool operator!=(const Mapping::const_iterator& left, const Mapping::const_iterator& right)
00128 {
00129 return left.neq( right );
00130 }
00131
00132
00133 #ifndef CXX_NO_IOSTREAMS
00134
00135
00136 std::ostream& operator<< (std::ostream& os, const Object& ob)
00137 {
00138 return (os << static_cast<std::string>(ob.str()));
00139 }
00140 #endif
00141
00142 }
|