Rice  1.5.2
 All Classes Files Functions Variables Typedefs Friends Pages
Symbol.hpp
1 #ifndef Rice__Symbol__hpp_
2 #define Rice__Symbol__hpp_
3 
4 #include "Identifier.hpp"
5 #include "Object.hpp"
6 #include "detail/ruby.hpp"
7 #include <string>
8 
9 namespace Rice
10 {
11 
13 
18 class Symbol
19  : public Object
20 {
21 public:
23  Symbol(VALUE v);
24 
26  Symbol(Object v);
27 
29  Symbol(Identifier id);
30 
32  Symbol(char const * s = "");
33 
35  Symbol(std::string const & s);
36 
38  char const * c_str() const;
39 
41  std::string str() const;
42 
44  Identifier to_id() const;
45 };
46 
47 } // namespace Rice
48 
49 template<>
50 inline
51 Rice::Symbol from_ruby<Rice::Symbol>(Rice::Object x)
52 {
53  return Rice::Symbol(x);
54 }
55 
56 template<>
57 inline
58 Rice::Object to_ruby<Rice::Symbol>(Rice::Symbol const & x)
59 {
60  return x;
61 }
62 
63 #include "Symbol.ipp"
64 
65 #endif // Rice__Symbol__hpp_
66 
A wrapper for the ID type.
Definition: Identifier.hpp:15
std::string str() const
Return a string representation of the Symbol.
Symbol(VALUE v)
Wrap an existing symbol.
char const * c_str() const
Return a string representation of the Symbol.
The base class for all Objects.
Definition: Object_defn.hpp:23
Identifier to_id() const
Return the Symbol as an Identifier.
A wrapper for ruby&#39;s Symbol class.
Definition: Symbol.hpp:18