Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:59:17

0001 // Copyright (c) 2023 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _Standard_CStringHasher_HeaderFile
0015 #define _Standard_CStringHasher_HeaderFile
0016 
0017 #include <Standard_CString.hxx>
0018 #include <Standard_HashUtils.hxx>
0019 #include <Standard_TypeDef.hxx>
0020 
0021 class Standard_CStringHasher
0022 {
0023 public:
0024   size_t operator()(const char* const theString) const noexcept
0025   {
0026     const int aLen = static_cast<int>(strlen(theString));
0027     if (aLen < 4)
0028     {
0029       return opencascade::FNVHash::hash_combine(*theString, aLen);
0030     }
0031     return opencascade::hashBytes(theString, aLen);
0032   }
0033 
0034   bool operator()(const char* const theString1, const char* const theString2) const noexcept
0035   {
0036     return strcmp(theString1, theString2) == 0;
0037   }
0038 };
0039 
0040 #endif