id3lib  3.8.3
io_helpers.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: io_helpers.h,v 1.7 2002/06/29 17:43:19 t1mpy Exp $
3 
4 // id3lib: a software 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_IO_HELPERS_H_
29 #define _ID3LIB_IO_HELPERS_H_
30 
31 #include "id3/id3lib_strings.h"
32 #include "reader.h"
33 #include "writer.h"
34 
35 namespace dami
36 {
37  namespace io
38  {
42  {
43  ID3_Reader& _reader;
45  bool _locked;
46  public:
48  : _reader(rdr), _pos(rdr.getCur()), _locked(true)
49  { ; }
51  : _reader(rdr), _pos(pos)
52  { ; }
53  virtual ~ExitTrigger() { if (_locked) _reader.setCur(_pos); }
54 
55  void release() { _locked = false; }
56  void update() { _pos = _reader.getCur(); }
57  void setExitPos(ID3_Reader::pos_type pos) { _pos = pos; }
58  };
59 
61  ID3_C_EXPORT String readText(ID3_Reader&, size_t);
63  ID3_C_EXPORT String readUnicodeText(ID3_Reader&, size_t);
65  ID3_C_EXPORT BString readBinary(ID3_Reader&, size_t);
66  ID3_C_EXPORT uint32 readLENumber(ID3_Reader&, size_t);
67  ID3_C_EXPORT uint32 readBENumber(ID3_Reader&, size_t);
70 
71  ID3_C_EXPORT size_t writeString(ID3_Writer&, String);
72  ID3_C_EXPORT size_t writeText(ID3_Writer&, String);
73  ID3_C_EXPORT size_t writeUnicodeString(ID3_Writer&, String, bool = true);
74  ID3_C_EXPORT size_t writeUnicodeText(ID3_Writer&, String, bool = true);
75  ID3_C_EXPORT size_t writeBENumber(ID3_Writer&, uint32 val, size_t);
76  ID3_C_EXPORT size_t writeTrailingSpaces(ID3_Writer&, String, size_t);
77  ID3_C_EXPORT size_t writeUInt28(ID3_Writer&, uint32);
78  };
79 };
80 
81 #endif /* _ID3LIB_IO_HELPERS_H_ */
82 
ID3_C_EXPORT uint32 readUInt28(ID3_Reader &)
Definition: io_helpers.cpp:266
ID3_C_EXPORT uint32 readLENumber(ID3_Reader &, size_t)
Definition: io_helpers.cpp:217
ID3_C_EXPORT String readString(ID3_Reader &)
Definition: io_helpers.cpp:35
virtual ~ExitTrigger()
Definition: io_helpers.h:53
ID3_C_EXPORT String readUnicodeText(ID3_Reader &, size_t)
Definition: io_helpers.cpp:159
void setExitPos(ID3_Reader::pos_type pos)
Definition: io_helpers.h:57
#define ID3_CPP_EXPORT
Definition: globals.h:79
ID3_C_EXPORT size_t writeUnicodeText(ID3_Writer &, String, bool=true)
Definition: io_helpers.cpp:353
ID3_C_EXPORT size_t writeUInt28(ID3_Writer &, uint32)
Definition: io_helpers.cpp:307
ID3_C_EXPORT size_t writeUnicodeString(ID3_Writer &, String, bool=true)
Definition: io_helpers.cpp:345
ID3_C_EXPORT size_t writeText(ID3_Writer &, String)
Definition: io_helpers.cpp:338
ExitTrigger(ID3_Reader &rdr, ID3_Reader::pos_type pos)
Definition: io_helpers.h:50
Definition: tag_impl.h:41
ID3_C_EXPORT String readUnicodeString(ID3_Reader &)
Definition: io_helpers.cpp:125
ID3_C_EXPORT size_t writeString(ID3_Writer &, String)
Definition: io_helpers.cpp:331
ID3_C_EXPORT uint32 readBENumber(ID3_Reader &, size_t)
Definition: io_helpers.cpp:231
ID3_C_EXPORT size_t writeTrailingSpaces(ID3_Writer &, String, size_t)
Definition: io_helpers.cpp:294
#define ID3_C_EXPORT
This file defines common macros, types, constants, and enums used throughout id3lib.
Definition: globals.h:78
ID3_C_EXPORT String readTrailingSpaces(ID3_Reader &, size_t)
Definition: io_helpers.cpp:243
ID3_C_EXPORT BString readBinary(ID3_Reader &, size_t)
Definition: io_helpers.cpp:199
ExitTrigger(ID3_Reader &rdr)
Definition: io_helpers.h:47
ID3_C_EXPORT String readText(ID3_Reader &, size_t)
Definition: io_helpers.cpp:50
ID3_C_EXPORT size_t writeBENumber(ID3_Writer &, uint32 val, size_t)
Definition: io_helpers.cpp:286
uint32 pos_type
Definition: reader.h:38
ID3_C_EXPORT BString readAllBinary(ID3_Reader &)
Definition: io_helpers.cpp:194