1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xml_cdim.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef UDKSERVICE_XML_CDIM_HXX
32 #define UDKSERVICE_XML_CDIM_HXX
36 #include <tools/string.hxx>
42 /** Represents one of the Component descriptions in an XML file.
43 Implements ComponentDescription and does part of the parsing for class CompDescrsFromAnXmlFile.
45 class ComponentDescriptionImpl
: public ComponentDescription
48 class ValueList
: public std::vector
< ByteString
>
56 const char * BeginTag() const;
58 const char * i_pTextPosition
) const;
59 INT32
EndTagLength() const;
61 static const ValueList
&
68 ComponentDescriptionImpl();
69 virtual ~ComponentDescriptionImpl();
72 ValueList
* GetBeginTag(
73 ByteString
& o_sValue
,
74 const char * & io_pStartOfTag
) const;
75 static void ParseUntilStartOfDescription(
76 const char * & io_pBufferPosition
);
77 static BOOL
CheckEndOfDescription(
78 const char * & io_pBufferPosition
);
80 static INT32
DescriptionEndTagSize();
82 // INTERFACE ComponentDescription
84 virtual const std::vector
< ByteString
> &
85 DataOf( /// @return All values of this tag.
86 ComponentDescription::E_Tag
88 virtual ByteString
DatumOf( /// @return The only or the first value of this tag.
89 ComponentDescription::E_Tag
93 static const char C_sTagDescription
[];
94 static const char C_sStatus
[];
95 static const char * C_sSubTags
[ComponentDescription::tag_MAX
];
96 friend class ValueList
;
98 std::vector
< ValueList
* > // Dynamic allocated pointers.
104 ComponentDescriptionImpl::CheckEndOfDescription( const char * & io_pBufferPosition
)
105 { return strnicmp(io_pBufferPosition
+ 2, C_sTagDescription
, strlen(C_sTagDescription
)) == 0
106 && strncmp(io_pBufferPosition
, "</", 2) == 0
107 && * (io_pBufferPosition
+ 2 + strlen(C_sTagDescription
)) == '>'; }
110 ComponentDescriptionImpl::DescriptionEndTagSize()
111 { return strlen(C_sTagDescription
) + 3; }