File indexing completed on 2024-05-19 05:42:10
0001 // ct_lvtmdb_errorobject.h -*-C++-*- 0002 0003 /* 0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk> 0005 // SPDX-License-Identifier: Apache-2.0 0006 // 0007 // Licensed under the Apache License, Version 2.0 (the "License"); 0008 // you may not use this file except in compliance with the License. 0009 // You may obtain a copy of the License at 0010 // 0011 // http://www.apache.org/licenses/LICENSE-2.0 0012 // 0013 // Unless required by applicable law or agreed to in writing, software 0014 // distributed under the License is distributed on an "AS IS" BASIS, 0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0016 // See the License for the specific language governing permissions and 0017 // limitations under the License. 0018 */ 0019 0020 #ifndef INCLUDED_CT_LVTMDB_ERROROBJECT 0021 #define INCLUDED_CT_LVTMDB_ERROROBJECT 0022 0023 #include <lvtmdb_export.h> 0024 0025 #include <ct_lvtmdb_databaseobject.h> 0026 #include <ct_lvtmdb_util.h> 0027 0028 #include <string> 0029 0030 namespace Codethink::lvtmdb { 0031 0032 // =================== 0033 // class ErrorObject 0034 // =================== 0035 0036 class LVTMDB_EXPORT ErrorObject : public DatabaseObject { 0037 // See locking discipline in superclass. That applies here. 0038 0039 private: 0040 MdbUtil::ErrorKind d_errorKind; 0041 // the type of error this refeers to. 0042 0043 std::string d_errorMessage; 0044 // The stored error message 0045 0046 std::string d_fileName; 0047 // The file containing the error 0048 0049 public: 0050 // CREATORS 0051 ErrorObject(MdbUtil::ErrorKind errorKind, 0052 std::string qualifiedName, 0053 std::string errorMessage, 0054 std::string fileName); 0055 0056 ~ErrorObject() noexcept override; 0057 0058 ErrorObject(ErrorObject&& other) noexcept; 0059 0060 ErrorObject& operator=(ErrorObject&& other) noexcept; 0061 0062 // ACCESSORS 0063 [[nodiscard]] MdbUtil::ErrorKind errorKind() const; 0064 0065 [[nodiscard]] const std::string& errorMessage() const; 0066 0067 [[nodiscard]] const std::string& fileName() const; 0068 0069 [[nodiscard]] std::string storageKey() const; 0070 // unique identification of this error message 0071 0072 // CLASS METHODS 0073 static std::string 0074 getStorageKey(const std::string& qualifiedName, const std::string& errorMessage, const std::string& fileName); 0075 }; 0076 0077 } // namespace Codethink::lvtmdb 0078 0079 #endif // INCLUDED_CT_LVTMDB_ERROROBJECT