diff options
author | Nikolai Pretzell <np@openoffice.org> | 2002-03-08 13:32:38 +0000 |
---|---|---|
committer | Nikolai Pretzell <np@openoffice.org> | 2002-03-08 13:32:38 +0000 |
commit | 1710683406e72de5458733231636e8fdb2c2c0bc (patch) | |
tree | df25bf37d37eb1edb00165da07c8529458be562b /udm | |
parent | 8913e1e75efa377a107fa37d22680ec223cb043c (diff) |
Moving Autodoc to OpenOffice.org, module udm: UnifiedDataModel
Diffstat (limited to 'udm')
-rw-r--r-- | udm/inc/udm/html/htmlitem.hxx | 435 | ||||
-rw-r--r-- | udm/inc/udm/xml/xmlitem.hxx | 420 | ||||
-rw-r--r-- | udm/prj/build.lst | 14 | ||||
-rw-r--r-- | udm/prj/d.lst | 9 | ||||
-rw-r--r-- | udm/source/html/htmlitem.cxx | 284 | ||||
-rw-r--r-- | udm/source/html/makefile.mk | 91 | ||||
-rw-r--r-- | udm/source/inc/precomp.h | 118 | ||||
-rw-r--r-- | udm/source/mkinc/fullcpp.mk | 91 | ||||
-rw-r--r-- | udm/source/unittest/makefile.mk | 108 | ||||
-rw-r--r-- | udm/source/unittest/test.cxx | 146 | ||||
-rw-r--r-- | udm/source/xml/makefile.mk | 91 | ||||
-rw-r--r-- | udm/source/xml/xmlitem.cxx | 613 | ||||
-rw-r--r-- | udm/util/makefile.mk | 92 |
13 files changed, 2512 insertions, 0 deletions
diff --git a/udm/inc/udm/html/htmlitem.hxx b/udm/inc/udm/html/htmlitem.hxx new file mode 100644 index 000000000000..30cfab2e3e45 --- /dev/null +++ b/udm/inc/udm/html/htmlitem.hxx @@ -0,0 +1,435 @@ +/************************************************************************* + * + * $RCSfile: htmlitem.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:32:37 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef CSI_HTML_HTMLITEM_HXX +#define CSI_HTML_HTMLITEM_HXX + +// USED SERVICES + // BASE CLASSES +#include <udm/xml/xmlitem.hxx> + // COMPONENTS + // PARAMETERS + + +#define COMPATIBLE_NETSCAPE_47 + +namespace csi +{ +namespace html +{ + + + +/** <BODY> +*/ +class Body : public csi::xml::AnElement +{ + public: + Body() + : csi::xml::AnElement("body") {} + private: + virtual bool LineBreakAfterBeginTag() const; +}; + + +#ifdef COMPATIBLE_NETSCAPE_47 +/** <BR> +*/ +class HorizontalLine : public xml::XmlCode +{ + public: + HorizontalLine() + : xml::XmlCode("<hr>\n") {} +}; + +#else +/** <HR> +*/ +class HorizontalLine : public csi::xml::AnEmptyElement +{ + public: + HorizontalLine() + : csi::xml::AnEmptyElement("hr") {} + private: + virtual bool LineBreakAfterBeginTag() const; +}; +#endif + + +/** <IMG .... > +*/ +class Image : public csi::xml::AnEmptyElement +{ + public: + Image( + const csv::String & i_sSrc, + const csv::String & i_sWidth, + const csv::String & i_sHeight, + const csv::String & i_sAlign, + const csv::String & i_sBorder ); +}; + +/** <A name=""> +*/ +class Label : public csi::xml::AnElement +{ + public: + Label( + const csv::String & i_sLabel ) + : csi::xml::AnElement("a") + { *this << new csi::xml::AnAttribute("name", i_sLabel); } + private: + virtual bool LineBreakAfterEndTag() const; +}; + +/** <p> +*/ +class Paragraph : public csi::xml::AnElement +{ + public: + Paragraph() + : csi::xml::AnElement("p") {} + private: + virtual bool LineBreakAfterEndTag() const; +}; + +/** <H1-6> +*/ +class Headline : public csi::xml::APureElement +{ + public: + Headline( + int i_nNr ) + : csi::xml::APureElement(sTags[i_nNr-1]) { csv_assert(1 <= i_nNr AND i_nNr < 7); } + private: + static const char * sTags[6]; + virtual bool LineBreakAfterEndTag() const; +}; + +#ifdef COMPATIBLE_NETSCAPE_47 +/** <BR> +*/ +class LineBreak : public xml::XmlCode +{ + public: + LineBreak() + : xml::XmlCode("<br>\n") {} +}; + +#else +/** <BR> +*/ +class LineBreak : public csi::xml::ASglTag +{ + public: + LineBreak() + : csi::xml::ASglTag("br") {} + private: + virtual bool LineBreakAfterBeginTag() const; +}; +#endif + + +/** <b> +*/ +class Bold : public csi::xml::APureElement +{ + public: + Bold() + : csi::xml::APureElement("b") {} +}; + +/** <i> +*/ +class Italic : public csi::xml::APureElement +{ + public: + Italic() + : csi::xml::APureElement("i") {} +}; + +/** <strong> +*/ +class Strong : public csi::xml::APureElement +{ + public: + Strong() + : csi::xml::APureElement("strong") {} +}; + +/** <em> +*/ +class Emphasized : public csi::xml::APureElement +{ + public: + Emphasized() + : csi::xml::APureElement("em") {} +}; + +/** <font> +*/ +class Font : public csi::xml::AnElement +{ + public: + Font() + : csi::xml::AnElement("font") {} +}; + + +/** <A href=""> +*/ +class Link : public csi::xml::AnElement +{ + public: + Link( + const csv::String &i_sDestinaton ) + : csi::xml::AnElement("a") + { *this << new csi::xml::AnAttribute("href", i_sDestinaton); } +}; + +class TableCell : public csi::xml::AnElement +{ + public: + TableCell() + : csi::xml::AnElement("td") {} + private: + virtual bool LineBreakAfterEndTag() const; +}; + +class TableRow : public csi::xml::AnElement +{ + public: + TableRow() + : csi::xml::AnElement("tr") {} + + TableCell & AddCell( + DYN csi::xml::Item* let_dpItem = 0 ); + private: + virtual bool LineBreakAfterBeginTag() const; +}; + +/** <table ....> +*/ +class Table : public csi::xml::AnElement +{ + public: + Table() + : csi::xml::AnElement("table") {} + Table( + const csv::String & i_sBorder, + const csv::String & i_sWidth, + const csv::String & i_sCellPadding, + const csv::String & i_sCellSpacing ); + TableRow & AddRow(); + private: + virtual bool FinishEmptyTag_XmlStyle() const; + virtual bool LineBreakAfterBeginTag() const; +}; + + + +class DefListTerm : public csi::xml::AnElement +{ + public: + DefListTerm() + : csi::xml::AnElement("dt") {} + private: + virtual bool LineBreakAfterEndTag() const; +}; + +class DefListDefinition : public csi::xml::AnElement +{ + public: + DefListDefinition() + : csi::xml::AnElement("dd") {} + private: + virtual bool LineBreakAfterEndTag() const; +}; + +/** <DL> +*/ +class DefList : public csi::xml::AnElement +{ + public: + DefList() + : csi::xml::AnElement("dl") {} + + DefListTerm & AddTerm( + DYN csi::xml::Item* let_dpItem = 0 ); + DefListDefinition & AddDefinition( + DYN csi::xml::Item* let_dpItem = 0 ); + private: + virtual bool LineBreakAfterBeginTag() const; +}; + + +class ListItem : public csi::xml::AnElement +{ + public: + ListItem() + : csi::xml::AnElement("li") {} + private: + virtual bool LineBreakAfterEndTag() const; +}; + +/** <OL> +*/ +class NumeratedList : public csi::xml::AnElement +{ + public: + NumeratedList() + : csi::xml::AnElement("ol") {} + + ListItem & AddItem( + DYN csi::xml::Item* let_dpItem = 0 ); + private: + virtual bool LineBreakAfterBeginTag() const; +}; + +/** <UL> +*/ +class SimpleList : public csi::xml::AnElement +{ + public: + SimpleList() + : csi::xml::AnElement("ul") {} + + ListItem & AddItem( + DYN csi::xml::Item* let_dpItem = 0 ); + private: + virtual bool LineBreakAfterBeginTag() const; +}; + + +class ClassAttr : public csi::xml::AnAttribute +{ + public: + ClassAttr( + const csv::String & i_sValue ) + : csi::xml::AnAttribute( "class", i_sValue ) {} +}; + +class StyleAttr : public csi::xml::AnAttribute +{ + public: + StyleAttr( + const csv::String & i_sValue ) + : csi::xml::AnAttribute( "style", i_sValue ) {} +}; + +class SizeAttr : public csi::xml::AnAttribute +{ + public: + SizeAttr( + const csv::String & i_sValue ) + : csi::xml::AnAttribute( "size", i_sValue ) {} +}; + +class ColorAttr : public csi::xml::AnAttribute +{ + public: + ColorAttr( + const csv::String & i_sValue ) + : csi::xml::AnAttribute( "color", i_sValue ) {} +}; + +class BgColorAttr : public csi::xml::AnAttribute +{ + public: + BgColorAttr( + const csv::String & i_sValue ) + : csi::xml::AnAttribute( "bgcolor", i_sValue ) {} +}; + +class AlignAttr : public csi::xml::AnAttribute +{ + public: + AlignAttr( + const csv::String & i_sValue ) + : csi::xml::AnAttribute( "align", i_sValue ) {} +}; + +class WidthAttr : public csi::xml::AnAttribute +{ + public: + WidthAttr( + const csv::String & i_sValue ) + : csi::xml::AnAttribute( "width", i_sValue ) {} +}; + + + +class Sbr : public csi::xml::XmlCode // Sourcefile lineBreak +{ + public: + Sbr() + : csi::xml::XmlCode("\n") {} +}; + + +} // namespace html +} // namespace csi + +namespace Html = csi::html; + +#endif + + diff --git a/udm/inc/udm/xml/xmlitem.hxx b/udm/inc/udm/xml/xmlitem.hxx new file mode 100644 index 000000000000..2d78016f41ed --- /dev/null +++ b/udm/inc/udm/xml/xmlitem.hxx @@ -0,0 +1,420 @@ +/************************************************************************* + * + * $RCSfile: xmlitem.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:32:37 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef CSI_XML_XMLITEM_HXX +#define CSI_XML_XMLITEM_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <cosv/template/swelist.hxx> +#include <cosv/template/dyn.hxx> + // PARAMETERS + +namespace csv +{ + class AnyWrite; +} + + +namespace csi +{ +namespace xml +{ + + +/* Basics: + Item, Attribute, Element, TextContext +*/ + +class Item +{ + public: + virtual ~Item() {} + void WriteOut( + csv::bostream & io_aFile ) const; + private: + virtual void do_WriteOut( + csv::bostream & io_aFile ) const = 0; +}; + +typedef csv::SweList_dyn< Item > ItemList; + +class Attribute +{ + public: + virtual ~Attribute() {} + + void WriteOut( + csv::bostream & io_aFile ) const; + + const csv::String& Name() const; + const csv::String& Value() const; + + private: + virtual const csv::String & + inq_Name() const = 0; + virtual const csv::String & + inq_Value() const = 0; +}; + +typedef csv::SweList_dyn< Attribute > AttrList; + + +class Element : public Item +{ + public: + Element & operator<<( /// For multiple content items. + DYN Item * let_dpItem ); + Element & operator<<( /// For multiple content items. + const csv::String& let_drText ); + Element & operator<<( /// For multiple content items. + const char * let_dpText ); + Element & operator<<( + DYN Attribute * let_dpAttr ); + + Element & operator>>( /// For multiple content items. @return the child Element. + DYN Element & let_drElement ); + + + Item * SetContent( /// For only one content item. + DYN Item * let_dpItem ); /// Replaces previous content. May be 0, then all content is deleted. + private: + // Interface Item: + virtual void do_WriteOut( + csv::bostream & io_aFile ) const; + // Local + virtual void op_streamout( + DYN Item * let_dpItem ) = 0; + virtual void op_streamout( + DYN Attribute * let_dpAttr ) = 0; + + virtual void do_SetContent( + DYN Item * let_dpItem ) = 0; + // Helpers + virtual const csv::String & + inq_TagName() const = 0; + virtual const Item * + inq_Content() const = 0; + virtual const AttrList * + inq_Attrs() const = 0; + + virtual bool FinishEmptyTag_XmlStyle() const; /// Defaulted to: true + + virtual bool LineBreakAfterBeginTag() const; /// Defaulted to: false + virtual bool LineBreakAfterEndTag() const; /// Defaulted to: true, if LineBreakAfterBeginTag() +}; + +class TextContent : public Item +{ +}; + + +/* Implementation simplifiers: + EmptyElement, PureElement, SglTag +*/ + +class EmptyElement : public Element +{ + private: + // Interface Element: + virtual void op_streamout( /// does nothing + DYN Item * let_dpItem ); + virtual void op_streamout( + DYN Attribute * let_dpAttr ); + virtual void do_SetContent( /// does nothing + DYN Item * let_dpItem ); + virtual const Item * + inq_Content() const; /// @return 0 + virtual const AttrList * + inq_Attrs() const; + + // Local + virtual AttrList & inq_RefAttrs() = 0; + const AttrList & inq_RefAttrs() const; +}; + +class PureElement : public Element +{ + private: + // Interface Element: + virtual void op_streamout( + DYN Item * let_dpItem ); + virtual void op_streamout( /// does nothing + DYN Attribute * let_dpAttr ); + virtual void do_SetContent( + DYN Item * let_dpItem ); + virtual const Item * + inq_Content() const; + virtual const AttrList * + inq_Attrs() const; /// @return 0 + // Local + virtual Dyn< Item > & + inq_RefContent() = 0; + const Dyn< Item > & inq_RefContent() const; +}; + +class SglTag : public Element +{ + private: + // Interface Element: + virtual void op_streamout( /// does nothing + DYN Item * let_dpItem ); + virtual void op_streamout( /// does nothing + DYN Attribute * let_dpAttr ); + virtual void do_SetContent( /// does nothing + DYN Item * let_dpItem ); + virtual const Item * + inq_Content() const; /// @return 0 + virtual const AttrList * + inq_Attrs() const; /// @return 0 +}; + + + +/* Standard Element implementations, if there are not any + specialized ones. +*/ + +class AnElement : public Element +{ + public: + AnElement( + const csv::String& i_sTagName ); + ~AnElement(); + private: + // Interface Element + virtual void op_streamout( + DYN Item * let_dpItem ); + virtual void op_streamout( + DYN Attribute * let_dpAttr ); + virtual void do_SetContent( + DYN Item * let_dpItem ); + virtual const csv::String & + inq_TagName() const; + virtual const Item * + inq_Content() const; + virtual const AttrList * + inq_Attrs() const; + // DATA + csv::String sTagName; + Dyn< Item > pContent; + AttrList aAttrs; +}; + + +class AnEmptyElement : public EmptyElement +{ + public: + AnEmptyElement( + const csv::String & i_sTagName ); + ~AnEmptyElement(); + private: + // Interface Element: + virtual const csv::String & + inq_TagName() const; + // Interface EmptyElement: + virtual AttrList & inq_RefAttrs(); + + // DATA + csv::String sTagName; + AttrList aAttrs; +}; + +class APureElement : public PureElement +{ + public: + APureElement( + const csv::String & i_sTagName ); + ~APureElement(); + private: + // Interface Element: + virtual const csv::String & + inq_TagName() const; + // Interface PureElement: + virtual Dyn< Item > & + inq_RefContent(); + // DATA + csv::String sTagName; + Dyn< Item > pContent; +}; + +class ASglTag : public SglTag +{ + public: + ASglTag( + const csv::String & i_sTagName ); + ~ASglTag(); + private: + // Interface Element: + virtual const csv::String & + inq_TagName() const; + // DATA + csv::String sTagName; +}; + + +/* Standard Attribute implementation +*/ +class AnAttribute : public Attribute +{ + public: + AnAttribute( + const csv::String & i_sName, + const csv::String & i_sValue ); + ~AnAttribute(); + private: + // Interface Attribute: + virtual const csv::String & + inq_Name() const; + virtual const csv::String & + inq_Value() const; + // DATA + csv::String sName; + csv::String sValue; +}; + + + +/* Implementations of TextContent: + + Text ( reserved characters will be replaced and appear unchanged ) + XmlCode ( reserved characters stay and are interpreted + by the XML-viewer ) +*/ +class Text : public TextContent +{ + public: + Text( + const csv::String & i_sText ); + Text( + const char * i_sText ); + ~Text(); + private: + virtual void do_WriteOut( + csv::bostream & io_aFile ) const; + // DATA + csv::String sText; +}; + + +class XmlCode : public TextContent +{ + public: + XmlCode( + const csv::String & i_sText ); + ~XmlCode(); + private: + virtual void do_WriteOut( + csv::bostream & io_aFile ) const; + // DATA + csv::String sText; +}; + + + +// IMPLEMENTATION + +inline void +Item::WriteOut( csv::bostream & io_aFile ) const + { do_WriteOut(io_aFile); } + +inline const csv::String & +Attribute::Name() const + { return inq_Name(); } +inline const csv::String & +Attribute::Value() const + { return inq_Value(); } + +inline Element & +Element::operator<<( DYN Item * let_dpItem ) + { op_streamout(let_dpItem); return *this; } +inline Element & +Element::operator<<( const csv::String & let_drText ) + { op_streamout( new Text(let_drText) ); return *this; } +inline Element & +Element::operator<<( const char * let_drText ) + { op_streamout( new Text(let_drText) ); return *this; } +inline Element & +Element::operator<<( DYN Attribute * let_dpAttr ) + { op_streamout(let_dpAttr); return *this; } +inline Element & +Element::operator>>( DYN Element & let_drElement ) + { op_streamout(&let_drElement); return let_drElement; } +inline Item * +Element::SetContent( DYN Item * let_dpItem ) + { do_SetContent(let_dpItem); return let_dpItem; } + +inline const AttrList & +EmptyElement::inq_RefAttrs() const + { return const_cast< EmptyElement* >(this)->inq_RefAttrs(); } + +inline const Dyn< Item > & +PureElement::inq_RefContent() const + { return const_cast< PureElement* >(this)->inq_RefContent(); } + +} // namespace xml +} // namespace csi + + +#endif + + diff --git a/udm/prj/build.lst b/udm/prj/build.lst new file mode 100644 index 000000000000..0385185b0006 --- /dev/null +++ b/udm/prj/build.lst @@ -0,0 +1,14 @@ +ud udm : cosv NULL +ud udm usr1 - all ud_mkout NULL +ud udm\prj get - all ud_prj NULL +ud udm\inc get - all ud_inc NULL +ud udm\inc\udm get - all udi_udm NULL +ud udm\inc\udm\html get - all udiu_html NULL +ud udm\inc\udm\xml get - all udiu_xml NULL +ud udm\source get - all ud_src NULL +ud udm\source\html nmake - all uds_html NULL +ud udm\source\udm nmake - all uds_udm NULL +ud udm\source\xml nmake - all uds_xml NULL +ud udm\util nmake - all ud_util uds_xml uds_html uds_udm NULL +#=================================================================== + diff --git a/udm/prj/d.lst b/udm/prj/d.lst new file mode 100644 index 000000000000..805e9a1393b9 --- /dev/null +++ b/udm/prj/d.lst @@ -0,0 +1,9 @@ +mkdir: %_DEST%\inc%_EXT%\udm +mkdir: %_DEST%\inc%_EXT%\udm\html +mkdir: %_DEST%\inc%_EXT%\udm\xml + +..\%__SRC%\lib\udm.lib %_DEST%\lib%_EXT%\udm.lib +..\inc\udm\*.hxx %_DEST%\inc%_EXT%\udm\*.hxx +..\inc\udm\html\*.hxx %_DEST%\inc%_EXT%\udm\html\*.hxx +..\inc\udm\xml\*.hxx %_DEST%\inc%_EXT%\udm\xml\*.hxx + diff --git a/udm/source/html/htmlitem.cxx b/udm/source/html/htmlitem.cxx new file mode 100644 index 000000000000..751eea39cc9b --- /dev/null +++ b/udm/source/html/htmlitem.cxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * $RCSfile: htmlitem.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:32:37 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <udm/html/htmlitem.hxx> + +// NOT FULLY DECLARED SERVICES + + +namespace csi +{ +namespace html +{ + +using namespace csi::xml; + +template <class ELEM> +inline ELEM & +PushElem( Element & i_rMain, + DYN ELEM * let_dpSub, + DYN Item * let_dpItem ) +{ + i_rMain << let_dpSub; + if ( let_dpItem != 0 ) + *let_dpSub << let_dpItem; + return *let_dpSub; +} + + +bool +Body::LineBreakAfterBeginTag() const +{ + return true; +} + +#ifndef COMPATIBLE_NETSCAPE_47 +bool +HorizontalLine::LineBreakAfterBeginTag() const +{ + return true; +} +#endif + + +Image::Image( const csv::String & i_sSrc, + const csv::String & i_sWidth, + const csv::String & i_sHeight, + const csv::String & i_sAlign, + const csv::String & i_sBorder ) + : AnEmptyElement( "img" ) +{ + *this << new AnAttribute("src",i_sSrc) + << new AnAttribute("width",i_sWidth) + << new AnAttribute("height",i_sHeight) + << new AnAttribute("align",i_sAlign) + << new AnAttribute("border",i_sBorder); +} + +bool +Label::LineBreakAfterEndTag() const +{ + return true; +} + +bool +Paragraph::LineBreakAfterEndTag() const +{ + return true; +} + +const char * +Headline::sTags[6] = { "h1", "h2", "h3", "h4", "h5", "h6" }; + +bool +Headline::LineBreakAfterEndTag() const +{ + return true; +} + +#ifndef COMPATIBLE_NETSCAPE_47 +bool +LineBreak::LineBreakAfterBeginTag() const +{ + return true; +} +#endif + + +bool +TableCell::LineBreakAfterEndTag() const +{ + return true; +} + + + +TableCell & +TableRow::AddCell( DYN Item * let_dpItem ) +{ + return PushElem( *this, new TableCell, let_dpItem ); +} + +bool +TableRow::LineBreakAfterBeginTag() const +{ + return true; +} + + +Table::Table( const csv::String & i_sBorder, + const csv::String & i_sWidth, + const csv::String & i_sCellPadding, + const csv::String & i_sCellSpacing ) + : csi::xml::AnElement("table") +{ + if ( i_sBorder.length() > 0 ) + *this << new AnAttribute("border",i_sBorder); + if ( i_sBorder.length() > 0 ) + *this << new AnAttribute("width",i_sWidth); + if ( i_sBorder.length() > 0 ) + *this << new AnAttribute("cellpadding",i_sCellPadding); + if ( i_sBorder.length() > 0 ) + *this << new AnAttribute("cellspacing",i_sCellSpacing); +} + +TableRow & +Table::AddRow() +{ + TableRow * ret = new TableRow; + *this << ret; + return *ret; +} + +bool +Table::FinishEmptyTag_XmlStyle() const +{ + return false; +} + +bool +Table::LineBreakAfterBeginTag() const +{ + return true; +} + + + +bool +DefListTerm::LineBreakAfterEndTag() const +{ + return true; +} + +bool +DefListDefinition::LineBreakAfterEndTag() const +{ + return true; +} + + + + + +DefListTerm & +DefList::AddTerm( DYN csi::xml::Item* let_dpItem ) +{ + return PushElem( *this, new DefListTerm, let_dpItem ); +} + +DefListDefinition & +DefList::AddDefinition( DYN csi::xml::Item* let_dpItem ) +{ + return PushElem( *this, new DefListDefinition, let_dpItem ); +} + +bool +DefList::LineBreakAfterBeginTag() const +{ + return true; +} + + + +bool +ListItem::LineBreakAfterEndTag() const +{ + return true; +} + + + + +ListItem & +NumeratedList::AddItem( DYN csi::xml::Item* let_dpItem ) +{ + return PushElem( *this, new ListItem, let_dpItem ); +} + +bool +NumeratedList::LineBreakAfterBeginTag() const +{ + return true; +} + + +ListItem & +SimpleList::AddItem( DYN csi::xml::Item* let_dpItem ) +{ + return PushElem( *this, new ListItem, let_dpItem ); +} + +bool +SimpleList::LineBreakAfterBeginTag() const +{ + return true; +} + + + +} // namespace html +} // namespace csi + + + + + diff --git a/udm/source/html/makefile.mk b/udm/source/html/makefile.mk new file mode 100644 index 000000000000..01765af93cfd --- /dev/null +++ b/udm/source/html/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:32:37 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=udm +TARGET=csi_html + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true + + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/htmlitem.obj + + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/udm/source/inc/precomp.h b/udm/source/inc/precomp.h new file mode 100644 index 000000000000..85f027abe4bb --- /dev/null +++ b/udm/source/inc/precomp.h @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: precomp.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:32:37 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef __ADC_PRECOMP_H_06071998__ +#define __ADC_PRECOMP_H_06071998__ + + +// For en/disabling csv_assertions: +#ifndef DEBUG +#define CSV_NO_ASSERTIONS +#endif + +#ifdef NP_LOCALBUILD +#pragma warning( disable : 4786 ) +#endif + +#include <cosv/csv_precomp.h> + +#include <vector> +#include <map> + + + +// Shortcuts to access csv::-types: +// using csv::String; +// using csv::StringVector; +using csv::StreamStr; +using csv::ios; +using csv::ostream; +using csv::c_str; +typedef csv::StreamStrLock StreamLock; + + + +/** @attention + Has to be changed to returning csv::Cout(),if + 1) iostreams are not used ( #ifdef CSV_NO_IOSTREAM ) + 2) used for an GUI-application. +*/ +inline ostream & +Cout() { return csv::Cout(); } + +/** @attention + Has to be changed to returning csv::Cerr(),if + 1) iostreams are not used ( #ifdef CSV_NO_IOSTREAM ) + 2) used for an GUI-application. +*/ +inline ostream & +Cerr() { return csv::Cerr(); } + + +inline csv::F_FLUSHING_FUNC +Endl() { return csv::Endl; } +inline csv::F_FLUSHING_FUNC +Flush() { return csv::Flush; } + + + +#endif + + diff --git a/udm/source/mkinc/fullcpp.mk b/udm/source/mkinc/fullcpp.mk new file mode 100644 index 000000000000..b3e9dabe3db8 --- /dev/null +++ b/udm/source/mkinc/fullcpp.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# $RCSfile: fullcpp.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:32:37 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + + + +# --- Settings ----------------------------------------------------- +# Has to be included AFTER settings.mk ! + + +# Precompiled header: + + +.IF "$(GUI)"=="WNT" + +# RTTI +CFLAGS+= /GR + +.IF "$(NP_LOCALBUILD)"!="" + + +# Precompiled Headers +PCH_NAME= udm +.IF "$(DEBUG)"=="" +CFLAGS+= -YX"precomp.h" /Fp$(PRJ)$/$(INPATH)$/misc$/$(PCH_NAME).pch +.ELSE +CFLAGS+= -YX"precomp.h" /Fp$(PRJ)$/$(INPATH)$/misc$/$(PCH_NAME).pcd -DNP_LOCALBUILD +.ENDIF + +.ENDIF + +.ENDIF + diff --git a/udm/source/unittest/makefile.mk b/udm/source/unittest/makefile.mk new file mode 100644 index 000000000000..e51e154a4630 --- /dev/null +++ b/udm/source/unittest/makefile.mk @@ -0,0 +1,108 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:32:38 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=cosv +TARGET=udm_unittest +TARGETTYPE=CUI + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : static.mk + +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/test.obj + + + + +APP1TARGET= $(TARGET) +APP1STACK= 1000000 +APP1OBJS= $(OBJ)$/test.obj + +APP1STDLIBS= $(STATIC_LIBS) msvcirt.lib cosv.lib + + +APP1LIBS= $(LB)$/$(TARGET).lib + + +APP1DEPN= $(LB)$/$(TARGET).lib $(L)$/cosv.lib + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/udm/source/unittest/test.cxx b/udm/source/unittest/test.cxx new file mode 100644 index 000000000000..8423d4993657 --- /dev/null +++ b/udm/source/unittest/test.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * $RCSfile: test.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:32:38 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> + + +// NOT FULLY DEFINED SERVICES +#include <udm/integer_i.hxx> +#include <udm/string_i.hxx> + +using namespace udm; + +// TypeSystem aTypeSys; + + +class Function +{ + public: + + intt nId; +}; + +class Ctor : public Function +{ + public: + + csv::String sClassName; +}; + +class Method : public Function +{ + public: + + csv::String sFunctionName; + std::vector< std::pair< intt, String > > + aParameters; +}; + + +class PrObj +{ + public: + intt nId; + csv::String sName; + std::vector< PrObj* > + aMethods; + std::vector< PrObj* > + aData; +}; + + + + +void fx() +{ + intt n = 5; + Dyn<Integer_i> px = new Integer_i(n); + Integer & x = *px; + + csv::String s; + Dyn<String_i> ps = new String_i(s); + String & xs = *ps; + + xs = "Hallo"; + + int dev01 = 2; + + xs = csv::String("Haha"); + + dev01 = 2; + + csv::String s2 = xs; + + + dev01 = 2; + +// const char * pc = xs; + + + intt a = x; + x = 15; + + Cout() << a << " " << x << Endl(); // Must be: 5 15 +} + + + + diff --git a/udm/source/xml/makefile.mk b/udm/source/xml/makefile.mk new file mode 100644 index 000000000000..d9dcce6b2c43 --- /dev/null +++ b/udm/source/xml/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:32:38 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=udm +TARGET=csi_xml + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true + + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/xmlitem.obj + + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/udm/source/xml/xmlitem.cxx b/udm/source/xml/xmlitem.cxx new file mode 100644 index 000000000000..c9ea5b76fa32 --- /dev/null +++ b/udm/source/xml/xmlitem.cxx @@ -0,0 +1,613 @@ +/************************************************************************* + * + * $RCSfile: xmlitem.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:32:38 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <udm/xml/xmlitem.hxx> + +// NOT FULLY DECLARED SERVICES +#include <cosv/file.hxx> + + +namespace csi +{ +namespace xml +{ + +char cReplacable[256] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, // ", & + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 99 + 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, // <, > + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 100 - 149 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 1 // + }; + + +class MultiItem : public Item +{ + public: + MultiItem(); + ~MultiItem(); + + void Add( + DYN Item * let_dpDatum ) + { csv_assert( let_dpDatum != 0 ); + aItems.push_back(let_dpDatum); } + void Erase() { aItems.erase_all(); } + + private: + virtual void do_WriteOut( + csv::bostream & io_aFile ) const; + // DATA + ItemList aItems; +}; + + +void StreamOut( + Dyn< Item > & o_rContent, + DYN Item * let_dpItem ); +inline void +StreamOut( AttrList & o_rAttrs, + DYN Attribute * let_dpAttr ) +{ + csv_assert( let_dpAttr != 0 ); + o_rAttrs.push_back( let_dpAttr ); +} + + +inline void +Impl_SetContent( Dyn< Item > & o_rContent, + DYN Item * let_dpItem ) +{ + o_rContent = let_dpItem; +} + + +//********************* Attribute ****************************// + +const csv::String attrValueBegin("=\""); +const csv::String attrValueEnd("\""); + +void +Attribute::WriteOut( csv::bostream & io_aFile ) const +{ + io_aFile.write( Name() ); + if ( Value().length() > 0 ) + { + io_aFile.write( attrValueBegin ); + io_aFile.write( Value() ); + io_aFile.write( attrValueEnd ); + } +} + + + +//************************ Element ****************************// + +const csv::String newline("\n"); +const csv::String space(" "); +const csv::String beginTagBegin("<"); +const csv::String endTagBegin("</"); +const csv::String tagEnd(">"); +const csv::String emptyTagEnd("/>"); + +void +Element::do_WriteOut( csv::bostream & io_aFile ) const +{ + io_aFile.write( beginTagBegin ); + io_aFile.write( inq_TagName() ); + + const AttrList * pAttrs = inq_Attrs(); + if ( pAttrs != 0 ) + { + for ( AttrList::iterator it = pAttrs->begin(); + it != pAttrs->end(); + ++it ) + { + + io_aFile.write( space ); + (*it)->WriteOut( io_aFile ); + } + } + + const Item * pContent = inq_Content(); + if ( pContent != 0 ) + io_aFile.write( tagEnd ); + else + { + if (FinishEmptyTag_XmlStyle()) + io_aFile.write( emptyTagEnd ); + else + { + io_aFile.write( tagEnd ); + io_aFile.write( endTagBegin ); + io_aFile.write( inq_TagName() ); + io_aFile.write( tagEnd ); + } + } + if ( LineBreakAfterBeginTag() ) + io_aFile.write( newline ); + if ( pContent == 0 ) + return; + + pContent->WriteOut( io_aFile ); + io_aFile.write( endTagBegin ); + io_aFile.write( inq_TagName() ); + io_aFile.write( tagEnd ); + if ( LineBreakAfterEndTag() ) + io_aFile.write( newline ); +} + +bool +Element::FinishEmptyTag_XmlStyle() const +{ + return true; +} + +bool +Element::LineBreakAfterBeginTag() const +{ + return false; +} + +bool +Element::LineBreakAfterEndTag() const +{ + return LineBreakAfterBeginTag(); +} + + +//************************ EmptyElement ****************************// + +void +EmptyElement::op_streamout( DYN Item * ) +{ + // Does nothing. +} + +void +EmptyElement::op_streamout( DYN Attribute * let_dpAttr ) +{ + StreamOut( inq_RefAttrs(), let_dpAttr ); +} + +void +EmptyElement::do_SetContent( DYN Item * ) +{ + // Does nothing. +} + +const Item * +EmptyElement::inq_Content() const +{ + return 0; +} + +const AttrList * +EmptyElement::inq_Attrs() const +{ + return &inq_RefAttrs(); +} + + +//************************ PureElement ****************************// + +void +PureElement::op_streamout( DYN Item * let_dpItem ) +{ + StreamOut( inq_RefContent(), let_dpItem ); +} + +void +PureElement::op_streamout( DYN Attribute * ) +{ + // Does nothing. +} + +void +PureElement::do_SetContent( DYN Item * let_dpItem ) +{ + Impl_SetContent( inq_RefContent(), let_dpItem ); +} + +const Item * +PureElement::inq_Content() const +{ + return inq_RefContent().Ptr(); +} + +const AttrList * +PureElement::inq_Attrs() const +{ + return 0; +} + + +//*************************** SglTag **************************// + +void +SglTag::op_streamout( DYN Item * ) +{ + // Does nothing. +} + +void +SglTag::op_streamout( DYN Attribute * ) +{ + // Does nothing. +} + +void +SglTag::do_SetContent( DYN Item *) +{ + // Does nothing. +} + +const Item * +SglTag::inq_Content() const +{ + return 0; +} + +const AttrList * +SglTag::inq_Attrs() const +{ + return 0; +} + + +//*************************** AnElement **************************// + +AnElement::AnElement( const csv::String & i_sTagName ) + : sTagName( i_sTagName ) + // pContent, + // aAttrs +{ +} + +AnElement::~AnElement() +{ +} + +void +AnElement::op_streamout( DYN Item * let_dpItem ) +{ + StreamOut( pContent, let_dpItem ); +} + +void +AnElement::op_streamout( DYN Attribute * let_dpAttr ) +{ + StreamOut( aAttrs, let_dpAttr ); +} + +void +AnElement::do_SetContent( DYN Item * let_dpItem ) +{ + Impl_SetContent( pContent, let_dpItem ); +} + +const csv::String & +AnElement::inq_TagName() const +{ + return sTagName; +} + +const Item * +AnElement::inq_Content() const +{ + return pContent.Ptr(); +} + +const AttrList * +AnElement::inq_Attrs() const +{ + return &aAttrs; +} + + +//*************************** AnEmptyElement **************************// + +AnEmptyElement::AnEmptyElement( const csv::String & i_sTagName ) + : sTagName( i_sTagName ) + // aAttrs +{ +} + +AnEmptyElement::~AnEmptyElement() +{ + +} + +const csv::String & +AnEmptyElement::inq_TagName() const +{ + return sTagName; +} + +AttrList & +AnEmptyElement::inq_RefAttrs() +{ + return aAttrs; +} + + +//*************************** APureElement **************************// + +APureElement::APureElement( const csv::String & i_sTagName ) + : sTagName( i_sTagName ) + // pContent +{ +} + +APureElement::~APureElement() +{ +} + +const csv::String & +APureElement::inq_TagName() const +{ + return sTagName; +} + +Dyn< Item > & +APureElement::inq_RefContent() +{ + return pContent; +} + + + +//*************************** ASglTag **************************// + +ASglTag::ASglTag( const csv::String & i_sTagName ) + : sTagName( i_sTagName ) +{ +} + +ASglTag::~ASglTag() +{ +} + +const csv::String & +ASglTag::inq_TagName() const +{ + return sTagName; +} + + +//*************************** AnAttribute **************************// +AnAttribute::AnAttribute( const csv::String & i_sName, + const csv::String & i_sValue ) + : sName(i_sName), + sValue(i_sValue) +{ +} + +AnAttribute::~AnAttribute() +{ +} + +const csv::String & +AnAttribute::inq_Name() const +{ + return sName; +} + +const csv::String & +AnAttribute::inq_Value() const +{ + return sValue; +} + + + +//*************************** Text **************************// + +Text::Text( const csv::String & i_sText ) + : sText(i_sText) +{ +} + +Text::Text( const char * i_sText ) + : sText(i_sText) +{ +} + +Text::~Text() +{ +} + +void +Text::do_WriteOut( csv::bostream & io_aFile ) const +{ + const char * pStart = sText.c_str(); + const char * pOut = 0; + + for ( pOut = pStart ; *pOut != '\0'; ++pOut ) + { + if ( cReplacable[*pOut] ) + { + if ( pOut != pStart ) + { + io_aFile.write( pStart, pOut-pStart ); + } + + switch (UINT8(*pOut)) + { + case '<': io_aFile.write("<"); break; + case '>': io_aFile.write(">"); break; + case '"': io_aFile.write("""); break; + case '&': io_aFile.write("&"); break; + case 255: io_aFile.write(" "); break; + } + + pStart = pOut+1; + } // endif (cReplacable[*pOut]) + } // end for + + if ( pOut != pStart ) + { + io_aFile.write( pStart, pOut-pStart ); + } +} + + +//*************************** XmlCode **************************// + +XmlCode::XmlCode( const csv::String & i_sText ) + : sText(i_sText) +{ +} + +XmlCode::~XmlCode() +{ +} + +void +XmlCode::do_WriteOut( csv::bostream & io_aFile ) const +{ + io_aFile.write(sText); +} + + +//*************************** MultiItem **************************// + +MultiItem::MultiItem() +{ +} + +MultiItem::~MultiItem() +{ +} + +void +MultiItem::do_WriteOut( csv::bostream & io_aFile ) const +{ + ItemList::iterator itEnd = aItems.end(); + + for ( ItemList::iterator it = aItems.begin(); + it != itEnd; + ++it ) + { + (*it)->WriteOut( io_aFile ); + } + +} + + + +//*************************** Helpers **************************// + +void +StreamOut( Dyn< Item > & o_rContent, + DYN Item * let_dpItem ) +{ + MultiItem * pContent = 0; + if ( bool(o_rContent) ) + { + pContent = static_cast< MultiItem* >( o_rContent.MutablePtr() ); + csv_assert( dynamic_cast< MultiItem* >( o_rContent.MutablePtr() ) != 0 ); + } + else + { + pContent = new MultiItem; + o_rContent = pContent; + } + + csv_assert( let_dpItem != 0 ); + pContent->Add( let_dpItem ); +} + + + + +} // namespace xml +} // namespace csi + + + diff --git a/udm/util/makefile.mk b/udm/util/makefile.mk new file mode 100644 index 000000000000..03f4ea5fb0d1 --- /dev/null +++ b/udm/util/makefile.mk @@ -0,0 +1,92 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:32:38 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=.. + +PRJNAME=udm +TARGET=udm + +ENABLE_EXCEPTIONS=true + + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + + +# --- Files -------------------------------------------------------- + +LIB1FILES= \ + $(LB)$/csi_html.lib \ + $(LB)$/udm_udm.lib \ + $(LB)$/csi_xml.lib + + +# --- Targets ------------------------------------------------------ + +LIB1TARGET= $(LB)$/$(TARGET).lib +LIB1ARCHIV= $(LB)$/a$(TARGET).a + + +.INCLUDE : target.mk + + |