Permalink
Browse files

get_integer_keyed and get_number_keyed (int)

  • Loading branch information...
1 parent 764130d commit 5276bd7cfd1ec469dc21b125c62db5257c3fe097 @NotFound committed Jun 2, 2012
Showing with 44 additions and 16 deletions.
  1. +14 −14 winxedxx.h
  2. +10 −0 winxedxx_default.cxx
  3. +2 −0 winxedxx_default.h
  4. +14 −2 winxedxx_null.cxx
  5. +2 −0 winxedxx_null.h
  6. +2 −0 winxedxx_object.h
View
@@ -49,35 +49,35 @@ class WxxNCI : public WxxDefault
template<typename NciParam>
-NciParam getarg(const WxxObjectArray &args, int i);
+NciParam getarg(WxxObjectArray &args, int i);
// Integer types:
template<>
-int getarg(const WxxObjectArray &args, int i)
-{ return args[i].get_integer(); }
+int getarg(WxxObjectArray &args, int i)
+{ return args.get_integer_keyed(i); }
template<>
-short getarg(const WxxObjectArray &args, int i)
-{ return args[i].get_integer(); }
+short getarg(WxxObjectArray &args, int i)
+{ return args.get_integer_keyed(i); }
template<>
-long getarg(const WxxObjectArray &args, int i)
-{ return args[i].get_integer(); }
+long getarg(WxxObjectArray &args, int i)
+{ return args.get_integer_keyed(i); }
// Number types:
template<>
-double getarg(const WxxObjectArray &args, int i)
-{ return args[i].get_number(); }
+double getarg(WxxObjectArray &args, int i)
+{ return args.get_number_keyed(i); }
template<>
-float getarg(const WxxObjectArray &args, int i)
-{ return args[i].get_number(); }
+float getarg(WxxObjectArray &args, int i)
+{ return args.get_number_keyed(i); }
// string types - unfinished
template<>
-std::string getarg(const WxxObjectArray &args, int i)
-{ return args[i].get_string(); }
+std::string getarg(WxxObjectArray &args, int i)
+{ return args.get_string_keyed(i); }
// Raw pointer
template<>
-void * getarg(const WxxObjectArray &args, int i)
+void * getarg(WxxObjectArray &args, int i)
{ return args[i].get_pointer(); }
View
@@ -130,6 +130,16 @@ WxxObjectPtr WxxDefault::sub(const WxxObjectPtr &value)
return winxedxxnull;
}
+int WxxDefault::get_integer_keyed(int i)
+{
+ return get_pmc_keyed(i).get_integer();
+}
+
+double WxxDefault::get_number_keyed(int i)
+{
+ return get_pmc_keyed(i).get_number();
+}
+
std::string WxxDefault::get_string_keyed(int i)
{
return get_pmc_keyed(i).get_string();
View
@@ -34,6 +34,8 @@ class WxxDefault : public WxxObject
void decrement();
WxxObjectPtr add(const WxxObjectPtr &value);
WxxObjectPtr sub(const WxxObjectPtr &value);
+ int get_integer_keyed(int i);
+ double get_number_keyed(int i);
std::string get_string_keyed(int i);
WxxObjectPtr get_pmc_keyed(int i);
WxxObjectPtr get_pmc_keyed(const std::string &s);
View
@@ -102,16 +102,28 @@ void WxxNull::decrement()
WxxObjectPtr WxxNull::add(const WxxObjectPtr &value)
{
- nullaccess("ass");
+ nullaccess("add");
return winxedxxnull;
}
WxxObjectPtr WxxNull::sub(const WxxObjectPtr &value)
{
- nullaccess("ass");
+ nullaccess("sub");
return winxedxxnull;
}
+int WxxNull::get_integer_keyed(int i)
+{
+ nullaccess("get_integer_keyed");
+ return 0;
+}
+
+double WxxNull::get_number_keyed(int i)
+{
+ nullaccess("get_number_keyed");
+ return 0;
+}
+
std::string WxxNull::get_string_keyed(int i)
{
nullaccess("get_pmc_keyed");
View
@@ -29,6 +29,8 @@ class WxxNull : public WxxObject
void decrement();
WxxObjectPtr add(const WxxObjectPtr &value);
WxxObjectPtr sub(const WxxObjectPtr &value);
+ int get_integer_keyed(int i);
+ double get_number_keyed(int i);
std::string get_string_keyed(int i);
WxxObjectPtr get_pmc_keyed(int i);
WxxObjectPtr get_pmc_keyed(const std::string &s);
View
@@ -28,6 +28,8 @@ class WxxObject : public WxxRefcounted
virtual void decrement() = 0;
virtual WxxObjectPtr add(const WxxObjectPtr &value) = 0;
virtual WxxObjectPtr sub(const WxxObjectPtr &value) = 0;
+ virtual int get_integer_keyed(int i) = 0;
+ virtual double get_number_keyed(int i) = 0;
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;

0 comments on commit 5276bd7

Please sign in to comment.