LibreOffice Module sc (master)  1
unitconv.hxx
Go to the documentation of this file.
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_SC_INC_UNITCONV_HXX
21 #define INCLUDED_SC_INC_UNITCONV_HXX
22 
23 #include <rtl/ustring.hxx>
24 
25 #include <map>
26 
28 {
29  OUString maIndexString;
30  double mfValue;
31 
32 public:
33  ScUnitConverterData(const OUString& rFromUnit, const OUString& rToUnit, double fValue);
34  ScUnitConverterData(const ScUnitConverterData&) = default;
36 
37  double GetValue() const { return mfValue; }
38  const OUString& GetIndexString() const { return maIndexString; }
39 
40  static OUString BuildIndexString(const OUString& rFromUnit, const OUString& rToUnit);
41 };
42 
44 {
45  typedef std::map<OUString, ScUnitConverterData> MapType;
46  MapType maData;
47 
48 public:
50  ScUnitConverter(const ScUnitConverter&) = delete;
51  const ScUnitConverter& operator=(const ScUnitConverter&) = delete;
53 
54  bool GetValue(double& fValue, const OUString& rFromUnit, const OUString& rToUnit) const;
55 };
56 
57 #endif
58 
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScUnitConverterData(const OUString &rFromUnit, const OUString &rToUnit, double fValue)
Definition: unitconv.cxx:32
MapType maData
Definition: unitconv.hxx:46
std::map< OUString, ScUnitConverterData > MapType
Definition: unitconv.hxx:45
double GetValue() const
Definition: unitconv.hxx:37
OUString maIndexString
Definition: unitconv.hxx:29
const ScUnitConverter & operator=(const ScUnitConverter &)=delete
bool GetValue(double &fValue, const OUString &rFromUnit, const OUString &rToUnit) const
Definition: unitconv.cxx:103
static OUString BuildIndexString(const OUString &rFromUnit, const OUString &rToUnit)
Definition: unitconv.cxx:37
const OUString & GetIndexString() const
Definition: unitconv.hxx:38
ScUnitConverterData & operator=(const ScUnitConverterData &)=delete