Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. enum CSSValueID {
  2. CSSValueItalic,
  3. CSSValueOblique,
  4. CSSValueNormal,
  5. };
  6.  
  7.  
  8. class CSSIdentifierValue {
  9. public:
  10. template <typename T>
  11. inline T ConvertTo() const {}
  12.  
  13. private:
  14. CSSValueID value_id_;
  15. };
  16.  
  17. class FontSelectionValueStyle {
  18. };
  19.  
  20. static inline const FontSelectionValueStyle NormalSlopeValue() {
  21. static FontSelectionValueStyle* normalSlopeValue = new FontSelectionValueStyle();
  22. return *normalSlopeValue;
  23. }
  24.  
  25. static inline const FontSelectionValueStyle ItalicSlopeValue() {
  26. static FontSelectionValueStyle* normalSlopeValue = new FontSelectionValueStyle();
  27. return *normalSlopeValue;
  28. }
  29.  
  30. template <>
  31. inline FontSelectionValueStyle CSSIdentifierValue::ConvertTo() const {
  32. switch (value_id_) {
  33. case CSSValueOblique:
  34. case CSSValueItalic:
  35. return ItalicSlopeValue();
  36. case CSSValueNormal:
  37. return NormalSlopeValue();
  38. default:
  39. break;
  40. }
  41. return NormalSlopeValue();
  42. }
  43.  
  44. void testconvert() {
  45. CSSIdentifierValue value;
  46. value.ConvertTo<FontSelectionValueStyle>();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement