url.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined URL_HEADER
00020 #define URL_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/attribute.h"
00028 
00029 class WT_File;
00030 class WT_URL_Item;
00031 
00036 
00037 
00041 class WHIPTK_API WT_URL : public WT_Attribute
00042 {
00043         friend class WT_Rendition;
00044         friend class WT_Opcode;
00045         friend class WT_W2D_Class_Factory;
00046 protected:
00047         WT_URL_List                  m_url_list;
00048 
00049 private:
00050 
00051     int                          m_incarnation;
00052     WT_Integer32                 m_current_index;
00053     WT_String                    m_current_address;
00054     WT_String                    m_current_friendly_name;    
00055     WT_Integer32                 m_count;
00056 
00057     enum WT_Materialize_Stage
00058     {
00059         Eating_Initial_Whitespace,
00060         Gathering_String,
00061         Eating_End_Whitespace,
00062         Skipping_Last_Paren,
00063 
00064         Getting_Next_Block,
00065         Getting_Assigned_Index,
00066         Getting_Address,
00067         Getting_Friendly_Name,
00068         Getting_Closing_Block_Paren,
00069         Reading_Index,
00070         Completed
00071 
00072     }  m_stage;
00073 
00074 public:
00075 
00077 
00078     WT_URL()
00079         : m_incarnation(-1)
00080         , m_stage(Eating_Initial_Whitespace)
00081     { }
00082 
00084     WT_URL(WT_URL_Item  &item);
00085 
00087     WT_URL(
00088         WT_Integer32 index, 
00089         WT_Unsigned_Integer16 const * address, 
00090         WT_Unsigned_Integer16 const * friendly_name 
00091         );
00092 
00094         WT_URL(WT_URL const& url)
00095         {
00096                 *this = url;
00097         }
00098 
00099         virtual ~WT_URL()
00100         {}
00102 public:
00104 
00105 
00109     void add_url(
00110         WT_URL_Item & item
00111         )
00112     {
00113         WD_Assert((item.index() != WD_URL_Optimize)); // user should use add_url_optimized!
00114         m_url_list.add(item);
00115     };
00116 
00118 
00122     void add_url(
00123         WT_Integer32 index,
00124         WT_Unsigned_Integer16 const *address,
00125         WT_Unsigned_Integer16 const *friendly_name
00126         )
00127     {
00128         set(index, address, friendly_name);
00129     }
00130 
00132 
00136     void add_url(
00137         WT_Integer32 index, 
00138         WT_String & address, 
00139         WT_String & friendly_name 
00140         )
00141     {
00142         WT_URL_Item item(index, address, friendly_name);
00143         add_url(item);
00144     }
00145 
00147 
00149     void add_url_optimized(
00150         WT_URL_Item & item, 
00151         WT_File & file 
00152         );
00153 
00155 
00157     void add_url_optimized(
00158         WT_Integer32 index, 
00159         WT_Unsigned_Integer16 const *address, 
00160         WT_Unsigned_Integer16 const *friendly_name, 
00161         WT_File & file 
00162         )
00163     {
00164         WT_URL_Item item(index, address, friendly_name);
00165         add_url_optimized(item, file);
00166     }
00167 
00169 
00171     void add_url_optimized(
00172         WT_Integer32 index, 
00173         WT_String & address, 
00174         WT_String & friendly_name, 
00175         WT_File & file 
00176         )
00177     {
00178         WT_URL_Item item(index, address, friendly_name);
00179         add_url_optimized(item, file);
00180     }
00181 
00183     virtual void clear() { m_url_list.remove_all(); }
00184 
00186 
00191     void flush_rendition(WT_File & file) ;
00192 
00194     void set(
00195         WT_Integer32 index, 
00196         WT_Unsigned_Integer16 const * address, 
00197         WT_Unsigned_Integer16 const * friendly_name 
00198         );
00199 
00201     WT_URL_List const & url()
00202     {    return m_url_list;    }
00203 
00205     virtual WT_URL const & operator=(WT_URL const & url);
00207 
00209     WT_ID            object_id() const;
00210     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00211     WT_Result        process(WT_File & file);
00212     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00213     WT_Result        serialize (WT_File & file) const;
00214     WT_Result        sync (WT_File & file) const;
00215     WT_Boolean       operator== (WT_Attribute const & attrib) const;
00217 
00219 
00221     static WT_Result default_process(
00222         WT_URL & item, 
00223         WT_File & file 
00224         );
00225 };
00226 
00228 
00229 #endif // URL_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5