nss: upgrade to release 3.73
[LibreOffice.git] / forms / source / xforms / convert.hxx
blob8d4555d580ec96d72df351f83a53b9d07c76b788
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_FORMS_SOURCE_XFORMS_CONVERT_HXX
21 #define INCLUDED_FORMS_SOURCE_XFORMS_CONVERT_HXX
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <map>
26 namespace com::sun::star::uno
28 class Any;
29 class Type;
32 namespace xforms
35 struct TypeLess
37 bool operator()( const css::uno::Type& rType1,
38 const css::uno::Type& rType2 ) const
39 { return rType1.getTypeName() < rType2.getTypeName(); }
42 class Convert
44 // hold conversion objects
45 typedef OUString (*fn_toXSD)( const css::uno::Any& );
46 typedef css::uno::Any (*fn_toAny)( const OUString& );
47 typedef std::pair<fn_toXSD,fn_toAny> Convert_t;
48 typedef std::map<css::uno::Type, Convert_t, TypeLess> Map_t;
49 Map_t maMap;
51 Convert();
53 void init();
55 public:
56 /** get/create Singleton class */
57 static Convert& get();
59 /// can we convert this type?
60 bool hasType( const css::uno::Type& );
62 /// get list of convertible types
63 css::uno::Sequence<css::uno::Type> getTypes() const;
65 /// convert any to XML representation
66 OUString toXSD( const css::uno::Any& rAny );
68 /// convert XML representation to Any of given type
69 css::uno::Any toAny( const OUString&, const css::uno::Type& );
71 /** replace all sequences of 0x08, 0x0A, 0x0D, 0x20 with a single 0x20.
72 also strip leading/trailing whitespace.
74 static OUString collapseWhitespace( const OUString& _rString );
77 } // namespace xforms
79 #endif
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */