~ubuntu-branches/ubuntu/maverick/libcdio/maverick

« back to all changes in this revision

Viewing changes to include/cdio++/cdio.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Nicolas Boullis
  • Date: 2007-10-04 00:52:35 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071004005235-4e3gdi4x2q2d14jx
Tags: 0.78.2+dfsg1-1
* Repack the source tarball to remove non-DFSG-free
  documentation. Thanks to Joerg Jaspert for pointing this.
* Also update debian/copyright to reflect the status of the removed
  documentation.
* Add libncurses5-dev | libncurses-dev to the build-dependencies, for
  cdda-player.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- C++ -*-
 
2
    $Id: cdio.hpp,v 1.12 2006/03/11 04:15:35 rocky Exp $
 
3
 
 
4
    Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
 
5
 
 
6
    This program is free software; you can redistribute it and/or modify
 
7
    it under the terms of the GNU General Public License as published by
 
8
    the Free Software Foundation; either version 2 of the License, or
 
9
    (at your option) any later version.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
    GNU General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU General Public License
 
17
    along with this program; if not, write to the Free Software
 
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
*/
 
20
 
 
21
/** \file cdio.hpp
 
22
 *
 
23
 *  \brief C++ class for libcdio: the CD Input and Control
 
24
 *  library. Applications use this for anything regarding libcdio.
 
25
 */
 
26
 
 
27
#ifndef __CDIO_HPP__
 
28
#define __CDIO_HPP__
 
29
 
 
30
#include <cdio/cdio.h>
 
31
#include <cdio/audio.h>
 
32
#include <cdio/dvd.h>
 
33
#include <cdio/mmc.h>
 
34
 
 
35
// Make pre- and post-increment operators for enums in libcdio where it 
 
36
// makes sense.
 
37
#include <cdio++/enum.hpp>
 
38
 
 
39
/** Class for driver exceptions. **/
 
40
class DriverOpException 
 
41
{
 
42
public:
 
43
  driver_return_code_t driver_return_code;
 
44
  DriverOpException( void ) { };
 
45
  DriverOpException( driver_return_code_t drc ) { 
 
46
    driver_return_code = drc; 
 
47
  };
 
48
  driver_return_code_t get_code(void) { 
 
49
    return driver_return_code; 
 
50
  };
 
51
  const char *get_msg(void) { 
 
52
    return cdio_driver_errmsg(driver_return_code); 
 
53
  };
 
54
};
 
55
 
 
56
class DriverOpError: public DriverOpException
 
57
{
 
58
public:
 
59
  DriverOpError(void) { driver_return_code = DRIVER_OP_ERROR; }
 
60
};
 
61
 
 
62
class DriverOpUnsupported: public DriverOpException 
 
63
 
64
public:
 
65
  DriverOpUnsupported(void) { driver_return_code = DRIVER_OP_UNSUPPORTED; }
 
66
};
 
67
 
 
68
class DriverOpUninit: public DriverOpException
 
69
{
 
70
public:
 
71
  DriverOpUninit(void) { driver_return_code = DRIVER_OP_UNINIT; }
 
72
};
 
73
 
 
74
class DriverOpNotPermitted: public DriverOpException
 
75
{
 
76
public:
 
77
  DriverOpNotPermitted(void) {driver_return_code = DRIVER_OP_NOT_PERMITTED;}
 
78
};
 
79
 
 
80
class DriverOpBadParameter: public DriverOpException
 
81
{
 
82
public:
 
83
  DriverOpBadParameter(void) {driver_return_code = DRIVER_OP_BAD_PARAMETER;}
 
84
};
 
85
 
 
86
class DriverOpBadPointer: public DriverOpException
 
87
{
 
88
public:
 
89
  DriverOpBadPointer(void) {driver_return_code = DRIVER_OP_BAD_POINTER;}
 
90
};
 
91
 
 
92
class DriverOpNoDriver: public DriverOpException
 
93
{
 
94
public:
 
95
  DriverOpNoDriver(void) {driver_return_code = DRIVER_OP_NO_DRIVER;}
 
96
};
 
97
 
 
98
void possible_throw_device_exception(driver_return_code_t drc);
 
99
 
 
100
/** A class relating to CD-Text. Use invalid track number 0 to specify
 
101
    CD-Text for the CD (as opposed to a specific track).
 
102
*/
 
103
class CdioCDText
 
104
{
 
105
public: 
 
106
  CdioCDText(cdtext_t *p)
 
107
  { 
 
108
    p_cdtext = p;
 
109
    cdtext_init(p); // make sure we're initialized on the C side
 
110
  }
 
111
 
 
112
  ~CdioCDText() 
 
113
  {
 
114
    cdtext_destroy(p_cdtext);
 
115
    p_cdtext = (cdtext_t *) NULL;
 
116
  }
 
117
 
 
118
  // Other member functions
 
119
#include "cdtext.hpp"
 
120
 
 
121
private:
 
122
  cdtext_t *p_cdtext;
 
123
};
 
124
    
 
125
/** A class relating to tracks. A track object basically saves device
 
126
    and track number information so that in track operations these
 
127
    don't have be specified.
 
128
*/
 
129
class CdioTrack
 
130
{
 
131
 
 
132
public: 
 
133
  CdioTrack(CdIo_t *p, track_t t)
 
134
  { 
 
135
    i_track = t;
 
136
    p_cdio = p;
 
137
  }
 
138
 
 
139
  // Other member functions
 
140
#include "track.hpp"
 
141
 
 
142
private:
 
143
  track_t i_track;
 
144
  CdIo_t *p_cdio;
 
145
};
 
146
    
 
147
/** A class relating to a CD-ROM device or pseudo CD-ROM device with
 
148
    has a particular CD image. A device basically saves the libcdio
 
149
    "object" (of type CdIo *). 
 
150
*/
 
151
class CdioDevice 
 
152
{
 
153
 
 
154
protected:
 
155
 
 
156
  CdIo_t *p_cdio;
 
157
 
 
158
public:
 
159
 
 
160
  CdioDevice()
 
161
  { 
 
162
      p_cdio = (CdIo_t *) NULL; 
 
163
  };
 
164
 
 
165
  ~CdioDevice() 
 
166
  { 
 
167
    cdio_destroy(p_cdio); 
 
168
    p_cdio = (CdIo_t *) NULL;
 
169
  };
 
170
 
 
171
  // Other member functions  
 
172
#include "device.hpp"
 
173
#include "disc.hpp"
 
174
#include "mmc.hpp"
 
175
#include "read.hpp"
 
176
 
 
177
};
 
178
 
 
179
/* Things related to devices. No class or object is needed. */
 
180
#include "devices.hpp"
 
181
 
 
182
#endif /* __CDIO_HPP__ */