feat update
This commit is contained in:
parent
838e33df0b
commit
e17ae812be
@ -9,13 +9,15 @@ CLASS(Test)
|
||||
{
|
||||
public:
|
||||
META("Constructor")
|
||||
Test() : a_(0) {}
|
||||
Test() : b_(0), a_(0) {}
|
||||
|
||||
Test(int a) : a_(a) {}
|
||||
Test(int a) : b_(0), a_(a) {}
|
||||
|
||||
META("Test")
|
||||
int GetA() const { return a_; }
|
||||
|
||||
int kk(int, void *);
|
||||
|
||||
private:
|
||||
struct Void {};
|
||||
|
||||
@ -25,6 +27,7 @@ private:
|
||||
int a;
|
||||
};
|
||||
|
||||
const int b_;
|
||||
int a_;
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,18 @@ public:
|
||||
|
||||
virtual bool ShouldGenerate() const { return !properties_.empty(); }
|
||||
|
||||
bool IsPublic() const { return clang_getCXXAccessSpecifier(cursor_.handle()) == CX_CXXPublic; }
|
||||
|
||||
bool IsPrivate() const
|
||||
{
|
||||
return clang_getCXXAccessSpecifier(cursor_.handle()) == CX_CXXPrivate;
|
||||
}
|
||||
|
||||
bool IsProtected() const
|
||||
{
|
||||
return clang_getCXXAccessSpecifier(cursor_.handle()) == CX_CXXProtected;
|
||||
}
|
||||
|
||||
bool HasProperty(const std::string &property) const
|
||||
{
|
||||
return std::find(properties_.begin(), properties_.end(), property) != properties_.end();
|
||||
|
@ -11,11 +11,8 @@ Method::Method(const Cursor &cursor,
|
||||
parent_(parent),
|
||||
return_type_(clang_getResultType(cursor.GetType().handle()))
|
||||
{
|
||||
unsigned args_num = clang_Cursor_getNumArguments(cursor.handle());
|
||||
|
||||
for (unsigned i = 0; i < args_num; ++i) {
|
||||
Cursor arg = clang_Cursor_getArgument(cursor.handle(), i);
|
||||
arguments_.push_back(arg.GetType());
|
||||
for (unsigned i = 0; i < cursor.GetType().GetArgumentCount(); ++i) {
|
||||
arguments_.push_back(cursor.GetType().GetArgument(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +26,16 @@ Method::ToString() const
|
||||
ss << arguments_[i].GetDisplayName();
|
||||
if (i < arguments_.size() - 1) { ss << ", "; }
|
||||
}
|
||||
// get function const
|
||||
ss << ")";
|
||||
return ss.str() + " /*" + sled::StrJoin(properties(), ",") + "*/";
|
||||
if (IsConst()) { ss << " const"; }
|
||||
return ss.str() + " /*" + sled::StrJoin(properties(), ",") + "*/;";
|
||||
}
|
||||
|
||||
bool
|
||||
Method::IsConst() const
|
||||
{
|
||||
return clang_CXXMethod_isConst(cursor_.handle());
|
||||
};
|
||||
|
||||
}// namespace meta
|
||||
|
@ -12,6 +12,7 @@ public:
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
bool IsConst() const;
|
||||
CursorType return_type() const;
|
||||
CursorType argument(unsigned index) const;
|
||||
std::vector<CursorType> arguments() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user