TagLib  2.2.1
ebmlfloatelement.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2025 by Urs Fleisch
3  email : ufleisch@users.sourceforge.net
4  ***************************************************************************/
5 
6 /***************************************************************************
7  * This library is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU Lesser General Public License version *
9  * 2.1 as published by the Free Software Foundation. *
10  * *
11  * This library is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the Free Software *
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19  * 02110-1301 USA *
20  * *
21  * Alternatively, this file is available under the Mozilla Public *
22  * License Version 1.1. You may obtain a copy of the License at *
23  * http://www.mozilla.org/MPL/ *
24  ***************************************************************************/
25 
26 #ifndef TAGLIB_EBMLFLOATELEMENT_H
27 #define TAGLIB_EBMLFLOATELEMENT_H
28 #ifndef DO_NOT_DOCUMENT
29 
30 #include <variant>
31 #include "ebmlelement.h"
32 
33 namespace TagLib {
34  class File;
35 
36  namespace EBML {
37  class FloatElement : public Element
38  {
39  public:
40  using FloatVariantType = std::variant<std::monostate, float, double>;
41 
42  FloatElement(Id id, int sizeLength, offset_t dataSize);
43  FloatElement(Id id, int sizeLength, offset_t dataSize, offset_t);
44  explicit FloatElement(Id id);
45 
46  FloatVariantType getValue() const;
47  double getValueAsDouble(double defaultValue = 0.0) const;
48  void setValue(FloatVariantType val);
49  bool read(File &file) override;
50  ByteVector render() override;
51 
52  private:
53  FloatVariantType value;
54  };
55  }
56 }
57 
58 #endif
59 #endif
off_t offset_t
Definition: taglib.h:64
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41