include/HTMLParser/Attributes.hpp

Go to the documentation of this file.
00001 #ifndef hpp_CPP_Attributes_CPP_hpp
00002 #define hpp_CPP_Attributes_CPP_hpp
00003 
00004 
00005 // We generic elements declaration
00006 #include "GenericAttributes.hpp"
00007 
00008 namespace HTML
00009 {
00010     namespace Attributes
00011     {
00022         class Attribute
00023         {
00024         private:
00026             const HTML::GenericAttribute::AttributeID       attributeType;
00028             uint32                                          startPosition;
00030             uint32                                          endPosition;
00032             uint32                                          startContent;
00034             uint32                                          endContent;
00035 
00036             // Allow changing the positions
00037         public:
00041             inline void setEndPosition(uint32 position)     { endPosition = position; }
00045             inline void setStartPosition(uint32 position)   { startPosition = position; }
00049             inline void setStartContent(uint32 position)  { startContent = position; }
00053             inline void setEndContent(uint32 position)   { endContent = position; }
00054 
00056             inline uint32 getStartPosition()    const { return startPosition; }
00058             inline uint32 getEndPosition()      const { return endPosition; }
00060             inline uint32 getStartContent()   const { return startContent; }
00062             inline uint32 getEndContent()    const { return endContent; }
00063 
00064             // Rules interface
00065         public:
00067             const tchar * attributeName() const volatile { return attributeType == HTML::GenericAttribute::Unknown ? "" : allowedAttributes[(int)attributeType - 1].name; }           
00069             inline void beenMutated()                    { startContent = endContent = 0; }
00071             inline static const tchar * defaultValue(const HTML::GenericAttribute::AttributeID & attributeType)    { return attributeType == HTML::GenericAttribute::Unknown ? "" : allowedAttributes[(int)attributeType - 1].defaultValue; }
00072 
00074             inline const HTML::GenericAttribute::AttributeID & getAttributeType() const { return attributeType; }
00075             
00076             Attribute(const HTML::GenericAttribute::AttributeID & type = HTML::GenericAttribute::Unknown, uint32 startPos = 0, uint32 endPos = 0, uint32 startCont = 0, uint32 endCont = 0) : attributeType(type), startPosition(startPos), endPosition(endPos), startContent(startCont), endContent(endCont) {}
00077             Attribute(const Attribute & attrib) : attributeType(attrib.attributeType), startPosition(attrib.startPosition), endPosition(attrib.endPosition), startContent(attrib.startContent), endContent(attrib.endContent) {}
00078 
00079         };
00080 
00082         HTML::GenericAttribute::AttributeID fromAttributeName(const tchar * const input, const uint32 & length);
00083     }
00084 }
00085 
00086 #endif

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is