merge the formfield patch from ooo-build
[ooovba.git] / xml2cmp / source / x2cclass / xml_cdim.hxx
blob91378f9bc2f133a488567beba902b6f3781fb29e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xml_cdim.hxx,v $
10 * $Revision: 1.3 $
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
35 #include "xml_cd.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.
44 **/
45 class ComponentDescriptionImpl : public ComponentDescription
47 public:
48 class ValueList : public std::vector< ByteString >
50 public:
51 // LIFECYCLE
52 ValueList(
53 E_Tag i_eTag )
54 : eTag(i_eTag) {}
55 // INQUIRY
56 const char * BeginTag() const;
57 BOOL MatchesEndTag(
58 const char * i_pTextPosition ) const;
59 INT32 EndTagLength() const;
61 static const ValueList &
62 Null_();
63 private:
64 E_Tag eTag;
67 // LIFECYCLE
68 ComponentDescriptionImpl();
69 virtual ~ComponentDescriptionImpl();
71 // OPERATIONS
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 );
79 // INQUIRY
80 static INT32 DescriptionEndTagSize();
82 // INTERFACE ComponentDescription
83 // INQUIRY
84 virtual const std::vector< ByteString > &
85 DataOf( /// @return All values of this tag.
86 ComponentDescription::E_Tag
87 i_eTag ) const;
88 virtual ByteString DatumOf( /// @return The only or the first value of this tag.
89 ComponentDescription::E_Tag
90 i_eTag ) const;
91 private:
92 // DATA
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.
99 aTags;
103 inline BOOL
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)) == '>'; }
109 inline INT32
110 ComponentDescriptionImpl::DescriptionEndTagSize()
111 { return strlen(C_sTagDescription) + 3; }
114 #endif