Blame samples/werror-test.cpp

Packit Service 21b5d1
// ***************************************************************** -*- C++ -*-
Packit Service 21b5d1
// werror-test.cpp
Packit Service 21b5d1
// Simple tests for the wide-string error class WError
Packit Service 21b5d1
Packit Service 21b5d1
#include <exiv2/exiv2.hpp>
Packit Service 21b5d1
Packit Service 21b5d1
#include <iostream>
Packit Service 21b5d1
Packit Service 21b5d1
int main()
Packit Service 21b5d1
{
Packit Service 21b5d1
    try {
Packit Service 21b5d1
        throw Exiv2::Error(Exiv2::kerGeneralError, "ARG1", "ARG2", "ARG3");
Packit Service 21b5d1
    }
Packit Service 21b5d1
    catch (const Exiv2::Error& e) {
Packit Service 21b5d1
        std::cout << "Caught Error '" << e.what() << "'\n";
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
#ifdef EXV_UNICODE_PATH
Packit Service 21b5d1
    try {
Packit Service 21b5d1
        throw Exiv2::WError(Exiv2::kerGeneralError, L"WARG1", L"WARG2", L"WARG3");
Packit Service 21b5d1
    }
Packit Service 21b5d1
    catch (const Exiv2::WError& e) {
Packit Service 21b5d1
        std::wstring wmsg = e.wwhat();
Packit Service 21b5d1
        std::string msg(wmsg.begin(), wmsg.end());
Packit Service 21b5d1
        std::cout << "Caught WError '" << msg << "'\n";
Packit Service 21b5d1
    }
Packit Service 21b5d1
#endif
Packit Service 21b5d1
Packit Service 21b5d1
    return 0;
Packit Service 21b5d1
}