2016-09-13 06:17:47 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Qualified.h"
|
|
|
|
|
|
|
|
namespace wrap {
|
|
|
|
struct TypedefPair {
|
|
|
|
Qualified oldType, newType;
|
|
|
|
std::string includeFile;
|
|
|
|
|
|
|
|
TypedefPair() {}
|
2016-11-14 13:08:42 +08:00
|
|
|
TypedefPair(const Qualified& _oldType, const Qualified& _newType,
|
2016-09-13 06:17:47 +08:00
|
|
|
const std::string& includeFile)
|
2016-11-14 13:08:42 +08:00
|
|
|
: oldType(_oldType), newType(_newType), includeFile(includeFile) {
|
|
|
|
if (!oldType.isNonBasicType() &&
|
|
|
|
std::find(Qualified::BasicTypedefs.begin(),
|
|
|
|
Qualified::BasicTypedefs.end(),
|
|
|
|
newType) == Qualified::BasicTypedefs.end())
|
|
|
|
Qualified::BasicTypedefs.push_back(newType);
|
|
|
|
}
|
2016-09-13 06:17:47 +08:00
|
|
|
|
|
|
|
void emit_cython_pxd(FileWriter& file) const {
|
|
|
|
file.oss << "cdef extern from \"" << includeFile << "\" namespace \""
|
|
|
|
<< oldType.qualifiedNamespaces("::") << "\":\n";
|
2016-11-30 18:56:07 +08:00
|
|
|
file.oss << " ctypedef " << oldType.pxdClassName() << " "
|
2016-11-23 01:13:33 +08:00
|
|
|
<< newType.pxdClassName() << "\n";
|
2016-09-13 06:17:47 +08:00
|
|
|
}
|
|
|
|
};
|
2016-11-14 13:08:42 +08:00
|
|
|
}
|