PropertySpecification.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROCKETCOREPROPERTYSPECIFICATION_H
00029 #define ROCKETCOREPROPERTYSPECIFICATION_H
00030
00031 #include <Rocket/Core/Header.h>
00032 #include <Rocket/Core/Element.h>
00033 #include <Rocket/Core/PropertyDefinition.h>
00034
00035 namespace Rocket {
00036 namespace Core {
00037
00038 class PropertyDictionary;
00039 struct PropertyShorthandDefinition;
00040
00047 class ROCKETCORE_API PropertySpecification
00048 {
00049 public:
00050 enum ShorthandType
00051 {
00052
00053
00054 FALL_THROUGH,
00055
00056 REPLICATE,
00057
00058 BOX,
00059
00060 AUTO
00061 };
00062
00063 PropertySpecification();
00064 ~PropertySpecification();
00065
00072 PropertyDefinition& RegisterProperty(const String& property_name, const String& default_value, bool inherited, bool forces_layout);
00076 const PropertyDefinition* GetProperty(const String& property_name) const;
00077
00080 void GetRegisteredProperties(PropertyNameList& properties) const;
00081
00087 bool RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type = AUTO);
00091 const PropertyShorthandDefinition* GetShorthand(const String& shorthand_name) const;
00092
00098 bool ParsePropertyDeclaration(PropertyDictionary& dictionary, const String& property_name, const String& property_value, const String& source_file = "", int source_line_number = 0) const;
00101 void SetPropertyDefaults(PropertyDictionary& dictionary) const;
00102
00103 private:
00104 typedef std::map< String, PropertyDefinition* > PropertyMap;
00105 typedef std::map< String, PropertyShorthandDefinition* > ShorthandMap;
00106
00107 PropertyMap properties;
00108 ShorthandMap shorthands;
00109
00110 bool ParsePropertyValues(StringList& values_list, const String& values, bool split_values) const;
00111 };
00112
00113 }
00114 }
00115
00116 #endif