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