Sha256: eff59ffa70fb60d98c363642bff5e2962ec03a646e03d2f166d253094d0e304d

Contents?: true

Size: 1.87 KB

Versions: 37

Compression:

Stored size: 1.87 KB

Contents

#ifndef Rice__Class_defn__hpp_
#define Rice__Class_defn__hpp_

#include "Object_defn.hpp"
#include "Module_impl.hpp"
#include "Module_defn.hpp"
#include "to_from_ruby_defn.hpp"
#include "Identifier.hpp"

/*!
 *  \example inheritance/animals.cpp
 */

namespace Rice
{

//! A helper for defining a Class and its methods.
/*! This class provides a C++-style interface to ruby's Class class and
 *  for defining methods on that class.
 */
class Class
  : public Module_impl<Module, Class>
{
public:
  //! Default construct a new class wrapper and initialize it to
  //! rb_cObject.
  Class();

  //! Construct a new class wrapper from a ruby object of type T_CLASS.
  Class(VALUE v);

  //! Disallow creation of an instance from Ruby code.
  /*! Undefines the singleton method allocate (or new, if using a
   *  version of ruby prior to 1.7) and the instance method initialize.
   */
  Class & undef_creation_funcs();
};

//! Define a new class in the namespace given by module.
/*! \param module the Module in which to define the class.
 *  \param name the name of the class.
 *  \param superclass the base class to use.
 *  \return the new class.
 */
Class define_class_under(
    Object module,
    char const * name,
    Object superclass = rb_cObject);

//! Define a new class in the default namespace.
/*! \param name the name of the class.
 *  \param superclass the base class to use.
 *  \return the new class.
 */
Class define_class(
    char const * name,
    Object superclass = rb_cObject);

//! Create a new anonymous class.
/*! \param superclass the base class to use.
 *  \return the new class.
 */
Class anonymous_class(
    Object superclass = rb_cObject);

} // namespace Rice

template<>
inline
Rice::Class from_ruby<Rice::Class>(Rice::Object x)
{
  return Rice::Class(x);
}

template<>
inline
Rice::Object to_ruby<Rice::Class>(Rice::Class const & x)
{
  return x;
}

#endif // Rice__Class_defn__hpp_

Version data entries

37 entries across 37 versions & 6 rubygems

Version Path
rice2-2.2.1 rice/Class_defn.hpp
rice2-2.2.0 rice/Class_defn.hpp
rice-2.2.0 rice/Class_defn.hpp
rice-2.1.3 rice/Class_defn.hpp
rice-2.1.2 rice/Class_defn.hpp
rice-2.1.1 rice/Class_defn.hpp
rice-2.1.0 rice/Class_defn.hpp
rice-2.0.0 rice/Class_defn.hpp
rice-1.7.0 rice/Class_defn.hpp
rice-1.6.3 rice/Class_defn.hpp
jameskilton-rice-1.2.0 rice/Class_defn.hpp
rice-1.6.2 rice/Class_defn.hpp
rice-1.6.1 rice/Class_defn.hpp
rice-1.6.0 rice/Class_defn.hpp
rice-1.6.0.pre rice/Class_defn.hpp
rice-1.5.3 rice/Class_defn.hpp
rice-1.5.2 rice/Class_defn.hpp
keyme-rice-1.5.1.keyme1 rice/Class_defn.hpp
keyme-rice-1.5.1.keyme rice/Class_defn.hpp
rice-1.5.1 rice/Class_defn.hpp