Sha256: 15af9f54039a618571b22b570782de3b6f4f0f1814fe52e770b4c663decb99b0

Contents?: true

Size: 693 Bytes

Versions: 12

Compression:

Stored size: 693 Bytes

Contents

#include <rice/rice.hpp>

using namespace Rice;

namespace
{

enum Sample_Enum
{
  SE_FOO = 1,
  SE_BAR = 42,
  SE_BAZ = 100,
};

char const * description(Sample_Enum e)
{
  switch(e)
  {
    case SE_FOO: return "Fairly Ordinary Object";
    case SE_BAR: return "Beginner's All-purpose Ratchet";
    case SE_BAZ: return "Better than A Zebra";
  }
  return "???";
}

} // namespace

extern "C"
void Init_sample_enum()
{
    Rice::Enum<Sample_Enum> sample_enum_type =
      define_enum<Sample_Enum>("Sample_Enum")
      .define_value("FOO", SE_FOO)
      .define_value("BAR", SE_BAR)
      .define_value("BAZ", SE_BAZ);

    sample_enum_type
      .define_method("description", description);
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rice-4.3.3 sample/enum/sample_enum.cpp
rice-4.3.2 sample/enum/sample_enum.cpp
rice-4.3.1 sample/enum/sample_enum.cpp
rice-4.3.0 sample/enum/sample_enum.cpp
rice-4.2.1 sample/enum/sample_enum.cpp
rice-4.2.0 sample/enum/sample_enum.cpp
rice-4.1.0 sample/enum/sample_enum.cpp
rice-4.0.4 sample/enum/sample_enum.cpp
rice-4.0.3 sample/enum/sample_enum.cpp
rice-4.0.2 sample/enum/sample_enum.cpp
rice-4.0.1 sample/enum/sample_enum.cpp
rice-4.0.0 sample/enum/sample_enum.cpp