kwave  18.07.70
SampleFormat.h
Go to the documentation of this file.
1 /***************************************************************************
2  SampleFormat.h - Map for all known sample formats
3  -------------------
4  begin : Sun Jul 28 2002
5  copyright : (C) 2002 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SAMPLE_FORMAT_H
19 #define SAMPLE_FORMAT_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 
25 #include "libkwave/TypesMap.h"
26 
27 namespace Kwave
28 {
29 
30  class Q_DECL_EXPORT SampleFormat
31  {
32  public:
38  typedef enum {
39  Unknown = -1,
40  Signed = 401,
41  Unsigned = 402,
42  Float = 403,
43  Double = 404
44  } Format;
45 
47  SampleFormat() { assign(Unknown); }
48 
50  explicit SampleFormat(const Format x) { assign(x); }
51 
53  SampleFormat(const SampleFormat &f) { assign(f); }
54 
56  virtual ~SampleFormat() {}
57 
59  inline operator Format() const { return m_format; }
60 
62  inline void assign(Format f) { m_format = f; }
63 
65  inline bool operator == (const Format &f) const {
66  return (f == m_format);
67  }
68 
70  inline int toInt() const { return static_cast<int>(m_format); }
71 
73  void fromInt(int i);
74 
75  private:
76 
79 
80  public:
81 
83  class Q_DECL_EXPORT Map: public Kwave::TypesMap<int, Format>
84  {
85  public:
87  explicit Map();
88 
90  virtual ~Map() Q_DECL_OVERRIDE;
91 
93  virtual void fill() Q_DECL_OVERRIDE;
94  };
95 
96  };
97 }
98 
99 #endif /* SAMPLE_FORMAT_H */
100 
101 //***************************************************************************
102 //***************************************************************************
Definition: App.h:33
virtual ~SampleFormat()
Definition: SampleFormat.h:56
SampleFormat(const SampleFormat &f)
Definition: SampleFormat.h:53
SampleFormat(const Format x)
Definition: SampleFormat.h:50
void assign(Format f)
Definition: SampleFormat.h:62
int toInt() const
Definition: SampleFormat.h:70