Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum CSSValueID {
- CSSValueItalic,
- CSSValueOblique,
- CSSValueNormal,
- };
- class CSSIdentifierValue {
- public:
- template <typename T>
- inline T ConvertTo() const {}
- private:
- CSSValueID value_id_;
- };
- class FontSelectionValueStyle {
- };
- static inline const FontSelectionValueStyle NormalSlopeValue() {
- static FontSelectionValueStyle* normalSlopeValue = new FontSelectionValueStyle();
- return *normalSlopeValue;
- }
- static inline const FontSelectionValueStyle ItalicSlopeValue() {
- static FontSelectionValueStyle* normalSlopeValue = new FontSelectionValueStyle();
- return *normalSlopeValue;
- }
- template <>
- inline FontSelectionValueStyle CSSIdentifierValue::ConvertTo() const {
- switch (value_id_) {
- case CSSValueOblique:
- case CSSValueItalic:
- return ItalicSlopeValue();
- case CSSValueNormal:
- return NormalSlopeValue();
- default:
- break;
- }
- return NormalSlopeValue();
- }
- void testconvert() {
- CSSIdentifierValue value;
- value.ConvertTo<FontSelectionValueStyle>();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement