1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef OC_RESOURCE_INIT_EXCEPTION_H_
22 #define OC_RESOURCE_INIT_EXCEPTION_H_
25 #include "StringConstants.h"
29 class ResourceInitException : public std::exception
32 ResourceInitException(
35 bool missingInterface,
36 bool missingClientWrapper,
40 m_missingUri(missingUri),
41 m_missingType(missingType),
42 m_missingInterface(missingInterface),
43 m_missingClientWrapper(missingClientWrapper),
44 m_invalidPort(invalidPort),
45 m_invalidIp(invalidIp)
49 m_whatMessage += OC::InitException::MISSING_URI;
54 m_whatMessage += OC::InitException::MISSING_TYPE;
57 if(isInterfaceMissing())
59 m_whatMessage += OC::InitException::MISSING_INTERFACE;
62 if(isClientWrapperMissing())
64 m_whatMessage += OC::InitException::MISSING_CLIENT_WRAPPER;
69 m_whatMessage += OC::InitException::INVALID_PORT;
74 m_whatMessage += OC::InitException::INVALID_IP;
78 virtual ~ResourceInitException() throw() {}
80 bool isInvalidPort() const
85 bool isInvalidIp() const
90 bool isClientWrapperMissing() const
92 return m_missingClientWrapper;
95 bool isUriMissing() const
100 bool isTypeMissing() const
102 return m_missingType;
105 bool isInterfaceMissing() const
107 return m_missingInterface;
110 virtual const char* what() const BOOST_NOEXCEPT
112 return m_whatMessage.c_str();
116 std::string m_whatMessage;
119 bool m_missingInterface;
120 bool m_missingClientWrapper;