BusBoy  2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MetadataElement.h
Go to the documentation of this file.
1 
17 #ifndef __BUSBOY_METADATA_ELEMENT_H__
18 #define __BUSBOY_METADATA_ELEMENT_H__
19 
20 #include <string>
21 
22 namespace BUSBOY {
23 
29 
30  public :
31  enum Type {
32 
35 
38 
41 
43  MAP,
44 
46  KEY
47  };
48 
53  static Type enumFromString(std::string strType);
54 
59  static std::string enumToString(Type type);
60 
61  virtual Type getMetadataElementType() const =0;
62 
63  virtual bool operator==(const MetadataElement& element) const =0;
64 
65  virtual bool operator!=(const MetadataElement& element) const =0;
66 
67  protected:
68 
69  template<typename T> static const T* castElement(const MetadataElement* element, Type type);
70 
71  template<typename T> static T* castElement(MetadataElement* element, Type type);
72 
73  template<typename T> static const T& castElement(const MetadataElement& element, Type type);
74 
75  template<typename T> static T& castElement(MetadataElement& element, Type type);
76 };
77 
84 
85  public:
86 
87  virtual CloneableMetadataElement* clone() const =0;
88 
89 };
90 
91 }
92 #endif
93 

Copyright 2014 Google Inc. All rights reserved.