src/core/enum.h
changeset 4654 2eaebe77d66b
parent 3182 61fe7fe81ebd
     1.1 --- a/src/core/enum.h	Thu May 29 23:24:10 2008 -0700
     1.2 +++ b/src/core/enum.h	Sat Jul 04 08:15:48 2009 +0200
     1.3 @@ -41,6 +41,8 @@
     1.4    EnumValue (int v);
     1.5    void Set (int v);
     1.6    int Get (void) const;
     1.7 +  template <typename T>
     1.8 +  bool GetAccessor (T &v) const;
     1.9  
    1.10    virtual Ptr<AttributeValue> Copy (void) const;
    1.11    virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
    1.12 @@ -50,6 +52,13 @@
    1.13    int m_v;
    1.14  };
    1.15  
    1.16 +template <typename T>
    1.17 +bool EnumValue::GetAccessor (T &v) const
    1.18 +{
    1.19 +  v = T (m_v);
    1.20 +  return true;
    1.21 +}
    1.22 +
    1.23  class EnumChecker : public AttributeChecker
    1.24  {
    1.25  public: