Comparator.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 
00023 #ifndef _DWFCORE_COMPARATOR_H
00024 #define _DWFCORE_COMPARATOR_H
00025 
00026 
00032 
00033 
00034 
00035 #include "dwfcore/Core.h"
00036 #include "dwfcore/String.h"
00037 
00038 
00039 
00040 namespace DWFCore
00041 {
00042 
00051 template<class T>
00052 struct tDWFCompareEqual
00053 {
00062     virtual bool operator()( const T& rLHS, const T& rRHS ) const
00063     {
00064         return static_cast<bool>(rLHS == rRHS);
00065     }
00066 
00067     virtual ~tDWFCompareEqual()
00068     {}
00069 };
00070 
00078 struct tDWFCharCompareEqual : tDWFCompareEqual<const char*>
00079 {
00088     bool operator()( const char* rLHS, const char* rRHS ) const
00089     {
00090         return (DWFCORE_COMPARE_ASCII_STRINGS(rLHS, rRHS) == 0);
00091     }
00092 };
00093 
00101 struct tDWFWCharCompareEqual : tDWFCompareEqual<const wchar_t*>
00102 {
00111     bool operator()( const wchar_t* rLHS, const wchar_t* rRHS ) const
00112     {
00113         return (DWFCORE_COMPARE_WIDE_STRINGS(rLHS, rRHS) == 0);
00114     }
00115 };
00116 
00125 template<class T>
00126 struct tDWFCompareLess
00127 {
00136     virtual bool operator()( const T& rLHS, const T& rRHS ) const
00137     {
00138         return (rLHS < rRHS);
00139     }
00140 
00141     virtual ~tDWFCompareLess()
00142     {}
00143 };
00144 
00152 struct tDWFCharCompareLess : tDWFCompareLess<const char*>
00153 {
00162     bool operator()( const char* rLHS, const char* rRHS ) const
00163     {
00164         return (DWFCORE_COMPARE_ASCII_STRINGS(rLHS, rRHS) < 0);
00165     }
00166 };
00167 
00175 struct tDWFWCharCompareLess : tDWFCompareLess<const wchar_t*>
00176 {
00185     bool operator()( const wchar_t* rLHS, const wchar_t* rRHS ) const
00186     {
00187         return (DWFCORE_COMPARE_WIDE_STRINGS(rLHS, rRHS) < 0);
00188     }
00189 };
00190 
00198 template<class T>
00199 struct tDWFDefinedEmpty
00200 {
00206     T operator()() const
00207     {
00208         return 0;
00209     }
00210 };
00211 
00219 struct tDWFCharDefinedEmpty : tDWFDefinedEmpty<const char*>
00220 {
00226     const char* operator()() const
00227     {
00228         return "";
00229     }
00230 };
00231 
00239 struct tDWFWCharDefinedEmpty : tDWFDefinedEmpty<const wchar_t*>
00240 {
00246     const wchar_t* operator()() const
00247     {
00248         return L"";
00249     }
00250 };
00251 
00259 struct tDWFStringDefinedEmpty : tDWFDefinedEmpty<DWFString>
00260 {
00261     DWFString operator()() const
00262     {
00263         return L"";
00264     }
00265 };
00266 
00267 }
00268 
00269 
00270 #endif

Generated on Tue Jan 6 22:39:28 2009 for Autodesk DWF Core Library by  doxygen 1.4.5