Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

var preincrement and WxxInteger::increment

  • Loading branch information...
commit 6f2c0302ca2ad0b0bd4b10cba70e87c767dee311 1 parent fef0103
@NotFound authored
View
5 t/base/features.t
@@ -295,6 +295,11 @@ function main [main] (args)
test.nok(vi1 === test, "operator === : x === other class");
test.ok(vi1 !== test, "operator !== : x !== other class");
+ ++vi1;
+ test.is(vi1, 43, "var preincrement");
+ i = ++vi1;
+ test.is(i, 44, "var preincrement with assignment");
+
string s = "abc";
test.is_string(s * 3, "abcabcabc", "repeat string");
View
15 winxedxx_classes.cxx
@@ -86,6 +86,11 @@ WxxObject & WxxNull::set(const std::string &s)
return *this;
}
+void WxxNull::increment()
+{
+ nullaccess("increment");
+}
+
std::string WxxNull::get_string_keyed(int i)
{
nullaccess("get_pmc_keyed");
@@ -262,6 +267,11 @@ WxxObject & WxxDefault::set(const std::string &s)
return *this;
}
+void WxxDefault::increment()
+{
+ notimplemented("increment");
+}
+
std::string WxxDefault::get_string_keyed(int i)
{
return get_pmc_keyed(i);
@@ -390,6 +400,11 @@ WxxObject & WxxInteger::set(double value)
return *this;
}
+void WxxInteger::increment()
+{
+ ++i;
+}
+
void WxxInteger::print() { std::cout << i; }
//*************************************************************
View
1  winxedxx_default.h
@@ -28,6 +28,7 @@ class WxxDefault : public WxxObject
WxxObject & set(double value);
WxxObject & set(const char *s);
WxxObject & set(const std::string &s);
+ void increment();
std::string get_string_keyed(int i);
WxxObjectPtr get_pmc_keyed(int i);
WxxObjectPtr get_pmc_keyed(const std::string &s);
View
1  winxedxx_integer.h
@@ -26,6 +26,7 @@ class WxxInteger : public WxxDefault
std::string get_string();
WxxObject & set(int value);
WxxObject & set(double value);
+ void increment();
void print();
private:
int i;
View
1  winxedxx_null.h
@@ -23,6 +23,7 @@ class WxxNull : public WxxObject
WxxObject & set(double value);
WxxObject & set(const char *s);
WxxObject & set(const std::string &s);
+ void increment();
std::string get_string_keyed(int i);
WxxObjectPtr get_pmc_keyed(int i);
WxxObjectPtr get_pmc_keyed(const std::string &s);
View
1  winxedxx_object.h
@@ -22,6 +22,7 @@ class WxxObject
virtual WxxObject & set(double value) = 0;
virtual WxxObject & set(const char *s) = 0;
virtual WxxObject & set(const std::string &s) = 0;
+ virtual void increment() = 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;
View
6 winxedxx_objectptr.cxx
@@ -164,6 +164,12 @@ WxxObjectPtr::operator std::string () const
return object->get_string();
}
+WxxObjectPtr & WxxObjectPtr::operator++()
+{
+ object->increment();
+ return *this;
+}
+
int WxxObjectPtr::is_null() const
{
return object->is_null();
View
1  winxedxx_types.h
@@ -59,6 +59,7 @@ class WxxObjectPtr
operator bool() const;
operator double() const;
operator std::string() const;
+ WxxObjectPtr & operator++();
int is_null() const;
int instanceof(const std::string &type);
std::string get_string() const;
Please sign in to comment.
Something went wrong with that request. Please try again.