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 INCLUDED_CONFIGMGR_SOURCE_VALUEPARSER_HXX 25 #define INCLUDED_CONFIGMGR_SOURCE_VALUEPARSER_HXX 26 27 #include "sal/config.h" 28 29 #include <vector> 30 31 #include "boost/noncopyable.hpp" 32 #include "rtl/ref.hxx" 33 #include "rtl/string.hxx" 34 #include "rtl/ustring.hxx" 35 #include "xmlreader/pad.hxx" 36 #include "xmlreader/xmlreader.hxx" 37 38 #include "type.hxx" 39 40 namespace com { namespace sun { namespace star { namespace uno { 41 class Any; 42 } } } } 43 namespace xmlreader { struct Span; } 44 45 namespace configmgr { 46 47 class Node; 48 49 class ValueParser: private boost::noncopyable { 50 public: 51 ValueParser(int layer); 52 53 ~ValueParser(); 54 55 xmlreader::XmlReader::Text getTextMode() const; 56 57 bool startElement( 58 xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name); 59 60 bool endElement(); 61 62 void characters(xmlreader::Span const & text); 63 64 void start( 65 rtl::Reference< Node > const & property, 66 rtl::OUString const & localizedName = rtl::OUString()); 67 68 int getLayer() const; 69 70 Type type_; 71 rtl::OString separator_; 72 73 private: 74 template< typename T > com::sun::star::uno::Any convertItems(); 75 76 enum State { STATE_TEXT, STATE_TEXT_UNICODE, STATE_IT, STATE_IT_UNICODE }; 77 78 int layer_; 79 rtl::Reference< Node > node_; 80 rtl::OUString localizedName_; 81 State state_; 82 xmlreader::Pad pad_; 83 std::vector< com::sun::star::uno::Any > items_; 84 }; 85 86 } 87 88 #endif 89