id3lib 3.8.3
flags.h
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: flags.h,v 1.1 2000/10/24 16:22:47 eldamitri Exp $
3
4// id3lib: a C++ library for creating and manipulating id3v1/v2 tags
5// Copyright 1999, 2000 Scott Thomas Haug
6
7// This library is free software; you can redistribute it and/or modify it
8// under the terms of the GNU Library General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or (at your
10// option) any later version.
11//
12// This library is distributed in the hope that it will be useful, but WITHOUT
13// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15// License for more details.
16//
17// You should have received a copy of the GNU Library General Public License
18// along with this library; if not, write to the Free Software Foundation,
19// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21// The id3lib authors encourage improvements and optimisations to be sent to
22// the id3lib coordinator. Please see the README file for details on where to
23// send such submissions. See the AUTHORS file for a list of people who have
24// contributed to id3lib. See the ChangeLog file for a list of changes to
25// id3lib. These files are distributed with id3lib at
26// http://download.sourceforge.net/id3lib/
27
28#ifndef _ID3LIB_FLAGS_H_
29#define _ID3LIB_FLAGS_H_
30
31#include "flags.h"
32
34{
35public:
36 typedef flags_t TYPE;
37
38 ID3_Flags() : _f(0) { ; }
39 virtual ~ID3_Flags() { ; }
40
41 TYPE get() const { return _f; }
42 bool test(TYPE f) const { return (this->get() & f) == f; }
43 bool set(TYPE f) { bool r = (_f != f); _f = f; return r; }
44 bool add(TYPE f) { return this->set(this->get() | f); }
45 bool remove(TYPE f) { return this->set(this->get() & ~f); }
46 bool clear() { return this->set(0); }
47 bool set(TYPE f, bool b){ if (b) return this->add(f); return this->remove(f); }
48
50 { if (this != &f) { this->set(f.get()); } return *this; }
51
52private:
53 TYPE _f;
54};
55
56#endif /* _ID3LIB_FLAGS_H_ */
TYPE get() const
Definition flags.h:41
bool clear()
Definition flags.h:46
flags_t TYPE
Definition flags.h:36
bool test(TYPE f) const
Definition flags.h:42
bool set(TYPE f)
Definition flags.h:43
ID3_Flags & operator=(const ID3_Flags &f)
Definition flags.h:49
bool remove(TYPE f)
Definition flags.h:45
bool set(TYPE f, bool b)
Definition flags.h:47
ID3_Flags()
Definition flags.h:38
virtual ~ID3_Flags()
Definition flags.h:39
bool add(TYPE f)
Definition flags.h:44
uint16 flags_t
Definition globals.h:118

Generated for id3lib by doxygen 1.10.0