![]() |
![]() |
|
|
00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: fastformat/format/specification_defect_handling/ignore_unreferenced_arguments_scope.hpp 00003 * 00004 * Purpose: A scoping class that suppresses the reporting of 00005 * unreferenced arguments. 00006 * 00007 * Created: 1st December 2008 00008 * Updated: 30th April 2009 00009 * 00010 * Home: http://www.fastformat.org/ 00011 * 00012 * Copyright (c) 2008-2009, Matthew Wilson and Synesis Software 00013 * All rights reserved. 00014 * 00015 * Redistribution and use in source and binary forms, with or without 00016 * modification, are permitted provided that the following conditions are 00017 * met: 00018 * 00019 * - Redistributions of source code must retain the above copyright notice, 00020 * this list of conditions and the following disclaimer. 00021 * - Redistributions in binary form must reproduce the above copyright 00022 * notice, this list of conditions and the following disclaimer in the 00023 * documentation and/or other materials provided with the distribution. 00024 * - Neither the names of Matthew Wilson and Synesis Software nor the names 00025 * of any contributors may be used to endorse or promote products derived 00026 * from this software without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00029 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00030 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00031 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00032 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00033 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00034 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00035 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00036 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00037 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00038 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 * 00040 * ////////////////////////////////////////////////////////////////////// */ 00041 00042 00049 #ifndef FASTFORMAT_INCL_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_IGNORE_UNREFERENCED_ARGUMENTS_SCOPE 00050 #define FASTFORMAT_INCL_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_IGNORE_UNREFERENCED_ARGUMENTS_SCOPE 00051 00052 /* ///////////////////////////////////////////////////////////////////////// 00053 * Version information 00054 */ 00055 00056 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION 00057 # define FASTFORMAT_VER_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_IGNORE_UNREFERENCED_ARGUMENTS_SCOPE_MAJOR 1 00058 # define FASTFORMAT_VER_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_IGNORE_UNREFERENCED_ARGUMENTS_SCOPE_MINOR 1 00059 # define FASTFORMAT_VER_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_IGNORE_UNREFERENCED_ARGUMENTS_SCOPE_REVISION 1 00060 # define FASTFORMAT_VER_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_IGNORE_UNREFERENCED_ARGUMENTS_SCOPE_EDIT 1 00061 #endif /* !FASTFORMAT_DOCUMENTATION_SKIP_SECTION */ 00062 00063 /* ///////////////////////////////////////////////////////////////////////// 00064 * Language 00065 */ 00066 00067 #ifndef __cplusplus 00068 # error This file can only be included in C++ compilation units 00069 #endif /* !__cplusplus */ 00070 00071 /* ///////////////////////////////////////////////////////////////////////// 00072 * Includes 00073 */ 00074 00075 #include <fastformat/fastformat.h> 00076 #ifndef FASTFORMAT_INCL_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_MISMATCHED_ARGUMENTS_SCOPE_BASE 00077 # include <fastformat/format/specification_defect_handling/mismatched_arguments_scope_base.hpp> 00078 #endif /* !FASTFORMAT_INCL_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_MISMATCHED_ARGUMENTS_SCOPE_BASE */ 00079 #include <fastformat/quality/contract.h> 00080 00081 /* ///////////////////////////////////////////////////////////////////////// 00082 * Namespace 00083 */ 00084 00085 #if !defined(FASTFORMAT_NO_NAMESPACE) 00086 namespace fastformat 00087 { 00088 #endif /* !FASTFORMAT_NO_NAMESPACE */ 00089 00090 /* ///////////////////////////////////////////////////////////////////////// 00091 * Classes 00092 */ 00093 00097 class ignore_unreferenced_arguments_scope 00098 : private mismatched_arguments_scope_base // ISA is not important 00099 { 00100 public: 00101 00102 typedef mismatched_arguments_scope_base parent_class_type; 00104 typedef ignore_unreferenced_arguments_scope class_type; 00105 00106 public: 00107 00112 ignore_unreferenced_arguments_scope() 00113 : parent_class_type(class_type::handler, get_this_()) 00114 {} 00121 ~ignore_unreferenced_arguments_scope() throw() 00122 {} 00123 private: 00124 ignore_unreferenced_arguments_scope(class_type const&); 00125 class_type& operator =(class_type const&); 00126 00127 private: 00128 void* get_this_() throw() 00129 { 00130 return this; 00131 } 00132 00133 static int FASTFORMAT_CALLCONV handler( 00134 void* param 00135 , ff_replacement_code_t code 00136 , size_t numParameters 00137 , int parameterIndex 00138 , ff_string_slice_t* slice 00139 , void* reserved0 00140 , size_t reserved1 00141 , void* reserved2 00142 ) 00143 { 00144 class_type* pThis = static_cast<class_type*>(param); 00145 00146 if(FF_REPLACEMENTCODE_UNREFERENCED_ARGUMENT == code) 00147 { 00148 return +1; // Ignore unreferenced argument 00149 } 00150 else 00151 { 00152 return pThis->parent_class_type::handle_default(param, code, numParameters, parameterIndex, slice, reserved0, reserved1, reserved2); 00153 } 00154 } 00155 }; 00156 00157 /* ///////////////////////////////////////////////////////////////////////// 00158 * Namespace 00159 */ 00160 00161 #if !defined(FASTFORMAT_NO_NAMESPACE) 00162 } /* namespace fastformat */ 00163 #endif /* !FASTFORMAT_NO_NAMESPACE */ 00164 00165 /* ////////////////////////////////////////////////////////////////////// */ 00166 00167 #endif /* FASTFORMAT_INCL_FASTFORMAT_FORMAT_SPECIFICATION_DEFECT_HANDLING_HPP_IGNORE_UNREFERENCED_ARGUMENTS_SCOPE */ 00168 00169 /* ////////////////////////////////////////////////////////////////////// */
|
|
FastFormat Library documentation © Matthew Wilson, 2006-2009 |
|