Commit bc8f1733 authored by Josh Coalson's avatar Josh Coalson
Browse files

add resolved_as_cstring() method to State classes

parent db17248e
......@@ -81,6 +81,7 @@ namespace FLAC {
inline State(::FLAC__StreamDecoderState state): state_(state) { }
inline operator ::FLAC__StreamDecoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__StreamDecoderStateString[state_]; }
const char *resolved_as_cstring(const Stream &) const;
protected:
::FLAC__StreamDecoderState state_;
};
......@@ -166,6 +167,7 @@ namespace FLAC {
inline State(::FLAC__SeekableStreamDecoderState state): state_(state) { }
inline operator ::FLAC__SeekableStreamDecoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__SeekableStreamDecoderStateString[state_]; }
const char *resolved_as_cstring(const SeekableStream &) const;
protected:
::FLAC__SeekableStreamDecoderState state_;
};
......@@ -260,6 +262,7 @@ namespace FLAC {
inline State(::FLAC__FileDecoderState state): state_(state) { }
inline operator ::FLAC__FileDecoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__FileDecoderStateString[state_]; }
const char *resolved_as_cstring(const File &) const;
protected:
::FLAC__FileDecoderState state_;
};
......
......@@ -82,6 +82,7 @@ namespace FLAC {
inline State(::FLAC__StreamEncoderState state): state_(state) { }
inline operator ::FLAC__StreamEncoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__StreamEncoderStateString[state_]; }
const char *resolved_as_cstring(const Stream &) const;
protected:
::FLAC__StreamEncoderState state_;
};
......@@ -174,6 +175,7 @@ namespace FLAC {
inline State(::FLAC__SeekableStreamEncoderState state): state_(state) { }
inline operator ::FLAC__SeekableStreamEncoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__SeekableStreamEncoderStateString[state_]; }
const char *resolved_as_cstring(const SeekableStream &) const;
protected:
::FLAC__SeekableStreamEncoderState state_;
};
......@@ -267,6 +269,7 @@ namespace FLAC {
inline State(::FLAC__FileEncoderState state): state_(state) { }
inline operator ::FLAC__FileEncoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__FileEncoderStateString[state_]; }
const char *resolved_as_cstring(const File &) const;
protected:
::FLAC__FileEncoderState state_;
};
......
......@@ -23,6 +23,19 @@
namespace FLAC {
namespace Decoder {
const char *File::State::resolved_as_cstring(const File &decoder) const
{
if(state_ == ::FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR) {
FLAC::Decoder::SeekableStream::State state__ = decoder.get_seekable_stream_decoder_state();
if(state__ == ::FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR)
return decoder.get_stream_decoder_state().as_cstring();
else
return state__.as_cstring();
}
else
return as_cstring();
}
File::File():
decoder_(::FLAC__file_decoder_new())
{ }
......
......@@ -23,6 +23,24 @@
namespace FLAC {
namespace Encoder {
const char *File::State::resolved_as_cstring(const File &encoder) const
{
if(state_ == ::FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR) {
FLAC::Encoder::SeekableStream::State state__ = encoder.get_seekable_stream_encoder_state();
if(state__ == ::FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR) {
FLAC::Encoder::Stream::State state___ = encoder.get_stream_encoder_state();
if(state___ == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR)
return encoder.get_verify_decoder_state().as_cstring();
else
return state___.as_cstring();
}
else
return state__.as_cstring();
}
else
return as_cstring();
}
File::File():
encoder_(::FLAC__file_encoder_new())
{ }
......
......@@ -23,6 +23,14 @@
namespace FLAC {
namespace Decoder {
const char *SeekableStream::State::resolved_as_cstring(const SeekableStream &decoder) const
{
if(state_ == ::FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR)
return decoder.get_stream_decoder_state().as_cstring();
else
return as_cstring();
}
SeekableStream::SeekableStream():
decoder_(::FLAC__seekable_stream_decoder_new())
{ }
......
......@@ -23,6 +23,20 @@
namespace FLAC {
namespace Encoder {
const char *SeekableStream::State::resolved_as_cstring(const SeekableStream &encoder) const
{
if(state_ == ::FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR) {
FLAC::Encoder::Stream::State state__ = encoder.get_stream_encoder_state();
if(state__ == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR)
return encoder.get_verify_decoder_state().as_cstring();
else
return state__.as_cstring();
}
else
return as_cstring();
}
SeekableStream::SeekableStream():
encoder_(::FLAC__seekable_stream_encoder_new())
{ }
......
......@@ -23,6 +23,11 @@
namespace FLAC {
namespace Decoder {
const char *Stream::State::resolved_as_cstring(const Stream &) const
{
return as_cstring();
}
Stream::Stream():
decoder_(::FLAC__stream_decoder_new())
{ }
......
......@@ -23,6 +23,14 @@
namespace FLAC {
namespace Encoder {
const char *Stream::State::resolved_as_cstring(const Stream &encoder) const
{
if(state_ == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR)
return encoder.get_verify_decoder_state().as_cstring();
else
return as_cstring();
}
Stream::Stream():
encoder_(::FLAC__stream_encoder_new())
{ }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment