Skip to content

Commit

Permalink
Expose BaseClass, allows to store and pass reference to extend.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirmorozov committed Jan 14, 2021
1 parent 687714e commit f06b1ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Php {
* Class definition of the class
*/
template <typename T>
class PHPCPP_EXPORT Class : private ClassBase
class PHPCPP_EXPORT Class : public ClassBase
{
public:
/**
Expand Down Expand Up @@ -302,6 +302,8 @@ class PHPCPP_EXPORT Class : private ClassBase
template<typename CLASS>
Class<T> &extends(const Class<CLASS> &base) { ClassBase::extends(base); return *this; }

Class<T> &extends(const ClassBase &base) { ClassBase::extends(base); return *this; }

private:
/**
* Method to create the object if it is default constructable
Expand Down
13 changes: 13 additions & 0 deletions include/namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ class PHPCPP_EXPORT Namespace
return *this;
}

Namespace &add(const ClassBase &type)
{
// skip when locked
if (locked()) return *this;

// and add it to the list of classes
_classes.push_back(std::unique_ptr<ClassBase>(new ClassBase(type)));

// allow chaining
return *this;
}


/**
* Add an interface to the namespace by moving it
* @param interface The interface properties
Expand Down

0 comments on commit f06b1ab

Please sign in to comment.