Skip to content

Commit f06b1ab

Browse files
committed
Expose BaseClass, allows to store and pass reference to extend.
1 parent 687714e commit f06b1ab

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

include/class.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Php {
2424
* Class definition of the class
2525
*/
2626
template <typename T>
27-
class PHPCPP_EXPORT Class : private ClassBase
27+
class PHPCPP_EXPORT Class : public ClassBase
2828
{
2929
public:
3030
/**
@@ -302,6 +302,8 @@ class PHPCPP_EXPORT Class : private ClassBase
302302
template<typename CLASS>
303303
Class<T> &extends(const Class<CLASS> &base) { ClassBase::extends(base); return *this; }
304304

305+
Class<T> &extends(const ClassBase &base) { ClassBase::extends(base); return *this; }
306+
305307
private:
306308
/**
307309
* Method to create the object if it is default constructable

include/namespace.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ class PHPCPP_EXPORT Namespace
156156
return *this;
157157
}
158158

159+
Namespace &add(const ClassBase &type)
160+
{
161+
// skip when locked
162+
if (locked()) return *this;
163+
164+
// and add it to the list of classes
165+
_classes.push_back(std::unique_ptr<ClassBase>(new ClassBase(type)));
166+
167+
// allow chaining
168+
return *this;
169+
}
170+
171+
159172
/**
160173
* Add an interface to the namespace by moving it
161174
* @param interface The interface properties

0 commit comments

Comments
 (0)