mirror of https://github.com/mono/CppSharp.git
32 changed files with 7759 additions and 7749 deletions
@ -0,0 +1,10 @@ |
|||||||
|
# Explicitly declare text files you want to always be normalized and converted |
||||||
|
# to native line endings on checkout. |
||||||
|
*.c text |
||||||
|
*.h text |
||||||
|
*.cpp text |
||||||
|
*.cs text diff=csharp |
||||||
|
*.lua text |
||||||
|
|
||||||
|
# Declare files that will always have CRLF line endings on checkout. |
||||||
|
*.sln text eol=crlf |
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,439 +1,439 @@ |
|||||||
#include "CppParser.h" |
#include "CppParser.h" |
||||||
#include "AST.h" |
#include "AST.h" |
||||||
#include "Target.h" |
#include "Target.h" |
||||||
|
|
||||||
using namespace System; |
using namespace System; |
||||||
using namespace System::Runtime::InteropServices; |
using namespace System::Runtime::InteropServices; |
||||||
|
|
||||||
CppSharp::Parser::ParserOptions::ParserOptions(::CppSharp::CppParser::ParserOptions* native) |
CppSharp::Parser::ParserOptions::ParserOptions(::CppSharp::CppParser::ParserOptions* native) |
||||||
{ |
{ |
||||||
NativePtr = native; |
NativePtr = native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserOptions::ParserOptions(System::IntPtr native) |
CppSharp::Parser::ParserOptions::ParserOptions(System::IntPtr native) |
||||||
{ |
{ |
||||||
auto __native = (::CppSharp::CppParser::ParserOptions*)native.ToPointer(); |
auto __native = (::CppSharp::CppParser::ParserOptions*)native.ToPointer(); |
||||||
NativePtr = __native; |
NativePtr = __native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserOptions::ParserOptions() |
CppSharp::Parser::ParserOptions::ParserOptions() |
||||||
{ |
{ |
||||||
NativePtr = new ::CppSharp::CppParser::ParserOptions(); |
NativePtr = new ::CppSharp::CppParser::ParserOptions(); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserOptions::getArguments(unsigned int i) |
System::String^ CppSharp::Parser::ParserOptions::getArguments(unsigned int i) |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getArguments(i); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getArguments(i); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::addArguments(System::String^ s) |
void CppSharp::Parser::ParserOptions::addArguments(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addArguments(arg0); |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addArguments(arg0); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserOptions::getIncludeDirs(unsigned int i) |
System::String^ CppSharp::Parser::ParserOptions::getIncludeDirs(unsigned int i) |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getIncludeDirs(i); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getIncludeDirs(i); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::addIncludeDirs(System::String^ s) |
void CppSharp::Parser::ParserOptions::addIncludeDirs(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addIncludeDirs(arg0); |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addIncludeDirs(arg0); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserOptions::getSystemIncludeDirs(unsigned int i) |
System::String^ CppSharp::Parser::ParserOptions::getSystemIncludeDirs(unsigned int i) |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getSystemIncludeDirs(i); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getSystemIncludeDirs(i); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::addSystemIncludeDirs(System::String^ s) |
void CppSharp::Parser::ParserOptions::addSystemIncludeDirs(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addSystemIncludeDirs(arg0); |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addSystemIncludeDirs(arg0); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserOptions::getDefines(unsigned int i) |
System::String^ CppSharp::Parser::ParserOptions::getDefines(unsigned int i) |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getDefines(i); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getDefines(i); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::addDefines(System::String^ s) |
void CppSharp::Parser::ParserOptions::addDefines(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addDefines(arg0); |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addDefines(arg0); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserOptions::getLibraryDirs(unsigned int i) |
System::String^ CppSharp::Parser::ParserOptions::getLibraryDirs(unsigned int i) |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getLibraryDirs(i); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getLibraryDirs(i); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::addLibraryDirs(System::String^ s) |
void CppSharp::Parser::ParserOptions::addLibraryDirs(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addLibraryDirs(arg0); |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->addLibraryDirs(arg0); |
||||||
} |
} |
||||||
|
|
||||||
System::IntPtr CppSharp::Parser::ParserOptions::__Instance::get() |
System::IntPtr CppSharp::Parser::ParserOptions::__Instance::get() |
||||||
{ |
{ |
||||||
return System::IntPtr(NativePtr); |
return System::IntPtr(NativePtr); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::__Instance::set(System::IntPtr object) |
void CppSharp::Parser::ParserOptions::__Instance::set(System::IntPtr object) |
||||||
{ |
{ |
||||||
NativePtr = (::CppSharp::CppParser::ParserOptions*)object.ToPointer(); |
NativePtr = (::CppSharp::CppParser::ParserOptions*)object.ToPointer(); |
||||||
} |
} |
||||||
|
|
||||||
unsigned int CppSharp::Parser::ParserOptions::ArgumentsCount::get() |
unsigned int CppSharp::Parser::ParserOptions::ArgumentsCount::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getArgumentsCount(); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getArgumentsCount(); |
||||||
return __ret; |
return __ret; |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserOptions::FileName::get() |
System::String^ CppSharp::Parser::ParserOptions::FileName::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getFileName(); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getFileName(); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::FileName::set(System::String^ s) |
void CppSharp::Parser::ParserOptions::FileName::set(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->setFileName(arg0); |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->setFileName(arg0); |
||||||
} |
} |
||||||
|
|
||||||
unsigned int CppSharp::Parser::ParserOptions::IncludeDirsCount::get() |
unsigned int CppSharp::Parser::ParserOptions::IncludeDirsCount::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getIncludeDirsCount(); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getIncludeDirsCount(); |
||||||
return __ret; |
return __ret; |
||||||
} |
} |
||||||
|
|
||||||
unsigned int CppSharp::Parser::ParserOptions::SystemIncludeDirsCount::get() |
unsigned int CppSharp::Parser::ParserOptions::SystemIncludeDirsCount::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getSystemIncludeDirsCount(); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getSystemIncludeDirsCount(); |
||||||
return __ret; |
return __ret; |
||||||
} |
} |
||||||
|
|
||||||
unsigned int CppSharp::Parser::ParserOptions::DefinesCount::get() |
unsigned int CppSharp::Parser::ParserOptions::DefinesCount::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getDefinesCount(); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getDefinesCount(); |
||||||
return __ret; |
return __ret; |
||||||
} |
} |
||||||
|
|
||||||
unsigned int CppSharp::Parser::ParserOptions::LibraryDirsCount::get() |
unsigned int CppSharp::Parser::ParserOptions::LibraryDirsCount::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getLibraryDirsCount(); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getLibraryDirsCount(); |
||||||
return __ret; |
return __ret; |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserOptions::TargetTriple::get() |
System::String^ CppSharp::Parser::ParserOptions::TargetTriple::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getTargetTriple(); |
auto __ret = ((::CppSharp::CppParser::ParserOptions*)NativePtr)->getTargetTriple(); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::TargetTriple::set(System::String^ s) |
void CppSharp::Parser::ParserOptions::TargetTriple::set(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->setTargetTriple(arg0); |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->setTargetTriple(arg0); |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::AST::ASTContext^ CppSharp::Parser::ParserOptions::ASTContext::get() |
CppSharp::Parser::AST::ASTContext^ CppSharp::Parser::ParserOptions::ASTContext::get() |
||||||
{ |
{ |
||||||
return (((::CppSharp::CppParser::ParserOptions*)NativePtr)->ASTContext == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::ASTContext((::CppSharp::CppParser::AST::ASTContext*)((::CppSharp::CppParser::ParserOptions*)NativePtr)->ASTContext); |
return (((::CppSharp::CppParser::ParserOptions*)NativePtr)->ASTContext == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::ASTContext((::CppSharp::CppParser::AST::ASTContext*)((::CppSharp::CppParser::ParserOptions*)NativePtr)->ASTContext); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::ASTContext::set(CppSharp::Parser::AST::ASTContext^ value) |
void CppSharp::Parser::ParserOptions::ASTContext::set(CppSharp::Parser::AST::ASTContext^ value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->ASTContext = (::CppSharp::CppParser::AST::ASTContext*)value->NativePtr; |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->ASTContext = (::CppSharp::CppParser::AST::ASTContext*)value->NativePtr; |
||||||
} |
} |
||||||
|
|
||||||
int CppSharp::Parser::ParserOptions::ToolSetToUse::get() |
int CppSharp::Parser::ParserOptions::ToolSetToUse::get() |
||||||
{ |
{ |
||||||
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->ToolSetToUse; |
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->ToolSetToUse; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::ToolSetToUse::set(int value) |
void CppSharp::Parser::ParserOptions::ToolSetToUse::set(int value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->ToolSetToUse = value; |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->ToolSetToUse = value; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::AST::CppAbi CppSharp::Parser::ParserOptions::Abi::get() |
CppSharp::Parser::AST::CppAbi CppSharp::Parser::ParserOptions::Abi::get() |
||||||
{ |
{ |
||||||
return (CppSharp::Parser::AST::CppAbi)((::CppSharp::CppParser::ParserOptions*)NativePtr)->Abi; |
return (CppSharp::Parser::AST::CppAbi)((::CppSharp::CppParser::ParserOptions*)NativePtr)->Abi; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::Abi::set(CppSharp::Parser::AST::CppAbi value) |
void CppSharp::Parser::ParserOptions::Abi::set(CppSharp::Parser::AST::CppAbi value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->Abi = (::CppSharp::CppParser::AST::CppAbi)value; |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->Abi = (::CppSharp::CppParser::AST::CppAbi)value; |
||||||
} |
} |
||||||
|
|
||||||
bool CppSharp::Parser::ParserOptions::NoStandardIncludes::get() |
bool CppSharp::Parser::ParserOptions::NoStandardIncludes::get() |
||||||
{ |
{ |
||||||
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoStandardIncludes; |
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoStandardIncludes; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::NoStandardIncludes::set(bool value) |
void CppSharp::Parser::ParserOptions::NoStandardIncludes::set(bool value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoStandardIncludes = value; |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoStandardIncludes = value; |
||||||
} |
} |
||||||
|
|
||||||
bool CppSharp::Parser::ParserOptions::NoBuiltinIncludes::get() |
bool CppSharp::Parser::ParserOptions::NoBuiltinIncludes::get() |
||||||
{ |
{ |
||||||
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoBuiltinIncludes; |
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoBuiltinIncludes; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::NoBuiltinIncludes::set(bool value) |
void CppSharp::Parser::ParserOptions::NoBuiltinIncludes::set(bool value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoBuiltinIncludes = value; |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->NoBuiltinIncludes = value; |
||||||
} |
} |
||||||
|
|
||||||
bool CppSharp::Parser::ParserOptions::MicrosoftMode::get() |
bool CppSharp::Parser::ParserOptions::MicrosoftMode::get() |
||||||
{ |
{ |
||||||
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->MicrosoftMode; |
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->MicrosoftMode; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::MicrosoftMode::set(bool value) |
void CppSharp::Parser::ParserOptions::MicrosoftMode::set(bool value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->MicrosoftMode = value; |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->MicrosoftMode = value; |
||||||
} |
} |
||||||
|
|
||||||
bool CppSharp::Parser::ParserOptions::Verbose::get() |
bool CppSharp::Parser::ParserOptions::Verbose::get() |
||||||
{ |
{ |
||||||
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->Verbose; |
return ((::CppSharp::CppParser::ParserOptions*)NativePtr)->Verbose; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserOptions::Verbose::set(bool value) |
void CppSharp::Parser::ParserOptions::Verbose::set(bool value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserOptions*)NativePtr)->Verbose = value; |
((::CppSharp::CppParser::ParserOptions*)NativePtr)->Verbose = value; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserDiagnostic::ParserDiagnostic(::CppSharp::CppParser::ParserDiagnostic* native) |
CppSharp::Parser::ParserDiagnostic::ParserDiagnostic(::CppSharp::CppParser::ParserDiagnostic* native) |
||||||
{ |
{ |
||||||
NativePtr = native; |
NativePtr = native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserDiagnostic::ParserDiagnostic(System::IntPtr native) |
CppSharp::Parser::ParserDiagnostic::ParserDiagnostic(System::IntPtr native) |
||||||
{ |
{ |
||||||
auto __native = (::CppSharp::CppParser::ParserDiagnostic*)native.ToPointer(); |
auto __native = (::CppSharp::CppParser::ParserDiagnostic*)native.ToPointer(); |
||||||
NativePtr = __native; |
NativePtr = __native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserDiagnostic::ParserDiagnostic() |
CppSharp::Parser::ParserDiagnostic::ParserDiagnostic() |
||||||
{ |
{ |
||||||
NativePtr = new ::CppSharp::CppParser::ParserDiagnostic(); |
NativePtr = new ::CppSharp::CppParser::ParserDiagnostic(); |
||||||
} |
} |
||||||
|
|
||||||
System::IntPtr CppSharp::Parser::ParserDiagnostic::__Instance::get() |
System::IntPtr CppSharp::Parser::ParserDiagnostic::__Instance::get() |
||||||
{ |
{ |
||||||
return System::IntPtr(NativePtr); |
return System::IntPtr(NativePtr); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserDiagnostic::__Instance::set(System::IntPtr object) |
void CppSharp::Parser::ParserDiagnostic::__Instance::set(System::IntPtr object) |
||||||
{ |
{ |
||||||
NativePtr = (::CppSharp::CppParser::ParserDiagnostic*)object.ToPointer(); |
NativePtr = (::CppSharp::CppParser::ParserDiagnostic*)object.ToPointer(); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserDiagnostic::FileName::get() |
System::String^ CppSharp::Parser::ParserDiagnostic::FileName::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->getFileName(); |
auto __ret = ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->getFileName(); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserDiagnostic::FileName::set(System::String^ s) |
void CppSharp::Parser::ParserDiagnostic::FileName::set(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->setFileName(arg0); |
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->setFileName(arg0); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ CppSharp::Parser::ParserDiagnostic::Message::get() |
System::String^ CppSharp::Parser::ParserDiagnostic::Message::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->getMessage(); |
auto __ret = ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->getMessage(); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return clix::marshalString<clix::E_UTF8>(__ret); |
return clix::marshalString<clix::E_UTF8>(__ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserDiagnostic::Message::set(System::String^ s) |
void CppSharp::Parser::ParserDiagnostic::Message::set(System::String^ s) |
||||||
{ |
{ |
||||||
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
auto _arg0 = clix::marshalString<clix::E_UTF8>(s); |
||||||
auto arg0 = _arg0.c_str(); |
auto arg0 = _arg0.c_str(); |
||||||
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->setMessage(arg0); |
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->setMessage(arg0); |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserDiagnosticLevel CppSharp::Parser::ParserDiagnostic::Level::get() |
CppSharp::Parser::ParserDiagnosticLevel CppSharp::Parser::ParserDiagnostic::Level::get() |
||||||
{ |
{ |
||||||
return (CppSharp::Parser::ParserDiagnosticLevel)((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->Level; |
return (CppSharp::Parser::ParserDiagnosticLevel)((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->Level; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserDiagnostic::Level::set(CppSharp::Parser::ParserDiagnosticLevel value) |
void CppSharp::Parser::ParserDiagnostic::Level::set(CppSharp::Parser::ParserDiagnosticLevel value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->Level = (::CppSharp::CppParser::ParserDiagnosticLevel)value; |
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->Level = (::CppSharp::CppParser::ParserDiagnosticLevel)value; |
||||||
} |
} |
||||||
|
|
||||||
int CppSharp::Parser::ParserDiagnostic::LineNumber::get() |
int CppSharp::Parser::ParserDiagnostic::LineNumber::get() |
||||||
{ |
{ |
||||||
return ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->LineNumber; |
return ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->LineNumber; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserDiagnostic::LineNumber::set(int value) |
void CppSharp::Parser::ParserDiagnostic::LineNumber::set(int value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->LineNumber = value; |
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->LineNumber = value; |
||||||
} |
} |
||||||
|
|
||||||
int CppSharp::Parser::ParserDiagnostic::ColumnNumber::get() |
int CppSharp::Parser::ParserDiagnostic::ColumnNumber::get() |
||||||
{ |
{ |
||||||
return ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->ColumnNumber; |
return ((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->ColumnNumber; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserDiagnostic::ColumnNumber::set(int value) |
void CppSharp::Parser::ParserDiagnostic::ColumnNumber::set(int value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->ColumnNumber = value; |
((::CppSharp::CppParser::ParserDiagnostic*)NativePtr)->ColumnNumber = value; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserResult::ParserResult(::CppSharp::CppParser::ParserResult* native) |
CppSharp::Parser::ParserResult::ParserResult(::CppSharp::CppParser::ParserResult* native) |
||||||
{ |
{ |
||||||
NativePtr = native; |
NativePtr = native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserResult::ParserResult(System::IntPtr native) |
CppSharp::Parser::ParserResult::ParserResult(System::IntPtr native) |
||||||
{ |
{ |
||||||
auto __native = (::CppSharp::CppParser::ParserResult*)native.ToPointer(); |
auto __native = (::CppSharp::CppParser::ParserResult*)native.ToPointer(); |
||||||
NativePtr = __native; |
NativePtr = __native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserResult::ParserResult() |
CppSharp::Parser::ParserResult::ParserResult() |
||||||
{ |
{ |
||||||
NativePtr = new ::CppSharp::CppParser::ParserResult(); |
NativePtr = new ::CppSharp::CppParser::ParserResult(); |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserDiagnostic^ CppSharp::Parser::ParserResult::getDiagnostics(unsigned int i) |
CppSharp::Parser::ParserDiagnostic^ CppSharp::Parser::ParserResult::getDiagnostics(unsigned int i) |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserResult*)NativePtr)->getDiagnostics(i); |
auto __ret = ((::CppSharp::CppParser::ParserResult*)NativePtr)->getDiagnostics(i); |
||||||
auto ____ret = new ::CppSharp::CppParser::ParserDiagnostic(__ret); |
auto ____ret = new ::CppSharp::CppParser::ParserDiagnostic(__ret); |
||||||
return (____ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserDiagnostic((::CppSharp::CppParser::ParserDiagnostic*)____ret); |
return (____ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserDiagnostic((::CppSharp::CppParser::ParserDiagnostic*)____ret); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserResult::addDiagnostics(CppSharp::Parser::ParserDiagnostic^ s) |
void CppSharp::Parser::ParserResult::addDiagnostics(CppSharp::Parser::ParserDiagnostic^ s) |
||||||
{ |
{ |
||||||
auto &arg0 = *(::CppSharp::CppParser::ParserDiagnostic*)s->NativePtr; |
auto &arg0 = *(::CppSharp::CppParser::ParserDiagnostic*)s->NativePtr; |
||||||
((::CppSharp::CppParser::ParserResult*)NativePtr)->addDiagnostics(arg0); |
((::CppSharp::CppParser::ParserResult*)NativePtr)->addDiagnostics(arg0); |
||||||
} |
} |
||||||
|
|
||||||
System::IntPtr CppSharp::Parser::ParserResult::__Instance::get() |
System::IntPtr CppSharp::Parser::ParserResult::__Instance::get() |
||||||
{ |
{ |
||||||
return System::IntPtr(NativePtr); |
return System::IntPtr(NativePtr); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserResult::__Instance::set(System::IntPtr object) |
void CppSharp::Parser::ParserResult::__Instance::set(System::IntPtr object) |
||||||
{ |
{ |
||||||
NativePtr = (::CppSharp::CppParser::ParserResult*)object.ToPointer(); |
NativePtr = (::CppSharp::CppParser::ParserResult*)object.ToPointer(); |
||||||
} |
} |
||||||
|
|
||||||
unsigned int CppSharp::Parser::ParserResult::DiagnosticsCount::get() |
unsigned int CppSharp::Parser::ParserResult::DiagnosticsCount::get() |
||||||
{ |
{ |
||||||
auto __ret = ((::CppSharp::CppParser::ParserResult*)NativePtr)->getDiagnosticsCount(); |
auto __ret = ((::CppSharp::CppParser::ParserResult*)NativePtr)->getDiagnosticsCount(); |
||||||
return __ret; |
return __ret; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserResultKind CppSharp::Parser::ParserResult::Kind::get() |
CppSharp::Parser::ParserResultKind CppSharp::Parser::ParserResult::Kind::get() |
||||||
{ |
{ |
||||||
return (CppSharp::Parser::ParserResultKind)((::CppSharp::CppParser::ParserResult*)NativePtr)->Kind; |
return (CppSharp::Parser::ParserResultKind)((::CppSharp::CppParser::ParserResult*)NativePtr)->Kind; |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserResult::Kind::set(CppSharp::Parser::ParserResultKind value) |
void CppSharp::Parser::ParserResult::Kind::set(CppSharp::Parser::ParserResultKind value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserResult*)NativePtr)->Kind = (::CppSharp::CppParser::ParserResultKind)value; |
((::CppSharp::CppParser::ParserResult*)NativePtr)->Kind = (::CppSharp::CppParser::ParserResultKind)value; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::AST::ASTContext^ CppSharp::Parser::ParserResult::ASTContext::get() |
CppSharp::Parser::AST::ASTContext^ CppSharp::Parser::ParserResult::ASTContext::get() |
||||||
{ |
{ |
||||||
return (((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::ASTContext((::CppSharp::CppParser::AST::ASTContext*)((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext); |
return (((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::ASTContext((::CppSharp::CppParser::AST::ASTContext*)((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserResult::ASTContext::set(CppSharp::Parser::AST::ASTContext^ value) |
void CppSharp::Parser::ParserResult::ASTContext::set(CppSharp::Parser::AST::ASTContext^ value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext = (::CppSharp::CppParser::AST::ASTContext*)value->NativePtr; |
((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext = (::CppSharp::CppParser::AST::ASTContext*)value->NativePtr; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::AST::NativeLibrary^ CppSharp::Parser::ParserResult::Library::get() |
CppSharp::Parser::AST::NativeLibrary^ CppSharp::Parser::ParserResult::Library::get() |
||||||
{ |
{ |
||||||
return (((::CppSharp::CppParser::ParserResult*)NativePtr)->Library == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::NativeLibrary((::CppSharp::CppParser::AST::NativeLibrary*)((::CppSharp::CppParser::ParserResult*)NativePtr)->Library); |
return (((::CppSharp::CppParser::ParserResult*)NativePtr)->Library == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::NativeLibrary((::CppSharp::CppParser::AST::NativeLibrary*)((::CppSharp::CppParser::ParserResult*)NativePtr)->Library); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ParserResult::Library::set(CppSharp::Parser::AST::NativeLibrary^ value) |
void CppSharp::Parser::ParserResult::Library::set(CppSharp::Parser::AST::NativeLibrary^ value) |
||||||
{ |
{ |
||||||
((::CppSharp::CppParser::ParserResult*)NativePtr)->Library = (::CppSharp::CppParser::AST::NativeLibrary*)value->NativePtr; |
((::CppSharp::CppParser::ParserResult*)NativePtr)->Library = (::CppSharp::CppParser::AST::NativeLibrary*)value->NativePtr; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ClangParser::ClangParser(::CppSharp::CppParser::ClangParser* native) |
CppSharp::Parser::ClangParser::ClangParser(::CppSharp::CppParser::ClangParser* native) |
||||||
{ |
{ |
||||||
NativePtr = native; |
NativePtr = native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ClangParser::ClangParser(System::IntPtr native) |
CppSharp::Parser::ClangParser::ClangParser(System::IntPtr native) |
||||||
{ |
{ |
||||||
auto __native = (::CppSharp::CppParser::ClangParser*)native.ToPointer(); |
auto __native = (::CppSharp::CppParser::ClangParser*)native.ToPointer(); |
||||||
NativePtr = __native; |
NativePtr = __native; |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserResult^ CppSharp::Parser::ClangParser::ParseHeader(CppSharp::Parser::ParserOptions^ Opts) |
CppSharp::Parser::ParserResult^ CppSharp::Parser::ClangParser::ParseHeader(CppSharp::Parser::ParserOptions^ Opts) |
||||||
{ |
{ |
||||||
auto arg0 = (::CppSharp::CppParser::ParserOptions*)Opts->NativePtr; |
auto arg0 = (::CppSharp::CppParser::ParserOptions*)Opts->NativePtr; |
||||||
auto __ret = ::CppSharp::CppParser::ClangParser::ParseHeader(arg0); |
auto __ret = ::CppSharp::CppParser::ClangParser::ParseHeader(arg0); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return (__ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserResult((::CppSharp::CppParser::ParserResult*)__ret); |
return (__ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserResult((::CppSharp::CppParser::ParserResult*)__ret); |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserResult^ CppSharp::Parser::ClangParser::ParseLibrary(CppSharp::Parser::ParserOptions^ Opts) |
CppSharp::Parser::ParserResult^ CppSharp::Parser::ClangParser::ParseLibrary(CppSharp::Parser::ParserOptions^ Opts) |
||||||
{ |
{ |
||||||
auto arg0 = (::CppSharp::CppParser::ParserOptions*)Opts->NativePtr; |
auto arg0 = (::CppSharp::CppParser::ParserOptions*)Opts->NativePtr; |
||||||
auto __ret = ::CppSharp::CppParser::ClangParser::ParseLibrary(arg0); |
auto __ret = ::CppSharp::CppParser::ClangParser::ParseLibrary(arg0); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return (__ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserResult((::CppSharp::CppParser::ParserResult*)__ret); |
return (__ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserResult((::CppSharp::CppParser::ParserResult*)__ret); |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserTargetInfo^ CppSharp::Parser::ClangParser::GetTargetInfo(CppSharp::Parser::ParserOptions^ Opts) |
CppSharp::Parser::ParserTargetInfo^ CppSharp::Parser::ClangParser::GetTargetInfo(CppSharp::Parser::ParserOptions^ Opts) |
||||||
{ |
{ |
||||||
auto arg0 = (::CppSharp::CppParser::ParserOptions*)Opts->NativePtr; |
auto arg0 = (::CppSharp::CppParser::ParserOptions*)Opts->NativePtr; |
||||||
auto __ret = ::CppSharp::CppParser::ClangParser::GetTargetInfo(arg0); |
auto __ret = ::CppSharp::CppParser::ClangParser::GetTargetInfo(arg0); |
||||||
if (__ret == nullptr) return nullptr; |
if (__ret == nullptr) return nullptr; |
||||||
return (__ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserTargetInfo((::CppSharp::CppParser::ParserTargetInfo*)__ret); |
return (__ret == nullptr) ? nullptr : gcnew CppSharp::Parser::ParserTargetInfo((::CppSharp::CppParser::ParserTargetInfo*)__ret); |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ClangParser::ClangParser() |
CppSharp::Parser::ClangParser::ClangParser() |
||||||
{ |
{ |
||||||
NativePtr = new ::CppSharp::CppParser::ClangParser(); |
NativePtr = new ::CppSharp::CppParser::ClangParser(); |
||||||
} |
} |
||||||
|
|
||||||
System::IntPtr CppSharp::Parser::ClangParser::__Instance::get() |
System::IntPtr CppSharp::Parser::ClangParser::__Instance::get() |
||||||
{ |
{ |
||||||
return System::IntPtr(NativePtr); |
return System::IntPtr(NativePtr); |
||||||
} |
} |
||||||
|
|
||||||
void CppSharp::Parser::ClangParser::__Instance::set(System::IntPtr object) |
void CppSharp::Parser::ClangParser::__Instance::set(System::IntPtr object) |
||||||
{ |
{ |
||||||
NativePtr = (::CppSharp::CppParser::ClangParser*)object.ToPointer(); |
NativePtr = (::CppSharp::CppParser::ClangParser*)object.ToPointer(); |
||||||
} |
} |
||||||
|
|||||||
@ -1,283 +1,283 @@ |
|||||||
#pragma once |
#pragma once |
||||||
|
|
||||||
#include "CppSharp.h" |
#include "CppSharp.h" |
||||||
#include <CppParser.h> |
#include <CppParser.h> |
||||||
|
|
||||||
namespace CppSharp |
namespace CppSharp |
||||||
{ |
{ |
||||||
namespace Parser |
namespace Parser |
||||||
{ |
{ |
||||||
enum struct ParserDiagnosticLevel; |
enum struct ParserDiagnosticLevel; |
||||||
enum struct ParserResultKind; |
enum struct ParserResultKind; |
||||||
enum struct SourceLocationKind; |
enum struct SourceLocationKind; |
||||||
ref class ClangParser; |
ref class ClangParser; |
||||||
ref class Parser; |
ref class Parser; |
||||||
ref class ParserDiagnostic; |
ref class ParserDiagnostic; |
||||||
ref class ParserOptions; |
ref class ParserOptions; |
||||||
ref class ParserResult; |
ref class ParserResult; |
||||||
ref class ParserTargetInfo; |
ref class ParserTargetInfo; |
||||||
namespace AST |
namespace AST |
||||||
{ |
{ |
||||||
enum struct CppAbi; |
enum struct CppAbi; |
||||||
ref class ASTContext; |
ref class ASTContext; |
||||||
ref class NativeLibrary; |
ref class NativeLibrary; |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
namespace CppSharp |
namespace CppSharp |
||||||
{ |
{ |
||||||
namespace Parser |
namespace Parser |
||||||
{ |
{ |
||||||
public enum struct ParserDiagnosticLevel |
public enum struct ParserDiagnosticLevel |
||||||
{ |
{ |
||||||
Ignored = 0, |
Ignored = 0, |
||||||
Note = 1, |
Note = 1, |
||||||
Warning = 2, |
Warning = 2, |
||||||
Error = 3, |
Error = 3, |
||||||
Fatal = 4 |
Fatal = 4 |
||||||
}; |
}; |
||||||
|
|
||||||
public enum struct ParserResultKind |
public enum struct ParserResultKind |
||||||
{ |
{ |
||||||
Success = 0, |
Success = 0, |
||||||
Error = 1, |
Error = 1, |
||||||
FileNotFound = 2 |
FileNotFound = 2 |
||||||
}; |
}; |
||||||
|
|
||||||
public enum struct SourceLocationKind |
public enum struct SourceLocationKind |
||||||
{ |
{ |
||||||
Invalid = 0, |
Invalid = 0, |
||||||
Builtin = 1, |
Builtin = 1, |
||||||
CommandLine = 2, |
CommandLine = 2, |
||||||
System = 3, |
System = 3, |
||||||
User = 4 |
User = 4 |
||||||
}; |
}; |
||||||
|
|
||||||
public ref class ParserOptions : ICppInstance |
public ref class ParserOptions : ICppInstance |
||||||
{ |
{ |
||||||
public: |
public: |
||||||
|
|
||||||
property ::CppSharp::CppParser::ParserOptions* NativePtr; |
property ::CppSharp::CppParser::ParserOptions* NativePtr; |
||||||
property System::IntPtr __Instance |
property System::IntPtr __Instance |
||||||
{ |
{ |
||||||
virtual System::IntPtr get(); |
virtual System::IntPtr get(); |
||||||
virtual void set(System::IntPtr instance); |
virtual void set(System::IntPtr instance); |
||||||
} |
} |
||||||
|
|
||||||
ParserOptions(::CppSharp::CppParser::ParserOptions* native); |
ParserOptions(::CppSharp::CppParser::ParserOptions* native); |
||||||
ParserOptions(System::IntPtr native); |
ParserOptions(System::IntPtr native); |
||||||
ParserOptions(); |
ParserOptions(); |
||||||
|
|
||||||
property unsigned int ArgumentsCount |
property unsigned int ArgumentsCount |
||||||
{ |
{ |
||||||
unsigned int get(); |
unsigned int get(); |
||||||
} |
} |
||||||
|
|
||||||
property System::String^ FileName |
property System::String^ FileName |
||||||
{ |
{ |
||||||
System::String^ get(); |
System::String^ get(); |
||||||
void set(System::String^); |
void set(System::String^); |
||||||
} |
} |
||||||
|
|
||||||
property unsigned int IncludeDirsCount |
property unsigned int IncludeDirsCount |
||||||
{ |
{ |
||||||
unsigned int get(); |
unsigned int get(); |
||||||
} |
} |
||||||
|
|
||||||
property unsigned int SystemIncludeDirsCount |
property unsigned int SystemIncludeDirsCount |
||||||
{ |
{ |
||||||
unsigned int get(); |
unsigned int get(); |
||||||
} |
} |
||||||
|
|
||||||
property unsigned int DefinesCount |
property unsigned int DefinesCount |
||||||
{ |
{ |
||||||
unsigned int get(); |
unsigned int get(); |
||||||
} |
} |
||||||
|
|
||||||
property unsigned int LibraryDirsCount |
property unsigned int LibraryDirsCount |
||||||
{ |
{ |
||||||
unsigned int get(); |
unsigned int get(); |
||||||
} |
} |
||||||
|
|
||||||
property System::String^ TargetTriple |
property System::String^ TargetTriple |
||||||
{ |
{ |
||||||
System::String^ get(); |
System::String^ get(); |
||||||
void set(System::String^); |
void set(System::String^); |
||||||
} |
} |
||||||
|
|
||||||
property CppSharp::Parser::AST::ASTContext^ ASTContext |
property CppSharp::Parser::AST::ASTContext^ ASTContext |
||||||
{ |
{ |
||||||
CppSharp::Parser::AST::ASTContext^ get(); |
CppSharp::Parser::AST::ASTContext^ get(); |
||||||
void set(CppSharp::Parser::AST::ASTContext^); |
void set(CppSharp::Parser::AST::ASTContext^); |
||||||
} |
} |
||||||
|
|
||||||
property int ToolSetToUse |
property int ToolSetToUse |
||||||
{ |
{ |
||||||
int get(); |
int get(); |
||||||
void set(int); |
void set(int); |
||||||
} |
} |
||||||
|
|
||||||
property CppSharp::Parser::AST::CppAbi Abi |
property CppSharp::Parser::AST::CppAbi Abi |
||||||
{ |
{ |
||||||
CppSharp::Parser::AST::CppAbi get(); |
CppSharp::Parser::AST::CppAbi get(); |
||||||
void set(CppSharp::Parser::AST::CppAbi); |
void set(CppSharp::Parser::AST::CppAbi); |
||||||
} |
} |
||||||
|
|
||||||
property bool NoStandardIncludes |
property bool NoStandardIncludes |
||||||
{ |
{ |
||||||
bool get(); |
bool get(); |
||||||
void set(bool); |
void set(bool); |
||||||
} |
} |
||||||
|
|
||||||
property bool NoBuiltinIncludes |
property bool NoBuiltinIncludes |
||||||
{ |
{ |
||||||
bool get(); |
bool get(); |
||||||
void set(bool); |
void set(bool); |
||||||
} |
} |
||||||
|
|
||||||
property bool MicrosoftMode |
property bool MicrosoftMode |
||||||
{ |
{ |
||||||
bool get(); |
bool get(); |
||||||
void set(bool); |
void set(bool); |
||||||
} |
} |
||||||
|
|
||||||
property bool Verbose |
property bool Verbose |
||||||
{ |
{ |
||||||
bool get(); |
bool get(); |
||||||
void set(bool); |
void set(bool); |
||||||
} |
} |
||||||
|
|
||||||
System::String^ getArguments(unsigned int i); |
System::String^ getArguments(unsigned int i); |
||||||
|
|
||||||
void addArguments(System::String^ s); |
void addArguments(System::String^ s); |
||||||
|
|
||||||
System::String^ getIncludeDirs(unsigned int i); |
System::String^ getIncludeDirs(unsigned int i); |
||||||
|
|
||||||
void addIncludeDirs(System::String^ s); |
void addIncludeDirs(System::String^ s); |
||||||
|
|
||||||
System::String^ getSystemIncludeDirs(unsigned int i); |
System::String^ getSystemIncludeDirs(unsigned int i); |
||||||
|
|
||||||
void addSystemIncludeDirs(System::String^ s); |
void addSystemIncludeDirs(System::String^ s); |
||||||
|
|
||||||
System::String^ getDefines(unsigned int i); |
System::String^ getDefines(unsigned int i); |
||||||
|
|
||||||
void addDefines(System::String^ s); |
void addDefines(System::String^ s); |
||||||
|
|
||||||
System::String^ getLibraryDirs(unsigned int i); |
System::String^ getLibraryDirs(unsigned int i); |
||||||
|
|
||||||
void addLibraryDirs(System::String^ s); |
void addLibraryDirs(System::String^ s); |
||||||
}; |
}; |
||||||
|
|
||||||
public ref class ParserDiagnostic : ICppInstance |
public ref class ParserDiagnostic : ICppInstance |
||||||
{ |
{ |
||||||
public: |
public: |
||||||
|
|
||||||
property ::CppSharp::CppParser::ParserDiagnostic* NativePtr; |
property ::CppSharp::CppParser::ParserDiagnostic* NativePtr; |
||||||
property System::IntPtr __Instance |
property System::IntPtr __Instance |
||||||
{ |
{ |
||||||
virtual System::IntPtr get(); |
virtual System::IntPtr get(); |
||||||
virtual void set(System::IntPtr instance); |
virtual void set(System::IntPtr instance); |
||||||
} |
} |
||||||
|
|
||||||
ParserDiagnostic(::CppSharp::CppParser::ParserDiagnostic* native); |
ParserDiagnostic(::CppSharp::CppParser::ParserDiagnostic* native); |
||||||
ParserDiagnostic(System::IntPtr native); |
ParserDiagnostic(System::IntPtr native); |
||||||
ParserDiagnostic(); |
ParserDiagnostic(); |
||||||
|
|
||||||
property System::String^ FileName |
property System::String^ FileName |
||||||
{ |
{ |
||||||
System::String^ get(); |
System::String^ get(); |
||||||
void set(System::String^); |
void set(System::String^); |
||||||
} |
} |
||||||
|
|
||||||
property System::String^ Message |
property System::String^ Message |
||||||
{ |
{ |
||||||
System::String^ get(); |
System::String^ get(); |
||||||
void set(System::String^); |
void set(System::String^); |
||||||
} |
} |
||||||
|
|
||||||
property CppSharp::Parser::ParserDiagnosticLevel Level |
property CppSharp::Parser::ParserDiagnosticLevel Level |
||||||
{ |
{ |
||||||
CppSharp::Parser::ParserDiagnosticLevel get(); |
CppSharp::Parser::ParserDiagnosticLevel get(); |
||||||
void set(CppSharp::Parser::ParserDiagnosticLevel); |
void set(CppSharp::Parser::ParserDiagnosticLevel); |
||||||
} |
} |
||||||
|
|
||||||
property int LineNumber |
property int LineNumber |
||||||
{ |
{ |
||||||
int get(); |
int get(); |
||||||
void set(int); |
void set(int); |
||||||
} |
} |
||||||
|
|
||||||
property int ColumnNumber |
property int ColumnNumber |
||||||
{ |
{ |
||||||
int get(); |
int get(); |
||||||
void set(int); |
void set(int); |
||||||
} |
} |
||||||
}; |
}; |
||||||
|
|
||||||
public ref class ParserResult : ICppInstance |
public ref class ParserResult : ICppInstance |
||||||
{ |
{ |
||||||
public: |
public: |
||||||
|
|
||||||
property ::CppSharp::CppParser::ParserResult* NativePtr; |
property ::CppSharp::CppParser::ParserResult* NativePtr; |
||||||
property System::IntPtr __Instance |
property System::IntPtr __Instance |
||||||
{ |
{ |
||||||
virtual System::IntPtr get(); |
virtual System::IntPtr get(); |
||||||
virtual void set(System::IntPtr instance); |
virtual void set(System::IntPtr instance); |
||||||
} |
} |
||||||
|
|
||||||
ParserResult(::CppSharp::CppParser::ParserResult* native); |
ParserResult(::CppSharp::CppParser::ParserResult* native); |
||||||
ParserResult(System::IntPtr native); |
ParserResult(System::IntPtr native); |
||||||
ParserResult(); |
ParserResult(); |
||||||
|
|
||||||
property unsigned int DiagnosticsCount |
property unsigned int DiagnosticsCount |
||||||
{ |
{ |
||||||
unsigned int get(); |
unsigned int get(); |
||||||
} |
} |
||||||
|
|
||||||
property CppSharp::Parser::ParserResultKind Kind |
property CppSharp::Parser::ParserResultKind Kind |
||||||
{ |
{ |
||||||
CppSharp::Parser::ParserResultKind get(); |
CppSharp::Parser::ParserResultKind get(); |
||||||
void set(CppSharp::Parser::ParserResultKind); |
void set(CppSharp::Parser::ParserResultKind); |
||||||
} |
} |
||||||
|
|
||||||
property CppSharp::Parser::AST::ASTContext^ ASTContext |
property CppSharp::Parser::AST::ASTContext^ ASTContext |
||||||
{ |
{ |
||||||
CppSharp::Parser::AST::ASTContext^ get(); |
CppSharp::Parser::AST::ASTContext^ get(); |
||||||
void set(CppSharp::Parser::AST::ASTContext^); |
void set(CppSharp::Parser::AST::ASTContext^); |
||||||
} |
} |
||||||
|
|
||||||
property CppSharp::Parser::AST::NativeLibrary^ Library |
property CppSharp::Parser::AST::NativeLibrary^ Library |
||||||
{ |
{ |
||||||
CppSharp::Parser::AST::NativeLibrary^ get(); |
CppSharp::Parser::AST::NativeLibrary^ get(); |
||||||
void set(CppSharp::Parser::AST::NativeLibrary^); |
void set(CppSharp::Parser::AST::NativeLibrary^); |
||||||
} |
} |
||||||
|
|
||||||
CppSharp::Parser::ParserDiagnostic^ getDiagnostics(unsigned int i); |
CppSharp::Parser::ParserDiagnostic^ getDiagnostics(unsigned int i); |
||||||
|
|
||||||
void addDiagnostics(CppSharp::Parser::ParserDiagnostic^ s); |
void addDiagnostics(CppSharp::Parser::ParserDiagnostic^ s); |
||||||
}; |
}; |
||||||
|
|
||||||
public ref class ClangParser : ICppInstance |
public ref class ClangParser : ICppInstance |
||||||
{ |
{ |
||||||
public: |
public: |
||||||
|
|
||||||
property ::CppSharp::CppParser::ClangParser* NativePtr; |
property ::CppSharp::CppParser::ClangParser* NativePtr; |
||||||
property System::IntPtr __Instance |
property System::IntPtr __Instance |
||||||
{ |
{ |
||||||
virtual System::IntPtr get(); |
virtual System::IntPtr get(); |
||||||
virtual void set(System::IntPtr instance); |
virtual void set(System::IntPtr instance); |
||||||
} |
} |
||||||
|
|
||||||
ClangParser(::CppSharp::CppParser::ClangParser* native); |
ClangParser(::CppSharp::CppParser::ClangParser* native); |
||||||
ClangParser(System::IntPtr native); |
ClangParser(System::IntPtr native); |
||||||
ClangParser(); |
ClangParser(); |
||||||
|
|
||||||
static CppSharp::Parser::ParserResult^ ParseHeader(CppSharp::Parser::ParserOptions^ Opts); |
static CppSharp::Parser::ParserResult^ ParseHeader(CppSharp::Parser::ParserOptions^ Opts); |
||||||
|
|
||||||
static CppSharp::Parser::ParserResult^ ParseLibrary(CppSharp::Parser::ParserOptions^ Opts); |
static CppSharp::Parser::ParserResult^ ParseLibrary(CppSharp::Parser::ParserOptions^ Opts); |
||||||
|
|
||||||
static CppSharp::Parser::ParserTargetInfo^ GetTargetInfo(CppSharp::Parser::ParserOptions^ Opts); |
static CppSharp::Parser::ParserTargetInfo^ GetTargetInfo(CppSharp::Parser::ParserOptions^ Opts); |
||||||
}; |
}; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
@ -1,17 +1,17 @@ |
|||||||
project "CppSharp.Generator" |
project "CppSharp.Generator" |
||||||
|
|
||||||
kind "SharedLib" |
kind "SharedLib" |
||||||
language "C#" |
language "C#" |
||||||
location "." |
location "." |
||||||
|
|
||||||
SetupManagedProject() |
SetupManagedProject() |
||||||
|
|
||||||
files { "**.cs", "**verbs.txt" } |
files { "**.cs", "**verbs.txt" } |
||||||
excludes { "Filter.cs" } |
excludes { "Filter.cs" } |
||||||
|
|
||||||
links { "System", "System.Core", "CppSharp", "CppSharp.AST" } |
links { "System", "System.Core", "CppSharp", "CppSharp.AST" } |
||||||
|
|
||||||
SetupParser() |
SetupParser() |
||||||
|
|
||||||
configuration '**verbs.txt' |
configuration '**verbs.txt' |
||||||
buildaction "Embed" |
buildaction "Embed" |
||||||
|
|||||||
@ -1,398 +1,398 @@ |
|||||||
using System; |
using System; |
||||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||||
using CppSharp.AST; |
using CppSharp.AST; |
||||||
using CppSharp.AST.Extensions; |
using CppSharp.AST.Extensions; |
||||||
using CppSharp.Types; |
using CppSharp.Types; |
||||||
using Type = CppSharp.AST.Type; |
using Type = CppSharp.AST.Type; |
||||||
|
|
||||||
namespace CppSharp.Generators.CLI |
namespace CppSharp.Generators.CLI |
||||||
{ |
{ |
||||||
public class CLITypePrinterContext : TypePrinterContext |
public class CLITypePrinterContext : TypePrinterContext |
||||||
{ |
{ |
||||||
public CLITypePrinterContext() |
public CLITypePrinterContext() |
||||||
{ |
{ |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
public CLITypePrinterContext(TypePrinterContextKind kind) |
public CLITypePrinterContext(TypePrinterContextKind kind) |
||||||
: base(kind) |
: base(kind) |
||||||
{ |
{ |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
public class CLITypePrinter : ITypePrinter<string>, IDeclVisitor<string> |
public class CLITypePrinter : ITypePrinter<string>, IDeclVisitor<string> |
||||||
{ |
{ |
||||||
public Driver Driver { get; set; } |
public Driver Driver { get; set; } |
||||||
public CLITypePrinterContext Context { get; set; } |
public CLITypePrinterContext Context { get; set; } |
||||||
|
|
||||||
readonly ITypeMapDatabase TypeMapDatabase; |
readonly ITypeMapDatabase TypeMapDatabase; |
||||||
readonly DriverOptions Options; |
readonly DriverOptions Options; |
||||||
|
|
||||||
public CLITypePrinter(Driver driver) |
public CLITypePrinter(Driver driver) |
||||||
{ |
{ |
||||||
Driver = driver; |
Driver = driver; |
||||||
TypeMapDatabase = driver.TypeDatabase; |
TypeMapDatabase = driver.TypeDatabase; |
||||||
Options = driver.Options; |
Options = driver.Options; |
||||||
Context = new CLITypePrinterContext(); |
Context = new CLITypePrinterContext(); |
||||||
} |
} |
||||||
|
|
||||||
public CLITypePrinter(Driver driver, CLITypePrinterContext context) |
public CLITypePrinter(Driver driver, CLITypePrinterContext context) |
||||||
: this(driver) |
: this(driver) |
||||||
{ |
{ |
||||||
Context = context; |
Context = context; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTagType(TagType tag, TypeQualifiers quals) |
public string VisitTagType(TagType tag, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
TypeMap typeMap = null; |
TypeMap typeMap = null; |
||||||
if (TypeMapDatabase.FindTypeMap(tag, out typeMap)) |
if (TypeMapDatabase.FindTypeMap(tag, out typeMap)) |
||||||
{ |
{ |
||||||
typeMap.Type = tag; |
typeMap.Type = tag; |
||||||
Context.Type = tag; |
Context.Type = tag; |
||||||
return typeMap.CLISignature(Context); |
return typeMap.CLISignature(Context); |
||||||
} |
} |
||||||
|
|
||||||
Declaration decl = tag.Declaration; |
Declaration decl = tag.Declaration; |
||||||
|
|
||||||
if (decl == null) |
if (decl == null) |
||||||
return string.Empty; |
return string.Empty; |
||||||
|
|
||||||
return VisitDeclaration(decl, quals); |
return VisitDeclaration(decl, quals); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitArrayType(ArrayType array, TypeQualifiers quals) |
public string VisitArrayType(ArrayType array, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return string.Format("cli::array<{0}>^", array.Type.Visit(this)); |
return string.Format("cli::array<{0}>^", array.Type.Visit(this)); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFunctionType(FunctionType function, TypeQualifiers quals) |
public string VisitFunctionType(FunctionType function, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var arguments = function.Parameters; |
var arguments = function.Parameters; |
||||||
var returnType = function.ReturnType; |
var returnType = function.ReturnType; |
||||||
var args = string.Empty; |
var args = string.Empty; |
||||||
|
|
||||||
if (arguments.Count > 0) |
if (arguments.Count > 0) |
||||||
args = VisitParameters(function.Parameters, hasNames: false); |
args = VisitParameters(function.Parameters, hasNames: false); |
||||||
|
|
||||||
if (returnType.Type.IsPrimitiveType(PrimitiveType.Void)) |
if (returnType.Type.IsPrimitiveType(PrimitiveType.Void)) |
||||||
{ |
{ |
||||||
if (!string.IsNullOrEmpty(args)) |
if (!string.IsNullOrEmpty(args)) |
||||||
args = string.Format("<{0}>", args); |
args = string.Format("<{0}>", args); |
||||||
return string.Format("System::Action{0}", args); |
return string.Format("System::Action{0}", args); |
||||||
} |
} |
||||||
|
|
||||||
if (!string.IsNullOrEmpty(args)) |
if (!string.IsNullOrEmpty(args)) |
||||||
args = string.Format(", {0}", args); |
args = string.Format(", {0}", args); |
||||||
|
|
||||||
return string.Format("System::Func<{0}{1}>", returnType.Visit(this), args); |
return string.Format("System::Func<{0}{1}>", returnType.Visit(this), args); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitParameters(IEnumerable<Parameter> @params, |
public string VisitParameters(IEnumerable<Parameter> @params, |
||||||
bool hasNames) |
bool hasNames) |
||||||
{ |
{ |
||||||
var args = new List<string>(); |
var args = new List<string>(); |
||||||
|
|
||||||
foreach (var param in @params) |
foreach (var param in @params) |
||||||
args.Add(VisitParameter(param, hasNames)); |
args.Add(VisitParameter(param, hasNames)); |
||||||
|
|
||||||
return string.Join(", ", args); |
return string.Join(", ", args); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitParameter(Parameter param, bool hasName = true) |
public string VisitParameter(Parameter param, bool hasName = true) |
||||||
{ |
{ |
||||||
Context.Parameter = param; |
Context.Parameter = param; |
||||||
var type = param.Type.Visit(this, param.QualifiedType.Qualifiers); |
var type = param.Type.Visit(this, param.QualifiedType.Qualifiers); |
||||||
Context.Parameter = null; |
Context.Parameter = null; |
||||||
|
|
||||||
var str = string.Empty; |
var str = string.Empty; |
||||||
if(param.Usage == ParameterUsage.Out) |
if(param.Usage == ParameterUsage.Out) |
||||||
str += "[System::Runtime::InteropServices::Out] "; |
str += "[System::Runtime::InteropServices::Out] "; |
||||||
|
|
||||||
str += type; |
str += type; |
||||||
|
|
||||||
if(param.Usage == ParameterUsage.Out || |
if(param.Usage == ParameterUsage.Out || |
||||||
param.Usage == ParameterUsage.InOut) |
param.Usage == ParameterUsage.InOut) |
||||||
str += "%"; |
str += "%"; |
||||||
|
|
||||||
if (hasName && !string.IsNullOrEmpty(param.Name)) |
if (hasName && !string.IsNullOrEmpty(param.Name)) |
||||||
str += " " + param.Name; |
str += " " + param.Name; |
||||||
|
|
||||||
return str; |
return str; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDelegate(FunctionType function) |
public string VisitDelegate(FunctionType function) |
||||||
{ |
{ |
||||||
return string.Format("delegate {0} {{0}}({1})", |
return string.Format("delegate {0} {{0}}({1})", |
||||||
function.ReturnType.Visit(this), |
function.ReturnType.Visit(this), |
||||||
VisitParameters(function.Parameters, hasNames: true)); |
VisitParameters(function.Parameters, hasNames: true)); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPointerType(PointerType pointer, TypeQualifiers quals) |
public string VisitPointerType(PointerType pointer, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var pointee = pointer.Pointee.Desugar(); |
var pointee = pointer.Pointee.Desugar(); |
||||||
|
|
||||||
if (pointee is FunctionType) |
if (pointee is FunctionType) |
||||||
{ |
{ |
||||||
var function = pointee as FunctionType; |
var function = pointee as FunctionType; |
||||||
return string.Format("{0}^", function.Visit(this, quals)); |
return string.Format("{0}^", function.Visit(this, quals)); |
||||||
} |
} |
||||||
|
|
||||||
if (pointee.IsPrimitiveType(PrimitiveType.Char) && quals.IsConst) |
if (pointee.IsPrimitiveType(PrimitiveType.Char) && quals.IsConst) |
||||||
{ |
{ |
||||||
return "System::String^"; |
return "System::String^"; |
||||||
} |
} |
||||||
|
|
||||||
// From http://msdn.microsoft.com/en-us/library/y31yhkeb.aspx
|
// From http://msdn.microsoft.com/en-us/library/y31yhkeb.aspx
|
||||||
// Any of the following types may be a pointer type:
|
// Any of the following types may be a pointer type:
|
||||||
// * sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, or bool.
|
// * sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, or bool.
|
||||||
// * Any enum type.
|
// * Any enum type.
|
||||||
// * Any pointer type.
|
// * Any pointer type.
|
||||||
// * Any user-defined struct type that contains fields of unmanaged types only.
|
// * Any user-defined struct type that contains fields of unmanaged types only.
|
||||||
var finalPointee = pointer.GetFinalPointee(); |
var finalPointee = pointer.GetFinalPointee(); |
||||||
if (finalPointee.IsPrimitiveType()) |
if (finalPointee.IsPrimitiveType()) |
||||||
{ |
{ |
||||||
// Skip one indirection if passed by reference
|
// Skip one indirection if passed by reference
|
||||||
var param = Context.Parameter; |
var param = Context.Parameter; |
||||||
if (param != null && (param.IsOut || param.IsInOut) |
if (param != null && (param.IsOut || param.IsInOut) |
||||||
&& pointee == finalPointee) |
&& pointee == finalPointee) |
||||||
return pointee.Visit(this, quals); |
return pointee.Visit(this, quals); |
||||||
|
|
||||||
return pointee.Visit(this, quals) + "*"; |
return pointee.Visit(this, quals) + "*"; |
||||||
} |
} |
||||||
|
|
||||||
Enumeration @enum; |
Enumeration @enum; |
||||||
if (pointee.TryGetEnum(out @enum)) |
if (pointee.TryGetEnum(out @enum)) |
||||||
{ |
{ |
||||||
var typeName = @enum.Visit(this); |
var typeName = @enum.Visit(this); |
||||||
return string.Format("{0}*", typeName); |
return string.Format("{0}*", typeName); |
||||||
} |
} |
||||||
|
|
||||||
return pointer.Pointee.Visit(this, quals); |
return pointer.Pointee.Visit(this, quals); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitMemberPointerType(MemberPointerType member, |
public string VisitMemberPointerType(MemberPointerType member, |
||||||
TypeQualifiers quals) |
TypeQualifiers quals) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitBuiltinType(BuiltinType builtin, TypeQualifiers quals) |
public string VisitBuiltinType(BuiltinType builtin, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return VisitPrimitiveType(builtin.Type); |
return VisitPrimitiveType(builtin.Type); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPrimitiveType(PrimitiveType primitive) |
public string VisitPrimitiveType(PrimitiveType primitive) |
||||||
{ |
{ |
||||||
switch (primitive) |
switch (primitive) |
||||||
{ |
{ |
||||||
case PrimitiveType.Bool: return "bool"; |
case PrimitiveType.Bool: return "bool"; |
||||||
case PrimitiveType.Void: return "void"; |
case PrimitiveType.Void: return "void"; |
||||||
case PrimitiveType.Char16: |
case PrimitiveType.Char16: |
||||||
case PrimitiveType.WideChar: return "System::Char"; |
case PrimitiveType.WideChar: return "System::Char"; |
||||||
case PrimitiveType.Int8: return Options.MarshalCharAsManagedChar ? "System::Char" : "char"; |
case PrimitiveType.Int8: return Options.MarshalCharAsManagedChar ? "System::Char" : "char"; |
||||||
case PrimitiveType.UInt8: return "unsigned char"; |
case PrimitiveType.UInt8: return "unsigned char"; |
||||||
case PrimitiveType.Int16: return "short"; |
case PrimitiveType.Int16: return "short"; |
||||||
case PrimitiveType.UInt16: return "unsigned short"; |
case PrimitiveType.UInt16: return "unsigned short"; |
||||||
case PrimitiveType.Int32: return "int"; |
case PrimitiveType.Int32: return "int"; |
||||||
case PrimitiveType.UInt32: return "unsigned int"; |
case PrimitiveType.UInt32: return "unsigned int"; |
||||||
case PrimitiveType.Int64: return "long long"; |
case PrimitiveType.Int64: return "long long"; |
||||||
case PrimitiveType.UInt64: return "unsigned long long"; |
case PrimitiveType.UInt64: return "unsigned long long"; |
||||||
case PrimitiveType.Float: return "float"; |
case PrimitiveType.Float: return "float"; |
||||||
case PrimitiveType.Double: return "double"; |
case PrimitiveType.Double: return "double"; |
||||||
case PrimitiveType.IntPtr: return "IntPtr"; |
case PrimitiveType.IntPtr: return "IntPtr"; |
||||||
case PrimitiveType.UIntPtr: return "UIntPtr"; |
case PrimitiveType.UIntPtr: return "UIntPtr"; |
||||||
case PrimitiveType.Null: return "void*"; |
case PrimitiveType.Null: return "void*"; |
||||||
} |
} |
||||||
|
|
||||||
throw new NotSupportedException(); |
throw new NotSupportedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTypedefType(TypedefType typedef, TypeQualifiers quals) |
public string VisitTypedefType(TypedefType typedef, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var decl = typedef.Declaration; |
var decl = typedef.Declaration; |
||||||
|
|
||||||
TypeMap typeMap = null; |
TypeMap typeMap = null; |
||||||
if (TypeMapDatabase.FindTypeMap(decl, out typeMap)) |
if (TypeMapDatabase.FindTypeMap(decl, out typeMap)) |
||||||
{ |
{ |
||||||
typeMap.Type = typedef; |
typeMap.Type = typedef; |
||||||
Context.Type = typedef; |
Context.Type = typedef; |
||||||
return typeMap.CLISignature(Context); |
return typeMap.CLISignature(Context); |
||||||
} |
} |
||||||
|
|
||||||
FunctionType func; |
FunctionType func; |
||||||
if (decl.Type.IsPointerTo<FunctionType>(out func)) |
if (decl.Type.IsPointerTo<FunctionType>(out func)) |
||||||
{ |
{ |
||||||
// TODO: Use SafeIdentifier()
|
// TODO: Use SafeIdentifier()
|
||||||
return string.Format("{0}^", VisitDeclaration(decl)); |
return string.Format("{0}^", VisitDeclaration(decl)); |
||||||
} |
} |
||||||
|
|
||||||
return decl.Type.Visit(this); |
return decl.Type.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitAttributedType(AttributedType attributed, TypeQualifiers quals) |
public string VisitAttributedType(AttributedType attributed, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return attributed.Modified.Visit(this); |
return attributed.Modified.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDecayedType(DecayedType decayed, TypeQualifiers quals) |
public string VisitDecayedType(DecayedType decayed, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return decayed.Decayed.Visit(this); |
return decayed.Decayed.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTemplateSpecializationType(TemplateSpecializationType template, |
public string VisitTemplateSpecializationType(TemplateSpecializationType template, |
||||||
TypeQualifiers quals) |
TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var decl = template.Template.TemplatedDecl; |
var decl = template.Template.TemplatedDecl; |
||||||
|
|
||||||
TypeMap typeMap = null; |
TypeMap typeMap = null; |
||||||
if (TypeMapDatabase.FindTypeMap(template, out typeMap)) |
if (TypeMapDatabase.FindTypeMap(template, out typeMap)) |
||||||
{ |
{ |
||||||
typeMap.Declaration = decl; |
typeMap.Declaration = decl; |
||||||
typeMap.Type = template; |
typeMap.Type = template; |
||||||
Context.Type = template; |
Context.Type = template; |
||||||
return typeMap.CLISignature(Context); |
return typeMap.CLISignature(Context); |
||||||
} |
} |
||||||
|
|
||||||
return decl.Name; |
return decl.Name; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTemplateParameterType(TemplateParameterType param, |
public string VisitTemplateParameterType(TemplateParameterType param, |
||||||
TypeQualifiers quals) |
TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return param.Parameter.Name; |
return param.Parameter.Name; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTemplateParameterSubstitutionType( |
public string VisitTemplateParameterSubstitutionType( |
||||||
TemplateParameterSubstitutionType param, TypeQualifiers quals) |
TemplateParameterSubstitutionType param, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals) |
public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals) |
public string VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals) |
public string VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return string.Empty; |
return string.Empty; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitCILType(CILType type, TypeQualifiers quals) |
public string VisitCILType(CILType type, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var result = type.Type.FullName.Replace(".", "::"); |
var result = type.Type.FullName.Replace(".", "::"); |
||||||
if (!type.Type.IsValueType) |
if (!type.Type.IsValueType) |
||||||
result += "^"; |
result += "^"; |
||||||
return result; |
return result; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) |
public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return VisitPrimitiveType(type); |
return VisitPrimitiveType(type); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDeclaration(Declaration decl, TypeQualifiers quals) |
public string VisitDeclaration(Declaration decl, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return VisitDeclaration(decl); |
return VisitDeclaration(decl); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDeclaration(Declaration decl) |
public string VisitDeclaration(Declaration decl) |
||||||
{ |
{ |
||||||
var names = new List<string>(); |
var names = new List<string>(); |
||||||
|
|
||||||
if (Options.GenerateLibraryNamespace) |
if (Options.GenerateLibraryNamespace) |
||||||
names.Add(Driver.Options.OutputNamespace); |
names.Add(Driver.Options.OutputNamespace); |
||||||
|
|
||||||
if (!string.IsNullOrEmpty(decl.Namespace.QualifiedName)) |
if (!string.IsNullOrEmpty(decl.Namespace.QualifiedName)) |
||||||
names.Add(decl.Namespace.QualifiedName); |
names.Add(decl.Namespace.QualifiedName); |
||||||
|
|
||||||
names.Add(decl.Visit(this)); |
names.Add(decl.Visit(this)); |
||||||
|
|
||||||
return string.Join("::", names); |
return string.Join("::", names); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitClassDecl(Class @class) |
public string VisitClassDecl(Class @class) |
||||||
{ |
{ |
||||||
if (@class.CompleteDeclaration != null) |
if (@class.CompleteDeclaration != null) |
||||||
return VisitClassDecl(@class.CompleteDeclaration as Class); |
return VisitClassDecl(@class.CompleteDeclaration as Class); |
||||||
|
|
||||||
return string.Format("{0}{1}", @class.Name, @class.IsRefType ? "^" |
return string.Format("{0}{1}", @class.Name, @class.IsRefType ? "^" |
||||||
: string.Empty); |
: string.Empty); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFieldDecl(Field field) |
public string VisitFieldDecl(Field field) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFunctionDecl(Function function) |
public string VisitFunctionDecl(Function function) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitMethodDecl(Method method) |
public string VisitMethodDecl(Method method) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitParameterDecl(Parameter parameter) |
public string VisitParameterDecl(Parameter parameter) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTypedefDecl(TypedefDecl typedef) |
public string VisitTypedefDecl(TypedefDecl typedef) |
||||||
{ |
{ |
||||||
return typedef.Name; |
return typedef.Name; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitEnumDecl(Enumeration @enum) |
public string VisitEnumDecl(Enumeration @enum) |
||||||
{ |
{ |
||||||
return @enum.Name; |
return @enum.Name; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitVariableDecl(Variable variable) |
public string VisitVariableDecl(Variable variable) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitClassTemplateDecl(ClassTemplate template) |
public string VisitClassTemplateDecl(ClassTemplate template) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFunctionTemplateDecl(FunctionTemplate template) |
public string VisitFunctionTemplateDecl(FunctionTemplate template) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitMacroDefinition(MacroDefinition macro) |
public string VisitMacroDefinition(MacroDefinition macro) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitNamespace(Namespace @namespace) |
public string VisitNamespace(Namespace @namespace) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitEvent(Event @event) |
public string VisitEvent(Event @event) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitProperty(Property property) |
public string VisitProperty(Property property) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string ToString(Type type) |
public string ToString(Type type) |
||||||
{ |
{ |
||||||
return type.Visit(this); |
return type.Visit(this); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,27 @@ |
|||||||
using CppSharp.AST; |
using CppSharp.AST; |
||||||
using Interop = System.Runtime.InteropServices; |
using Interop = System.Runtime.InteropServices; |
||||||
|
|
||||||
namespace CppSharp.Generators |
namespace CppSharp.Generators |
||||||
{ |
{ |
||||||
public static class ExtensionMethods |
public static class ExtensionMethods |
||||||
{ |
{ |
||||||
public static Interop.CallingConvention ToInteropCallConv(this CallingConvention convention) |
public static Interop.CallingConvention ToInteropCallConv(this CallingConvention convention) |
||||||
{ |
{ |
||||||
switch (convention) |
switch (convention) |
||||||
{ |
{ |
||||||
case CallingConvention.Default: |
case CallingConvention.Default: |
||||||
return Interop.CallingConvention.Winapi; |
return Interop.CallingConvention.Winapi; |
||||||
case CallingConvention.C: |
case CallingConvention.C: |
||||||
return Interop.CallingConvention.Cdecl; |
return Interop.CallingConvention.Cdecl; |
||||||
case CallingConvention.StdCall: |
case CallingConvention.StdCall: |
||||||
return Interop.CallingConvention.StdCall; |
return Interop.CallingConvention.StdCall; |
||||||
case CallingConvention.ThisCall: |
case CallingConvention.ThisCall: |
||||||
return Interop.CallingConvention.ThisCall; |
return Interop.CallingConvention.ThisCall; |
||||||
case CallingConvention.FastCall: |
case CallingConvention.FastCall: |
||||||
return Interop.CallingConvention.FastCall; |
return Interop.CallingConvention.FastCall; |
||||||
} |
} |
||||||
|
|
||||||
return Interop.CallingConvention.Winapi; |
return Interop.CallingConvention.Winapi; |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
@ -1,58 +1,58 @@ |
|||||||
using System.Linq; |
using System.Linq; |
||||||
using CppSharp.AST; |
using CppSharp.AST; |
||||||
using CppSharp.AST.Extensions; |
using CppSharp.AST.Extensions; |
||||||
using CppSharp.Generators; |
using CppSharp.Generators; |
||||||
|
|
||||||
namespace CppSharp.Passes |
namespace CppSharp.Passes |
||||||
{ |
{ |
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This pass will create conversion operators out of single argument
|
/// This pass will create conversion operators out of single argument
|
||||||
/// constructors.
|
/// constructors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ConstructorToConversionOperatorPass : TranslationUnitPass |
public class ConstructorToConversionOperatorPass : TranslationUnitPass |
||||||
{ |
{ |
||||||
public override bool VisitMethodDecl(Method method) |
public override bool VisitMethodDecl(Method method) |
||||||
{ |
{ |
||||||
if (!method.IsConstructor) |
if (!method.IsConstructor) |
||||||
return false; |
return false; |
||||||
if (method.IsCopyConstructor) |
if (method.IsCopyConstructor) |
||||||
return false; |
return false; |
||||||
if (method.Parameters.Count != 1) |
if (method.Parameters.Count != 1) |
||||||
return false; |
return false; |
||||||
var parameter = method.Parameters[0]; |
var parameter = method.Parameters[0]; |
||||||
var parameterType = parameter.Type as PointerType; |
var parameterType = parameter.Type as PointerType; |
||||||
if (parameterType == null) |
if (parameterType == null) |
||||||
return false; |
return false; |
||||||
if (!parameterType.IsReference) |
if (!parameterType.IsReference) |
||||||
return false; |
return false; |
||||||
var qualifiedPointee = parameterType.QualifiedPointee; |
var qualifiedPointee = parameterType.QualifiedPointee; |
||||||
Class castFromClass; |
Class castFromClass; |
||||||
if (!qualifiedPointee.Type.TryGetClass(out castFromClass)) |
if (!qualifiedPointee.Type.TryGetClass(out castFromClass)) |
||||||
return false; |
return false; |
||||||
var castToClass = method.OriginalNamespace as Class; |
var castToClass = method.OriginalNamespace as Class; |
||||||
if (castToClass == null) |
if (castToClass == null) |
||||||
return false; |
return false; |
||||||
if (castFromClass == castToClass) |
if (castFromClass == castToClass) |
||||||
return false; |
return false; |
||||||
|
|
||||||
var operatorKind = method.IsExplicit |
var operatorKind = method.IsExplicit |
||||||
? CXXOperatorKind.ExplicitConversion |
? CXXOperatorKind.ExplicitConversion |
||||||
: CXXOperatorKind.Conversion; |
: CXXOperatorKind.Conversion; |
||||||
var castToType = new TagType(castToClass); |
var castToType = new TagType(castToClass); |
||||||
var qualifiedCastToType = new QualifiedType(castToType); |
var qualifiedCastToType = new QualifiedType(castToType); |
||||||
var conversionOperator = new Method() |
var conversionOperator = new Method() |
||||||
{ |
{ |
||||||
Name = Operators.GetOperatorIdentifier(operatorKind), |
Name = Operators.GetOperatorIdentifier(operatorKind), |
||||||
Namespace = castFromClass, |
Namespace = castFromClass, |
||||||
Kind = CXXMethodKind.Conversion, |
Kind = CXXMethodKind.Conversion, |
||||||
IsSynthetized = true, |
IsSynthetized = true, |
||||||
ConversionType = qualifiedCastToType, |
ConversionType = qualifiedCastToType, |
||||||
ReturnType = qualifiedCastToType |
ReturnType = qualifiedCastToType |
||||||
}; |
}; |
||||||
conversionOperator.OperatorKind = operatorKind; |
conversionOperator.OperatorKind = operatorKind; |
||||||
|
|
||||||
castFromClass.Methods.Add(conversionOperator); |
castFromClass.Methods.Add(conversionOperator); |
||||||
return true; |
return true; |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
@ -1,330 +1,330 @@ |
|||||||
using System; |
using System; |
||||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||||
using System.Linq; |
using System.Linq; |
||||||
using CppSharp.AST; |
using CppSharp.AST; |
||||||
using Type = CppSharp.AST.Type; |
using Type = CppSharp.AST.Type; |
||||||
|
|
||||||
namespace CppSharp.Types |
namespace CppSharp.Types |
||||||
{ |
{ |
||||||
public enum CppTypePrintScopeKind |
public enum CppTypePrintScopeKind |
||||||
{ |
{ |
||||||
Local, |
Local, |
||||||
Qualified, |
Qualified, |
||||||
GlobalQualified |
GlobalQualified |
||||||
} |
} |
||||||
|
|
||||||
public class CppTypePrinter : ITypePrinter<string>, IDeclVisitor<string> |
public class CppTypePrinter : ITypePrinter<string>, IDeclVisitor<string> |
||||||
{ |
{ |
||||||
public CppTypePrintScopeKind PrintScopeKind; |
public CppTypePrintScopeKind PrintScopeKind; |
||||||
public bool PrintLogicalNames; |
public bool PrintLogicalNames; |
||||||
public bool PrintTypeQualifiers; |
public bool PrintTypeQualifiers; |
||||||
|
|
||||||
public CppTypePrinter(ITypeMapDatabase database, bool printTypeQualifiers = true) |
public CppTypePrinter(ITypeMapDatabase database, bool printTypeQualifiers = true) |
||||||
{ |
{ |
||||||
PrintScopeKind = CppTypePrintScopeKind.GlobalQualified; |
PrintScopeKind = CppTypePrintScopeKind.GlobalQualified; |
||||||
PrintTypeQualifiers = printTypeQualifiers; |
PrintTypeQualifiers = printTypeQualifiers; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTagType(TagType tag, TypeQualifiers quals) |
public string VisitTagType(TagType tag, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return tag.Declaration.Visit(this); |
return tag.Declaration.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitArrayType(ArrayType array, TypeQualifiers quals) |
public string VisitArrayType(ArrayType array, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var typeName = array.Type.Visit(this); |
var typeName = array.Type.Visit(this); |
||||||
|
|
||||||
switch (array.SizeType) |
switch (array.SizeType) |
||||||
{ |
{ |
||||||
case ArrayType.ArraySize.Constant: |
case ArrayType.ArraySize.Constant: |
||||||
return string.Format("{0}[{1}]", typeName, array.Size); |
return string.Format("{0}[{1}]", typeName, array.Size); |
||||||
case ArrayType.ArraySize.Variable: |
case ArrayType.ArraySize.Variable: |
||||||
case ArrayType.ArraySize.Dependent: |
case ArrayType.ArraySize.Dependent: |
||||||
case ArrayType.ArraySize.Incomplete: |
case ArrayType.ArraySize.Incomplete: |
||||||
return string.Format("{0}[]", typeName); |
return string.Format("{0}[]", typeName); |
||||||
} |
} |
||||||
|
|
||||||
throw new NotSupportedException(); |
throw new NotSupportedException(); |
||||||
} |
} |
||||||
|
|
||||||
static string ConvertModifierToString(PointerType.TypeModifier modifier) |
static string ConvertModifierToString(PointerType.TypeModifier modifier) |
||||||
{ |
{ |
||||||
switch (modifier) |
switch (modifier) |
||||||
{ |
{ |
||||||
case PointerType.TypeModifier.Value: return string.Empty; |
case PointerType.TypeModifier.Value: return string.Empty; |
||||||
case PointerType.TypeModifier.Pointer: return "*"; |
case PointerType.TypeModifier.Pointer: return "*"; |
||||||
case PointerType.TypeModifier.LVReference: return "&"; |
case PointerType.TypeModifier.LVReference: return "&"; |
||||||
case PointerType.TypeModifier.RVReference: return "&&"; |
case PointerType.TypeModifier.RVReference: return "&&"; |
||||||
} |
} |
||||||
|
|
||||||
return string.Empty; |
return string.Empty; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPointerType(PointerType pointer, TypeQualifiers quals) |
public string VisitPointerType(PointerType pointer, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var pointee = pointer.Pointee; |
var pointee = pointer.Pointee; |
||||||
|
|
||||||
var function = pointee as FunctionType; |
var function = pointee as FunctionType; |
||||||
if (function != null) |
if (function != null) |
||||||
{ |
{ |
||||||
var arguments = function.Parameters; |
var arguments = function.Parameters; |
||||||
var returnType = function.ReturnType; |
var returnType = function.ReturnType; |
||||||
var args = string.Empty; |
var args = string.Empty; |
||||||
|
|
||||||
if (arguments.Count > 0) |
if (arguments.Count > 0) |
||||||
args = VisitParameters(function.Parameters, hasNames: false); |
args = VisitParameters(function.Parameters, hasNames: false); |
||||||
|
|
||||||
return string.Format("{0} (*)({1})", returnType.Visit(this), args); |
return string.Format("{0} (*)({1})", returnType.Visit(this), args); |
||||||
} |
} |
||||||
|
|
||||||
var pointeeType = pointer.Pointee.Visit(this, quals); |
var pointeeType = pointer.Pointee.Visit(this, quals); |
||||||
var mod = ConvertModifierToString(pointer.Modifier); |
var mod = ConvertModifierToString(pointer.Modifier); |
||||||
|
|
||||||
var s = PrintTypeQualifiers && quals.IsConst ? "const " : string.Empty; |
var s = PrintTypeQualifiers && quals.IsConst ? "const " : string.Empty; |
||||||
s += string.Format("{0}{1}", pointeeType, mod); |
s += string.Format("{0}{1}", pointeeType, mod); |
||||||
|
|
||||||
return s; |
return s; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitMemberPointerType(MemberPointerType member, TypeQualifiers quals) |
public string VisitMemberPointerType(MemberPointerType member, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return string.Empty; |
return string.Empty; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitBuiltinType(BuiltinType builtin, TypeQualifiers quals) |
public string VisitBuiltinType(BuiltinType builtin, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return VisitPrimitiveType(builtin.Type); |
return VisitPrimitiveType(builtin.Type); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPrimitiveType(PrimitiveType primitive) |
public string VisitPrimitiveType(PrimitiveType primitive) |
||||||
{ |
{ |
||||||
switch (primitive) |
switch (primitive) |
||||||
{ |
{ |
||||||
case PrimitiveType.Bool: return "bool"; |
case PrimitiveType.Bool: return "bool"; |
||||||
case PrimitiveType.Void: return "void"; |
case PrimitiveType.Void: return "void"; |
||||||
case PrimitiveType.Char16: |
case PrimitiveType.Char16: |
||||||
case PrimitiveType.WideChar: return "char"; |
case PrimitiveType.WideChar: return "char"; |
||||||
case PrimitiveType.Int8: return "char"; |
case PrimitiveType.Int8: return "char"; |
||||||
case PrimitiveType.UInt8: return "unsigned char"; |
case PrimitiveType.UInt8: return "unsigned char"; |
||||||
case PrimitiveType.Int16: return "short"; |
case PrimitiveType.Int16: return "short"; |
||||||
case PrimitiveType.UInt16: return "unsigned short"; |
case PrimitiveType.UInt16: return "unsigned short"; |
||||||
case PrimitiveType.Int32: return "int"; |
case PrimitiveType.Int32: return "int"; |
||||||
case PrimitiveType.UInt32: return "unsigned int"; |
case PrimitiveType.UInt32: return "unsigned int"; |
||||||
case PrimitiveType.Int64: return "long long"; |
case PrimitiveType.Int64: return "long long"; |
||||||
case PrimitiveType.UInt64: return "unsigned long long"; |
case PrimitiveType.UInt64: return "unsigned long long"; |
||||||
case PrimitiveType.Float: return "float"; |
case PrimitiveType.Float: return "float"; |
||||||
case PrimitiveType.Double: return "double"; |
case PrimitiveType.Double: return "double"; |
||||||
case PrimitiveType.IntPtr: return "void*"; |
case PrimitiveType.IntPtr: return "void*"; |
||||||
case PrimitiveType.UIntPtr: return "uintptr_t"; |
case PrimitiveType.UIntPtr: return "uintptr_t"; |
||||||
case PrimitiveType.Null: return "std::nullptr_t"; |
case PrimitiveType.Null: return "std::nullptr_t"; |
||||||
} |
} |
||||||
|
|
||||||
throw new NotSupportedException(); |
throw new NotSupportedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTypedefType(TypedefType typedef, TypeQualifiers quals) |
public string VisitTypedefType(TypedefType typedef, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return GetDeclName(typedef.Declaration); |
return GetDeclName(typedef.Declaration); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitAttributedType(AttributedType attributed, TypeQualifiers quals) |
public string VisitAttributedType(AttributedType attributed, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return attributed.Modified.Visit(this); |
return attributed.Modified.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDecayedType(DecayedType decayed, TypeQualifiers quals) |
public string VisitDecayedType(DecayedType decayed, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return decayed.Decayed.Visit(this); |
return decayed.Decayed.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTemplateSpecializationType(TemplateSpecializationType template, TypeQualifiers quals) |
public string VisitTemplateSpecializationType(TemplateSpecializationType template, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return string.Format("{0}<{1}>", template.Template.TemplatedDecl.Visit(this), |
return string.Format("{0}<{1}>", template.Template.TemplatedDecl.Visit(this), |
||||||
string.Join(", ", |
string.Join(", ", |
||||||
template.Arguments.Where( |
template.Arguments.Where( |
||||||
a => a.Type.Type != null && |
a => a.Type.Type != null && |
||||||
!(a.Type.Type is DependentNameType)).Select(a => a.Type.Visit(this)))); |
!(a.Type.Type is DependentNameType)).Select(a => a.Type.Visit(this)))); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTemplateParameterType(TemplateParameterType param, TypeQualifiers quals) |
public string VisitTemplateParameterType(TemplateParameterType param, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
if (param.Parameter.Name == null) |
if (param.Parameter.Name == null) |
||||||
return string.Empty; |
return string.Empty; |
||||||
|
|
||||||
return param.Parameter.Name; |
return param.Parameter.Name; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTemplateParameterSubstitutionType( |
public string VisitTemplateParameterSubstitutionType( |
||||||
TemplateParameterSubstitutionType param, TypeQualifiers quals) |
TemplateParameterSubstitutionType param, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return param.Replacement.Visit(this); |
return param.Replacement.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals) |
public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return injected.Class.Visit(this); |
return injected.Class.Visit(this); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals) |
public string VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
throw new System.NotImplementedException(); |
throw new System.NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals) |
public string VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return string.Empty; |
return string.Empty; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitCILType(CILType type, TypeQualifiers quals) |
public string VisitCILType(CILType type, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
return string.Empty; |
return string.Empty; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) |
public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
throw new System.NotImplementedException(); |
throw new System.NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDeclaration(Declaration decl, TypeQualifiers quals) |
public string VisitDeclaration(Declaration decl, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
throw new System.NotImplementedException(); |
throw new System.NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFunctionType(FunctionType function, TypeQualifiers quals) |
public string VisitFunctionType(FunctionType function, TypeQualifiers quals) |
||||||
{ |
{ |
||||||
var arguments = function.Parameters; |
var arguments = function.Parameters; |
||||||
var returnType = function.ReturnType; |
var returnType = function.ReturnType; |
||||||
var args = string.Empty; |
var args = string.Empty; |
||||||
|
|
||||||
if (arguments.Count > 0) |
if (arguments.Count > 0) |
||||||
args = VisitParameters(function.Parameters, hasNames: false); |
args = VisitParameters(function.Parameters, hasNames: false); |
||||||
|
|
||||||
return string.Format("{0} ({1})", returnType.Visit(this), args); |
return string.Format("{0} ({1})", returnType.Visit(this), args); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitParameters(IEnumerable<Parameter> @params, |
public string VisitParameters(IEnumerable<Parameter> @params, |
||||||
bool hasNames) |
bool hasNames) |
||||||
{ |
{ |
||||||
var args = new List<string>(); |
var args = new List<string>(); |
||||||
|
|
||||||
foreach (var param in @params) |
foreach (var param in @params) |
||||||
args.Add(VisitParameter(param, hasNames)); |
args.Add(VisitParameter(param, hasNames)); |
||||||
|
|
||||||
return string.Join(", ", args); |
return string.Join(", ", args); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitParameter(Parameter arg, bool hasName = true) |
public string VisitParameter(Parameter arg, bool hasName = true) |
||||||
{ |
{ |
||||||
var type = arg.Type.Visit(this, arg.QualifiedType.Qualifiers); |
var type = arg.Type.Visit(this, arg.QualifiedType.Qualifiers); |
||||||
var name = arg.Name; |
var name = arg.Name; |
||||||
|
|
||||||
if (hasName && !string.IsNullOrEmpty(name)) |
if (hasName && !string.IsNullOrEmpty(name)) |
||||||
return string.Format("{0} {1}", type, name); |
return string.Format("{0} {1}", type, name); |
||||||
|
|
||||||
return type; |
return type; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDelegate(FunctionType function) |
public string VisitDelegate(FunctionType function) |
||||||
{ |
{ |
||||||
throw new System.NotImplementedException(); |
throw new System.NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string GetDeclName(Declaration declaration) |
public string GetDeclName(Declaration declaration) |
||||||
{ |
{ |
||||||
switch (PrintScopeKind) |
switch (PrintScopeKind) |
||||||
{ |
{ |
||||||
case CppTypePrintScopeKind.Local: |
case CppTypePrintScopeKind.Local: |
||||||
return PrintLogicalNames ? declaration.LogicalOriginalName |
return PrintLogicalNames ? declaration.LogicalOriginalName |
||||||
: declaration.OriginalName; |
: declaration.OriginalName; |
||||||
case CppTypePrintScopeKind.Qualified: |
case CppTypePrintScopeKind.Qualified: |
||||||
return PrintLogicalNames ? declaration.QualifiedLogicalOriginalName |
return PrintLogicalNames ? declaration.QualifiedLogicalOriginalName |
||||||
: declaration.QualifiedOriginalName; |
: declaration.QualifiedOriginalName; |
||||||
case CppTypePrintScopeKind.GlobalQualified: |
case CppTypePrintScopeKind.GlobalQualified: |
||||||
return "::" + (PrintLogicalNames ? declaration.QualifiedLogicalOriginalName |
return "::" + (PrintLogicalNames ? declaration.QualifiedLogicalOriginalName |
||||||
: declaration.QualifiedOriginalName); |
: declaration.QualifiedOriginalName); |
||||||
} |
} |
||||||
|
|
||||||
throw new NotSupportedException(); |
throw new NotSupportedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitDeclaration(Declaration decl) |
public string VisitDeclaration(Declaration decl) |
||||||
{ |
{ |
||||||
return GetDeclName(decl); |
return GetDeclName(decl); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitClassDecl(Class @class) |
public string VisitClassDecl(Class @class) |
||||||
{ |
{ |
||||||
return VisitDeclaration(@class); |
return VisitDeclaration(@class); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFieldDecl(Field field) |
public string VisitFieldDecl(Field field) |
||||||
{ |
{ |
||||||
return VisitDeclaration(field); |
return VisitDeclaration(field); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFunctionDecl(Function function) |
public string VisitFunctionDecl(Function function) |
||||||
{ |
{ |
||||||
return VisitDeclaration(function); |
return VisitDeclaration(function); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitMethodDecl(Method method) |
public string VisitMethodDecl(Method method) |
||||||
{ |
{ |
||||||
return VisitDeclaration(method); |
return VisitDeclaration(method); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitParameterDecl(Parameter parameter) |
public string VisitParameterDecl(Parameter parameter) |
||||||
{ |
{ |
||||||
return VisitParameter(parameter, hasName: false); |
return VisitParameter(parameter, hasName: false); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitTypedefDecl(TypedefDecl typedef) |
public string VisitTypedefDecl(TypedefDecl typedef) |
||||||
{ |
{ |
||||||
return VisitDeclaration(typedef); |
return VisitDeclaration(typedef); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitEnumDecl(Enumeration @enum) |
public string VisitEnumDecl(Enumeration @enum) |
||||||
{ |
{ |
||||||
return VisitDeclaration(@enum); |
return VisitDeclaration(@enum); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitVariableDecl(Variable variable) |
public string VisitVariableDecl(Variable variable) |
||||||
{ |
{ |
||||||
return VisitDeclaration(variable); |
return VisitDeclaration(variable); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitClassTemplateDecl(ClassTemplate template) |
public string VisitClassTemplateDecl(ClassTemplate template) |
||||||
{ |
{ |
||||||
return VisitDeclaration(template); |
return VisitDeclaration(template); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitFunctionTemplateDecl(FunctionTemplate template) |
public string VisitFunctionTemplateDecl(FunctionTemplate template) |
||||||
{ |
{ |
||||||
return VisitDeclaration(template); |
return VisitDeclaration(template); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitMacroDefinition(MacroDefinition macro) |
public string VisitMacroDefinition(MacroDefinition macro) |
||||||
{ |
{ |
||||||
throw new NotImplementedException(); |
throw new NotImplementedException(); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitNamespace(Namespace @namespace) |
public string VisitNamespace(Namespace @namespace) |
||||||
{ |
{ |
||||||
return VisitDeclaration(@namespace); |
return VisitDeclaration(@namespace); |
||||||
} |
} |
||||||
|
|
||||||
public string VisitEvent(Event @event) |
public string VisitEvent(Event @event) |
||||||
{ |
{ |
||||||
return string.Empty; |
return string.Empty; |
||||||
} |
} |
||||||
|
|
||||||
public string VisitProperty(Property property) |
public string VisitProperty(Property property) |
||||||
{ |
{ |
||||||
return VisitDeclaration(property); |
return VisitDeclaration(property); |
||||||
} |
} |
||||||
|
|
||||||
public string ToString(Type type) |
public string ToString(Type type) |
||||||
{ |
{ |
||||||
return type.Visit(this); |
return type.Visit(this); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
Loading…
Reference in new issue