00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: pantheios/cpp/levels.hpp 00003 * 00004 * Purpose: Custom level class. 00005 * 00006 * Created: 22nd July 2006 00007 * Updated: 1st September 2006 00008 * 00009 * Author: Matthew Wilson 00010 * 00011 * Home: http://www.pantheios.org/ 00012 * 00013 * Copyright: Matthew Wilson and Synesis Software Pty Ltd, 1999-2005. 00014 * Matthew Wilson, 2005-2006. 00015 * 00016 * Redistribution and use in source and binary forms, with or without 00017 * modification, are permitted provided that the following conditions are met: 00018 * 00019 * - Redistributions of source code must retain the above copyright notice, this 00020 * list of conditions and the following disclaimer. 00021 * - Redistributions in binary form must reproduce the above copyright notice, 00022 * this list of conditions and the following disclaimer in the documentation 00023 * and/or other materials provided with the distribution. 00024 * - Neither the names of Matthew Wilson and Synesis Software nor the names of 00025 * any contributors may be used to endorse or promote products derived from 00026 * this software without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00029 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00030 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00031 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00032 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00033 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00034 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00035 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00036 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00037 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00038 * POSSIBILITY OF SUCH DAMAGE. 00039 * 00040 * ////////////////////////////////////////////////////////////////////// */ 00041 00042 00049 #ifndef PANTHEIOS_INCLUDING_LEVELS 00050 # error This file may only be included from within the Pantheios main C header file. 00051 #endif /* !PANTHEIOS_INCLUDING_LEVELS */ 00052 00053 #ifndef PANTHEIOS_INCL_PANTHEIOS_HPP_LEVELS 00054 #define PANTHEIOS_INCL_PANTHEIOS_HPP_LEVELS 00055 00056 /* ///////////////////////////////////////////////////////////////////////// 00057 * Version information 00058 */ 00059 00060 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION 00061 # define PANTHEIOS_VER_PANTHEIOS_HPP_LEVELS_MAJOR 1 00062 # define PANTHEIOS_VER_PANTHEIOS_HPP_LEVELS_MINOR 0 00063 # define PANTHEIOS_VER_PANTHEIOS_HPP_LEVELS_REVISION 1 00064 # define PANTHEIOS_VER_PANTHEIOS_HPP_LEVELS_EDIT 1 00065 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */ 00066 00067 /* ///////////////////////////////////////////////////////////////////////// 00068 * Includes 00069 */ 00070 00071 #include <pantheios/pantheios.h> 00072 00073 /* ///////////////////////////////////////////////////////////////////////// 00074 * Classes 00075 */ 00076 00084 class level 00085 { 00088 public: 00089 typedef level class_type; 00091 00094 public: 00095 explicit level(pan_sev_t inateSeverity8) 00096 : m_inateSeverity8(inateSeverity8 & 0x07) 00097 {} 00099 00102 public: 00103 operator pan_sev_t () const 00104 { 00105 return m_inateSeverity8; 00106 } 00111 pan_sev_t operator ()(pan_sev_t extendedSeverityInformation24) const 00112 { 00113 STLSOFT_MESSAGE_ASSERT("Extended severity information is limited to 24-bits", extendedSeverityInformation24 < 0x01000000); 00114 00115 return (m_inateSeverity8 & 0x07) | ((extendedSeverityInformation24 << 8) & ~0x07); 00116 } 00118 00121 private: 00122 const pan_sev_t m_inateSeverity8; 00124 00127 private: 00128 class_type &operator =(class_type const &); 00130 }; 00131 00132 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION 00133 namespace 00134 { 00135 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */ 00136 00138 static const level debug(PANTHEIOS_SEV_DEBUG); 00140 static const level informational(PANTHEIOS_SEV_INFORMATIONAL); 00142 static const level notice(PANTHEIOS_SEV_NOTICE); 00144 static const level warning(PANTHEIOS_SEV_WARNING); 00146 static const level error(PANTHEIOS_SEV_ERROR); 00148 static const level critical(PANTHEIOS_SEV_CRITICAL); 00150 static const level alert(PANTHEIOS_SEV_ALERT); 00152 static const level emergency(PANTHEIOS_SEV_EMERGENCY); 00153 00154 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION 00155 } // anonymous namespace 00156 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */ 00157 00158 /* ////////////////////////////////////////////////////////////////////// */ 00159 00160 #endif /* !PANTHEIOS_INCL_PANTHEIOS_HPP_LEVELS */ 00161 00162 /* ////////////////////////////////////////////////////////////////////// */
|
|
pantheios Library documentation © Matthew Wilson, 2006 |
|