4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _MULTIMEDIA_AUDIOERROR_H
28 #define _MULTIMEDIA_AUDIOERROR_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
34 #include <audio_errno.h> /* to get enum for error codes */
40 #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
41 #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
44 #define _MGET_(str) (char *)dgettext(TEXT_DOMAIN, str)
45 #define _GETTEXT_(str) (char *)gettext(str)
47 // The AudioError class allows various interesting automatic conversions
50 audioerror_t code
; // error code
53 int sys
; // system error code
55 inline AudioError(audioerror_t val
= AUDIO_SUCCESS
): // Constructor
57 { if (code
== AUDIO_UNIXERROR
) sys
= errno
; }
58 inline AudioError(int val
): // Constructor from int
59 code((audioerror_t
)val
), sys(0)
60 { if (code
== AUDIO_UNIXERROR
) sys
= errno
; }
62 inline AudioError
operator = (AudioError val
) // Assignment
63 { code
= val
.code
; sys
= val
.sys
; return (*this); }
64 inline operator int() // Cast to integer
66 inline int operator == (audioerror_t e
) // Compare
67 { return (code
== e
); }
68 inline int operator != (audioerror_t e
) // Compare
69 { return (code
!= e
); }
70 inline int operator == (AudioError e
) // Compare
71 { return ((code
== e
.code
) && (sys
== e
.sys
)); }
72 inline int operator != (AudioError e
) // Compare
73 { return ((code
!= e
.code
) || (sys
!= e
.sys
)); }
75 char *msg(); // Return error string
82 #endif /* !_MULTIMEDIA_AUDIOERROR_H */