add tinyxml.h, fix char *NULL return value case

This commit is contained in:
David Rose 2009-10-13 21:28:18 +00:00
parent 778a30aa5f
commit 1d3719ccb7
3 changed files with 82 additions and 1 deletions

View File

@ -2782,6 +2782,11 @@ void InterfaceMakerPythonNative::pack_return_value(ostream &out, int indent_leve
if (remap->_return_type->new_type_is_atomic_string()) {
if (TypeManager::is_char_pointer(orig_type)) {
indent(out, indent_level)<<"if("<< return_expr<< " == NULL)\n";
indent(out, indent_level)<<"{\n";
indent(out, indent_level)<<" Py_INCREF(Py_None);\n";
indent(out, indent_level)<<" return Py_None;\n";
indent(out, indent_level)<<"}\n";
indent(out, indent_level)
<< "return PyString_FromString(" << return_expr << ");\n";
@ -2838,6 +2843,11 @@ void InterfaceMakerPythonNative::pack_return_value(ostream &out, int indent_leve
<< "return PyFloat_FromDouble(" << return_expr << ");\n";
} else if (TypeManager::is_char_pointer(type)) {
indent(out, indent_level)<<"if("<< return_expr<< " == NULL)\n";
indent(out, indent_level)<<"{\n";
indent(out, indent_level)<<" Py_INCREF(Py_None);\n";
indent(out, indent_level)<<" return Py_None;\n";
indent(out, indent_level)<<"}\n";
indent(out, indent_level)
<< "return PyString_FromString(" << return_expr << ");\n";

View File

@ -12,7 +12,7 @@
cv.h cvtypes.h cxcore.h cxerror.h cxtypes.h highgui.h \
avcodec.h avformat.h avio.h avutil.h swscale.h integer.h \
intfloat_readwrite.h mathematics.h rational.h rtp.h \
rtsp.h rtspcodes.h setjmp.h winsock2.h \
rtsp.h rtspcodes.h setjmp.h tinyxml.h winsock2.h \
ode/ode.h collision_trimesh.h artools.h \
NxPhysics.h cloth/NxCloth.h fluids/NxFluid.h \
netinet/tcp.h netinet/ip.h sys/socket.h \

View File

@ -0,0 +1,71 @@
#ifndef TINYXML_H
#define TINYXML_H
// A simple header to mirror the subset of the tinyxml interface we
// wish to expose to interrogate. This is intended to protect us from
// having to run interrogate directly on the tinyxml.h header file.
class TiXmlBase;
class TiXmlNode;
class TiXmlElement;
class TiXmlDocument;
class TiXmlBase {
};
class TiXmlNode : public TiXmlBase {
public:
const char *Value() const;
void SetValue(const char *_value);
TiXmlNode *InsertEndChild(const TiXmlNode &addThis);
bool RemoveChild( TiXmlNode* removeThis );
const TiXmlElement *NextSiblingElement() const;
TiXmlElement *NextSiblingElement();
const TiXmlElement* NextSiblingElement(const char *) const;
TiXmlElement* NextSiblingElement(const char *_next);
const TiXmlElement* FirstChildElement() const;
TiXmlElement* FirstChildElement();
const TiXmlElement* FirstChildElement( const char * _value ) const;
TiXmlElement* FirstChildElement( const char * _value );
virtual TiXmlNode* Clone() const;
};
class TiXmlElement : public TiXmlNode {
public:
TiXmlElement(const char * in_value);
TiXmlElement( const TiXmlElement& );
const char* Attribute( const char* name ) const;
void SetAttribute( const char* name, const char * _value );
void RemoveAttribute( const char * name );
};
class TiXmlDeclaration : public TiXmlNode {
public:
TiXmlDeclaration(const char* _version,
const char* _encoding,
const char* _standalone);
};
class TiXmlDocument : public TiXmlNode {
public:
TiXmlDocument();
TiXmlDocument(const char * documentName);
bool LoadFile();
bool SaveFile() const;
bool LoadFile(const char * filename);
bool SaveFile(const char * filename) const;
};
#endif