예제 #1
0
CRWStreambuf::~CRWStreambuf()
{
    try {
        // Flush only if data pending and no error
        if (!x_Err  ||  x_ErrPos != x_GetPPos())
            x_Sync();
        setp(0, 0);
    } NCBI_CATCH_ALL_X(2,  "Exception in ~CRWStreambuf() [IGNORED]");
    try {
        // Push any data still unred in the buffer back to the device
        ERW_Result result = x_Pushback();
        if (result != eRW_Success  &&  result != eRW_NotImplemented) {
            ERR_POST_X(13,
                       Critical << "CRWStreambuf::~CRWStreambuf():"
                       " Read data pending");
        }
    } NCBI_CATCH_ALL_X(14, "Exception in ~CRWStreambuf() [IGNORED]");

    delete[] m_pBuf;
}
예제 #2
0
CRWStreambuf::~CRWStreambuf()
{
    try {
        // Flush only if data pending and no error
        if (!x_Err  ||  x_ErrPos != x_GetPPos())
            x_sync();
        setg(0, 0, 0);
        setp(0, 0);

        IReaderWriter* rw = dynamic_cast<IReaderWriter*> (m_Reader);
        if (rw  &&  rw == dynamic_cast<IReaderWriter*> (m_Writer)) {
            if ((m_Flags & fOwnAll) == fOwnAll)
                delete rw;
        } else {
            if (m_Flags & fOwnWriter)
                delete m_Writer;
            if (m_Flags & fOwnReader)
                delete m_Reader;
        }

        delete[] m_pBuf;
    } NCBI_CATCH_ALL_X(2, "Exception in ~CRWStreambuf() [IGNORED]");
}