xref: /trunk/main/xml2cmp/source/x2cclass/xml_cdff.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef UDKSERVICE_XML_CDFF_HXX
29 #define UDKSERVICE_XML_CDFF_HXX
30 
31 
32 #include <tools/string.hxx>
33 #include "xml_cd.hxx"
34 
35 class ComponentDescriptionImpl;
36 
37 
38 /** @descr
39     Is able to parse an XML file with Component descriptions. Gives access
40     to the parsed data.
41 
42     Use:
43         CompDescrsFromAnXmlFile aCds;
44         UniString aFilepath(...);
45         if (! aCds.Parse(aFilepath) )
46         {
47             // react on:
48             aCds.Status();
49         }
50 
51         With operator[] you get access to ComponentDescriptions
52         on indices 0 to NrOfDescriptions()-1 .
53 
54         For further handling see class ComponentDescription
55         in xml_cd.hxx .
56 
57         It is possible to parse more than one time. Then the old data
58         are discarded.
59 **/
60 class CompDescrsFromAnXmlFile
61 {
62   public:
63     enum E_Status
64     {
65         ok = 0,
66         not_yet_parsed,
67         cant_read_file,
68         inconsistent_file,
69         no_tag_found_in_file
70     };
71 
72     //  LIFECYCLE
73                         CompDescrsFromAnXmlFile();
74                         ~CompDescrsFromAnXmlFile();
75 
76     //  OPERATIONS
77     BOOL                Parse(
78                             const UniString &   i_sXmlFilePath );
79 
80     //  INQUIRY
81     INT32               NrOfDescriptions() const;
82     const ComponentDescription &
83                         operator[](             /// @return an empty description, if index does not exist.
84                             INT32               i_nIndex ) const;
85     CompDescrsFromAnXmlFile::E_Status
86                         Status() const;
87 
88   private:
89     // PRIVATE SERVICES
90     void                Empty();
91 
92     // DATA
93     std::vector< ComponentDescriptionImpl* >    *
94                         dpDescriptions;
95     E_Status            eStatus;
96 };
97 
98 
99 
100 
101 
102 #endif
103 
104 
105