Skip to content
Browse files

support for storage in namespaces of its contained classes

  • Loading branch information...
1 parent 29d4ca0 commit e6209e5c3ca17f86e0d051be8ac0d6a12ca47c38 @NotFound committed Jun 10, 2012
Showing with 19 additions and 0 deletions.
  1. +14 −0 winxedxx_namespace.cxx
  2. +5 −0 winxedxx_namespace.h
View
14 winxedxx_namespace.cxx
@@ -61,6 +61,20 @@ void WxxNamespace::set(const std::string &name, const WxxObjectPtr &value)
symbols[name] = value;
}
+void WxxNamespace::setClass(const std::string &name, WxxClass *value)
+{
+ classes[name] = value;
+ symbols[name] = WxxObjectPtr(value);
+}
+
+WxxClass * WxxNamespace::getClass(const std::string &name)
+{
+ WxxClass *cl = classes[name];
+ if (!cl)
+ throw wxx_error("class not found in namespace: " + name);
+ return cl;
+}
+
std::string WxxNamespace::get_string()
{
return name;
View
5 winxedxx_namespace.h
@@ -15,6 +15,8 @@
namespace WinxedXX
{
+class WxxClass;
+
class WxxNamespace : public WxxDefault
{
protected:
@@ -28,6 +30,8 @@ class WxxNamespace : public WxxDefault
WxxObjectPtr find_symbol(const std::string &name);
WxxNamespace &childNamespace(const std::string &name);
void set(const std::string &name, const WxxObjectPtr &value);
+ void setClass(const std::string &name, WxxClass *value);
+ WxxClass * getClass(const std::string &name);
private:
// vtable functions
std::string get_string();
@@ -39,6 +43,7 @@ class WxxNamespace : public WxxDefault
const std::string name;
WxxNamespace * const parentns;
std::map<std::string, WxxNamespace *> childs;
+ std::map<std::string, WxxClass *> classes;
std::map<std::string, WxxObjectPtr> symbols;
};

0 comments on commit e6209e5

Please sign in to comment.
Something went wrong with that request. Please try again.