xref: /AOO41X/main/xml2cmp/source/x2cclass/xml_cdff.hxx (revision dd7bc091be5d2f779fa787352b100cd34d3a1c9c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef UDKSERVICE_XML_CDFF_HXX
25 #define UDKSERVICE_XML_CDFF_HXX
26 
27 
28 #include <tools/string.hxx>
29 #include "xml_cd.hxx"
30 
31 class ComponentDescriptionImpl;
32 
33 
34 /** @descr
35     Is able to parse an XML file with Component descriptions. Gives access
36     to the parsed data.
37 
38     Use:
39         CompDescrsFromAnXmlFile aCds;
40         UniString aFilepath(...);
41         if (! aCds.Parse(aFilepath) )
42         {
43             // react on:
44             aCds.Status();
45         }
46 
47         With operator[] you get access to ComponentDescriptions
48         on indices 0 to NrOfDescriptions()-1 .
49 
50         For further handling see class ComponentDescription
51         in xml_cd.hxx .
52 
53         It is possible to parse more than one time. Then the old data
54         are discarded.
55 **/
56 class CompDescrsFromAnXmlFile
57 {
58   public:
59     enum E_Status
60     {
61         ok = 0,
62         not_yet_parsed,
63         cant_read_file,
64         inconsistent_file,
65         no_tag_found_in_file
66     };
67 
68     //  LIFECYCLE
69                         CompDescrsFromAnXmlFile();
70                         ~CompDescrsFromAnXmlFile();
71 
72     //  OPERATIONS
73     BOOL                Parse(
74                             const UniString &   i_sXmlFilePath );
75 
76     //  INQUIRY
77     INT32               NrOfDescriptions() const;
78     const ComponentDescription &
79                         operator[](             /// @return an empty description, if index does not exist.
80                             INT32               i_nIndex ) const;
81     CompDescrsFromAnXmlFile::E_Status
82                         Status() const;
83 
84   private:
85     // PRIVATE SERVICES
86     void                Empty();
87 
88     // DATA
89     std::vector< ComponentDescriptionImpl* >    *
90                         dpDescriptions;
91     E_Status            eStatus;
92 };
93 
94 
95 
96 
97 
98 #endif
99 
100 
101