Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add the get_pmc_keyed vtable function and improve keyed defaults

  • Loading branch information...
commit 622f3dbbcf1802aff1ccfc73b7866d54664f7e0b 1 parent 33a8334
@NotFound authored
View
16 winxedxx_default.cxx
@@ -1,9 +1,10 @@
// winxedxx_default.cxx
-// (C) 2011 Julián Albo
+// (C) 2011-2012 Julián Albo
#include "winxedxx_types.h"
#include "winxedxx_object.h"
#include "winxedxx_default.h"
+#include "winxedxx_integer.h"
#include <iostream>
#include <sstream>
@@ -147,24 +148,29 @@ std::string WxxDefault::get_string_keyed(int i)
WxxObjectPtr WxxDefault::get_pmc_keyed(int i)
{
- notimplemented("get_pmc_keyed");
- return winxedxxnull;
+ return get_pmc_keyed(WxxObjectPtr(new WxxInteger(i)));
}
WxxObjectPtr WxxDefault::get_pmc_keyed(const std::string &s)
{
+ notimplemented("get_pmc_keyed_str");
+ return winxedxxnull;
+}
+
+WxxObjectPtr WxxDefault::get_pmc_keyed(const WxxObjectPtr &key)
+{
notimplemented("get_pmc_keyed");
return winxedxxnull;
}
void WxxDefault::set_pmc_keyed(int i, const WxxObjectPtr &value)
{
- notimplemented("set_pmc_keyed");
+ notimplemented("set_pmc_keyed_int");
}
WxxObjectPtr & WxxDefault::set_pmc_keyed(const std::string &s, const WxxObjectPtr &value)
{
- notimplemented("set_pmc_keyed");
+ notimplemented("set_pmc_keyed_str");
return winxedxxnull;
}
int WxxDefault::exists(const std::string &key)
View
3  winxedxx_default.h
@@ -3,7 +3,7 @@
// winxedxx_default.h
-// (C) 2011 Julián Albo "NotFound"
+// (C) 2011-2012 Julián Albo "NotFound"
namespace WinxedXX
{
@@ -39,6 +39,7 @@ class WxxDefault : public WxxObject
std::string get_string_keyed(int i);
WxxObjectPtr get_pmc_keyed(int i);
WxxObjectPtr get_pmc_keyed(const std::string &s);
+ WxxObjectPtr get_pmc_keyed(const WxxObjectPtr &key);
void set_pmc_keyed(int i, const WxxObjectPtr &value);
WxxObjectPtr & set_pmc_keyed(const std::string &s, const WxxObjectPtr &value);
int exists(const std::string &key);
View
18 winxedxx_null.cxx
@@ -114,42 +114,48 @@ WxxObjectPtr WxxNull::sub(const WxxObjectPtr &value)
int WxxNull::get_integer_keyed(int i)
{
- nullaccess("get_integer_keyed");
+ nullaccess("get_integer_keyed_int");
return 0;
}
double WxxNull::get_number_keyed(int i)
{
- nullaccess("get_number_keyed");
+ nullaccess("get_number_keyed_int");
return 0;
}
std::string WxxNull::get_string_keyed(int i)
{
- nullaccess("get_pmc_keyed");
+ nullaccess("get_pmc_keyed_int");
return std::string();
}
WxxObjectPtr WxxNull::get_pmc_keyed(int i)
{
- nullaccess("get_pmc_keyed");
+ nullaccess("get_pmc_keyed_int");
return winxedxxnull;
}
WxxObjectPtr WxxNull::get_pmc_keyed(const std::string &s)
{
+ nullaccess("get_pmc_keyed_str");
+ return winxedxxnull;
+}
+
+WxxObjectPtr WxxNull::get_pmc_keyed(const WxxObjectPtr &key)
+{
nullaccess("get_pmc_keyed");
return winxedxxnull;
}
void WxxNull::set_pmc_keyed(int i, const WxxObjectPtr &value)
{
- nullaccess("set_pmc_keyed");
+ nullaccess("set_pmc_keyed_int");
}
WxxObjectPtr & WxxNull::set_pmc_keyed(const std::string &s, const WxxObjectPtr &value)
{
- nullaccess("set_pmc_keyed");
+ nullaccess("set_pmc_keyed_str");
return winxedxxnull;
}
View
1  winxedxx_null.h
@@ -34,6 +34,7 @@ class WxxNull : public WxxObject
std::string get_string_keyed(int i);
WxxObjectPtr get_pmc_keyed(int i);
WxxObjectPtr get_pmc_keyed(const std::string &s);
+ WxxObjectPtr get_pmc_keyed(const WxxObjectPtr &key);
void set_pmc_keyed(int i, const WxxObjectPtr &value);
int exists(const std::string &key);
WxxObjectPtr & set_pmc_keyed(const std::string &s, const WxxObjectPtr &value);
View
1  winxedxx_object.h
@@ -33,6 +33,7 @@ class WxxObject : public WxxRefcounted
virtual std::string get_string_keyed(int i) = 0;
virtual WxxObjectPtr get_pmc_keyed(int i) = 0;
virtual WxxObjectPtr get_pmc_keyed(const std::string &s) = 0;
+ virtual WxxObjectPtr get_pmc_keyed(const WxxObjectPtr &key) = 0;
virtual void set_pmc_keyed(int i, const WxxObjectPtr &value) = 0;
virtual int exists(const std::string &key) = 0;
virtual WxxObjectPtr & set_pmc_keyed(const std::string &s, const WxxObjectPtr &value) = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.