Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Exception.h
00001 // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 00002 #ifndef __EXCEPTION_H__ 00003 #define __EXCEPTION_H__ 00004 00005 /* 00006 * Exception.h 00007 * ZXing 00008 * 00009 * Copyright 2010 ZXing authors All rights reserved. 00010 * 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * 00015 * http://www.apache.org/licenses/LICENSE-2.0 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 */ 00023 00024 #include <string> 00025 #include <exception> 00026 00027 namespace zxing { 00028 00029 class Exception : public std::exception { 00030 private: 00031 char const* const message; 00032 00033 public: 00034 Exception() throw() : message(0) {} 00035 Exception(const char* msg) throw() : message(copy(msg)) {} 00036 Exception(Exception const& that) throw() : std::exception(that), message(copy(that.message)) {} 00037 ~Exception() throw() { 00038 if(message) { 00039 deleteMessage(); 00040 } 00041 } 00042 char const* what() const throw() {return message ? message : "";} 00043 00044 private: 00045 static char const* copy(char const*); 00046 void deleteMessage(); 00047 }; 00048 00049 } 00050 00051 #endif // __EXCEPTION_H__
Generated on Wed Jul 13 2022 20:52:13 by
