Coverage Report

Created: 2026-06-09 09:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vlc/contrib/x86_64-unknown-linux-gnu/include/ebml/EbmlUInteger.h
Line
Count
Source
1
/****************************************************************************
2
** libebml : parse EBML files, see http://embl.sourceforge.net/
3
**
4
** <file/class description>
5
**
6
** Copyright (C) 2002-2010 Steve Lhomme.  All rights reserved.
7
**
8
** This file is part of libebml.
9
**
10
** This library is free software; you can redistribute it and/or
11
** modify it under the terms of the GNU Lesser General Public
12
** License as published by the Free Software Foundation; either
13
** version 2.1 of the License, or (at your option) any later version.
14
**
15
** This library is distributed in the hope that it will be useful,
16
** but WITHOUT ANY WARRANTY; without even the implied warranty of
17
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
** Lesser General Public License for more details.
19
**
20
** You should have received a copy of the GNU Lesser General Public
21
** License along with this library; if not, write to the Free Software
22
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23
**
24
** See http://www.gnu.org/licenses/lgpl-2.1.html for LGPL licensing information.
25
**
26
** Contact license@matroska.org if any conditions of this licensing are
27
** not clear to you.
28
**
29
**********************************************************************/
30
31
/*!
32
  \file
33
  \version \$Id$
34
  \author Steve Lhomme     <robux4 @ users.sf.net>
35
  \author Julien Coloos    <suiryc @ users.sf.net>
36
  \author Moritz Bunkus    <moritz @ bunkus.org>
37
*/
38
#ifndef LIBEBML_UINTEGER_H
39
#define LIBEBML_UINTEGER_H
40
41
#include "EbmlTypes.h"
42
#include "EbmlElement.h"
43
44
namespace libebml {
45
46
const int DEFAULT_UINT_SIZE = 0; ///< optimal size stored
47
48
/*!
49
    \class EbmlUInteger
50
    \brief Handle all operations on an unsigned integer EBML element
51
*/
52
class EBML_DLL_API EbmlUInteger : public EbmlElement {
53
  public:
54
    EbmlUInteger();
55
    EbmlUInteger(uint64 DefaultValue);
56
2.76k
    EbmlUInteger(const EbmlUInteger & ElementToClone) = default;
57
58
0
    EbmlUInteger & operator=(uint64 NewValue) {Value = NewValue; SetValueIsSet(); return *this;}
59
60
    /*!
61
      Set the default size of the integer (usually 1,2,4 or 8)
62
    */
63
0
    void SetDefaultSize(uint64 nDefaultSize = DEFAULT_UINT_SIZE) override {EbmlElement::SetDefaultSize(nDefaultSize); SetSize_(nDefaultSize);}
64
65
234k
    bool ValidateSize() const override {return IsFiniteSize() && (GetSize() <= 8);}
66
    filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false) override;
67
    filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
68
    filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false) override;
69
70
    bool IsSmallerThan(const EbmlElement *Cmp) const override;
71
72
    operator uint8()  const;
73
    operator uint16() const;
74
    operator uint32() const;
75
    operator uint64() const;
76
77
    EbmlUInteger &SetValue(uint64 NewValue);
78
    uint64 GetValue() const;
79
80
    void SetDefaultValue(uint64);
81
82
    uint64 DefaultVal() const;
83
84
0
    bool IsDefaultValue() const override {
85
0
      return (DefaultISset() && Value == DefaultValue);
86
0
    }
87
88
#if defined(EBML_STRICT_API)
89
    private:
90
#else
91
    protected:
92
#endif
93
    uint64 Value; /// The actual value of the element
94
    uint64 DefaultValue;
95
};
96
97
} // namespace libebml
98
99
#endif // LIBEBML_UINTEGER_H