OpenMW
apps/openmw/mwworld/recordcmp.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_MWWORLD_RECORDCMP_H
00002 #define OPENMW_MWWORLD_RECORDCMP_H
00003 
00004 #include <cctype>
00005 
00006 #include <components/esm/records.hpp>
00007 
00008 namespace MWWorld
00009 {
00010     struct RecordCmp
00011     {
00012         template <class T>
00013         bool operator()(const T &x, const T& y) const {
00014             return x.mId < y.mId;
00015         }
00016     };
00017 
00018     template <>
00019     inline bool RecordCmp::operator()<ESM::Dialogue>(const ESM::Dialogue &x, const ESM::Dialogue &y) const {
00020         return Misc::StringUtils::ciLess(x.mId, y.mId);
00021     }
00022 
00023     template <>
00024     inline bool RecordCmp::operator()<ESM::Cell>(const ESM::Cell &x, const ESM::Cell &y) const {
00025         return Misc::StringUtils::ciLess(x.mName, y.mName);
00026     }
00027 
00028     template <>
00029     inline bool RecordCmp::operator()<ESM::Pathgrid>(const ESM::Pathgrid &x, const ESM::Pathgrid &y) const {
00030         return Misc::StringUtils::ciLess(x.mCell, y.mCell);
00031     }
00032 
00033 } // end namespace
00034 #endif