mirror of https://github.com/mono/CppSharp.git
5 changed files with 132 additions and 51 deletions
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
/************************************************************************
|
||||
* |
||||
* CppSharp |
||||
* Licensed under the simplified BSD license. All rights reserved. |
||||
* |
||||
************************************************************************/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <cstdint> |
||||
#include <vector> |
||||
#include <map> |
||||
#include <string> |
||||
|
||||
#define CS_FLAGS |
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__) |
||||
#define CS_API __declspec(dllexport) |
||||
#else |
||||
#define CS_API |
||||
#endif |
||||
|
||||
/** We use these macros to workaround the lack of good standard C++
|
||||
* containers/string support in the C# binding backend. */ |
||||
|
||||
#define VECTOR(type, name) \ |
||||
std::vector<type> name; \ |
||||
type get##name (unsigned i); \ |
||||
void add##name (type& s); \ |
||||
unsigned get##name##Count (); |
||||
|
||||
#define DEF_VECTOR(klass, type, name) \ |
||||
type klass::get##name (unsigned i) { return name[i]; } \ |
||||
void klass::add##name (type& s) { return name.push_back(s); } \ |
||||
unsigned klass::get##name##Count () { return name.size(); } |
||||
|
||||
#define VECTOR_STRING(name) \ |
||||
std::vector<std::string> name; \ |
||||
const char* get##name (unsigned i); \ |
||||
void add##name (const char* s); \ |
||||
unsigned get##name##Count (); |
||||
|
||||
#define DEF_VECTOR_STRING(klass, name) \ |
||||
const char* klass::get##name (unsigned i) { return name[i].c_str(); } \ |
||||
void klass::add##name (const char* s) { return name.push_back(std::string(s)); } \ |
||||
unsigned klass::get##name##Count () { return name.size(); } |
||||
|
||||
#define STRING(name) \ |
||||
std::string name; \ |
||||
const char* get##name(); \ |
||||
void set##name(const char* s); |
||||
|
||||
#define DEF_STRING(klass, name) \ |
||||
const char* klass::get##name() { return name.c_str(); } \ |
||||
void klass::set##name(const char* s) { name = s; } |
Loading…
Reference in new issue