LCOV - code coverage report
Current view: top level - forms/source/xforms - convert.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 2 0.0 %
Date: 2014-11-03 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_FORMS_SOURCE_XFORMS_CONVERT_HXX
      21             : #define INCLUDED_FORMS_SOURCE_XFORMS_CONVERT_HXX
      22             : 
      23             : #include <com/sun/star/uno/Sequence.hxx>
      24             : #include <map>
      25             : 
      26             : namespace com { namespace sun { namespace star { namespace uno
      27             : {
      28             :     class Any;
      29             :     class Type;
      30             : } } } }
      31             : 
      32             : namespace xforms
      33             : {
      34             : 
      35             : struct TypeLess
      36             : {
      37           0 :     bool operator()( const com::sun::star::uno::Type& rType1,
      38             :                      const com::sun::star::uno::Type& rType2 ) const
      39           0 :     { return rType1.getTypeName() < rType2.getTypeName(); }
      40             : };
      41             : 
      42             : class Convert
      43             : {
      44             :     typedef com::sun::star::uno::Type Type_t;
      45             :     typedef com::sun::star::uno::Sequence<com::sun::star::uno::Type> Types_t;
      46             :     typedef com::sun::star::uno::Any Any_t;
      47             : 
      48             :     // hold conversion objects
      49             :     typedef OUString (*fn_toXSD)( const Any_t& );
      50             :     typedef Any_t (*fn_toAny)( const OUString& );
      51             :     typedef std::pair<fn_toXSD,fn_toAny> Convert_t;
      52             :     typedef std::map<Type_t,Convert_t,TypeLess> Map_t;
      53             :     Map_t maMap;
      54             : 
      55             :     Convert();
      56             : 
      57             :     void init();
      58             : 
      59             : public:
      60             :     /** get/create Singleton class */
      61             :     static Convert& get();
      62             : 
      63             :     /// can we convert this type?
      64             :     bool hasType( const Type_t& );
      65             : 
      66             :     /// get list of convertible types
      67             :     Types_t getTypes();
      68             : 
      69             :     /// convert any to XML representation
      70             :     OUString toXSD( const Any_t& rAny );
      71             : 
      72             :     /// convert XML representation to Any of given type
      73             :     Any_t toAny( const OUString&, const Type_t& );
      74             : 
      75             :     /** replace all sequences of 0x08, 0x0A, 0x0D, 0x20 with a single 0x20.
      76             :         also strip leading/trailing whitespace.
      77             :     */
      78             :     static OUString collapseWhitespace( const OUString& _rString );
      79             : };
      80             : 
      81             : } // namespace xforms
      82             : 
      83             : #endif
      84             : 
      85             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10