Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

Comparator.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2005 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 
00075 struct tDWFCharCompareEqual : tDWFCompareEqual<const char*>
00076 {
00085     bool operator()( const char* rLHS, const char* rRHS ) const
00086     {
00087         return (DWFCORE_COMPARE_ASCII_STRINGS(rLHS, rRHS) == 0);
00088     }
00089 };
00090 
00098 struct tDWFWCharCompareEqual : tDWFCompareEqual<const wchar_t*>
00099 {
00108     bool operator()( const wchar_t* rLHS, const wchar_t* rRHS ) const
00109     {
00110         return (DWFCORE_COMPARE_WIDE_STRINGS(rLHS, rRHS) == 0);
00111     }
00112 };
00113 
00122 template<class T>
00123 struct tDWFCompareLess
00124 {
00133     bool operator()( const T& rLHS, const T& rRHS ) const
00134     {
00135         return (rLHS < rRHS);
00136     }
00137 };
00138 
00146 struct tDWFCharCompareLess : tDWFCompareLess<const char*>
00147 {
00156     bool operator()( const char* rLHS, const char* rRHS ) const
00157     {
00158         return (DWFCORE_COMPARE_ASCII_STRINGS(rLHS, rRHS) < 0);
00159     }
00160 };
00161 
00169 struct tDWFWCharCompareLess : tDWFCompareLess<const wchar_t*>
00170 {
00179     bool operator()( const wchar_t* rLHS, const wchar_t* rRHS ) const
00180     {
00181         return (DWFCORE_COMPARE_WIDE_STRINGS(rLHS, rRHS) < 0);
00182     }
00183 };
00184 
00192 template<class T>
00193 struct tDWFDefinedEmpty
00194 {
00200     T operator()() const
00201     {
00202         return 0;
00203     }
00204 };
00205 
00213 struct tDWFCharDefinedEmpty : tDWFDefinedEmpty<const char*>
00214 {
00220     const char* operator()() const
00221     {
00222         return "";
00223     }
00224 };
00225 
00233 struct tDWFWCharDefinedEmpty : tDWFDefinedEmpty<const wchar_t*>
00234 {
00240     const wchar_t* operator()() const
00241     {
00242         return L"";
00243     }
00244 };
00245 
00253 struct tDWFStringDefinedEmpty : tDWFDefinedEmpty<DWFString>
00254 {
00255     DWFString operator()() const
00256     {
00257         return L"";
00258     }
00259 };
00260 
00261 }
00262 
00263 
00264 #endif

Generated on Tue May 17 12:05:10 2005 for Autodesk DWF Core Library by  doxygen 1.4.1