1 #ifndef Rice__Object_defn__hpp_
2 #define Rice__Object_defn__hpp_
7 #include "Identifier.hpp"
8 #include "detail/ruby.hpp"
41 bool test()
const {
return RTEST(value_); }
45 operator bool()
const {
return test(); }
48 bool is_nil()
const {
return NIL_P(value_); }
51 operator VALUE()
const {
return value_; }
56 VALUE
const volatile &
value()
const {
return value_; }
172 template<
typename ...ArgT>
192 template<
typename ...ArgT>
196 volatile VALUE value_;
199 std::ostream & operator<<(std::ostream & out,
Object const & obj);
201 bool operator==(
Object const & lhs,
Object const & rhs);
202 bool operator!=(
Object const & lhs,
Object const & rhs);
208 extern Object const False;
209 extern Object const Undef;
A wrapper for the ruby Array class.
Definition: Array.hpp:24
A helper for defining a Class and its methods.
Definition: Class_defn.hpp:24
A wrapper for the ID type.
Definition: Identifier.hpp:16
The base class for all Objects.
Definition: Object_defn.hpp:25
int rb_type() const
Return the type of the underlying C object.
VALUE const volatile & value() const
Explicitly get the encapsulated VALUE.
Definition: Object_defn.hpp:56
bool respond_to(Identifier id) const
Determine if the objects responds to a method.
String to_s() const
Return a string representation of an object.
void iv_set(Identifier name, T const &value)
Set an instance variable.
Object call(Identifier id, ArgT... args) const
Call the Ruby method specified by 'id' on object 'obj'.
bool is_frozen() const
Determine if the object is frozen.
Object(VALUE value=Qnil)
Encapsulate an existing ruby object.
Definition: Object_defn.hpp:28
bool is_nil() const
Returns true if the object is nil, false otherwise.
Definition: Object_defn.hpp:48
void freeze()
Freeze the object.
virtual ~Object()
Destructor.
Definition: Object_defn.hpp:34
bool is_a(Object klass) const
Determine whether the object is an instance of a class/module.
void mark() const
Mark the object with the garbage collector.
Object(Object const &other)
Copy constructor.
Definition: Object_defn.hpp:31
int compare(Object const &other) const
Compare this object to another object.
Object attr_get(Identifier name) const
Get the value of an instance variable, but don't warn if it is.
Object iv_get(Identifier name) const
Get the value of an instance variable.
std::vector< VALUE > convert_args(ArgT &... args) const
Unpack the provided arguments and convert them all to Ruby types.
Object instance_eval(String const &s)
Evaluate the given string in the context of the object.
void swap(Object &other)
Swap with another Object.
void set_value(VALUE v)
Set the encapsulated value.
Class class_of() const
Get the class of an object.
bool is_instance_of(Object klass) const
Determine whether class is the object's class.
bool test() const
Definition: Object_defn.hpp:41
String inspect() const
Inspect the object.
Object vcall(Identifier id, Array args)
Vectorized call.
A Wraper for the ruby String class.
Definition: String.hpp:25