Rhino C++ API  8.13
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ON_NameHash Class Reference

#include <opennurbs_string.h>

Public Member Functions

 ON_NameHash ()=default
 
 ON_NameHash (const ON_NameHash &)=default
 
 ~ON_NameHash ()=default
 
ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 32 bit hash of id and mapped name More...
 
ON__UINT32 IdCRC (ON__UINT32 current_remainder) const
 32 bit hash of id More...
 
bool IgnoreCase () const
 
ON__UINT32 Internal_DotNetInterfaceGetFlags () const
 
bool IsEmptyNameHash () const
 
bool IsFilePathHash () const
 
bool IsInvalidNameHash () const
 
bool IsValidAndNotEmpty () const
 
ON__UINT32 MappedNameCodePointCount () const
 
ON_SHA1_Hash MappedNameSha1Hash () const
 SHA-1 hash of mapped name. More...
 
ON__UINT32 NameCRC (ON__UINT32 current_remainder) const
 32 bit hash of id and mapped name More...
 
ON_NameHashoperator= (const ON_NameHash &)=default
 
ON_UUID ParentId () const
 

Static Public Member Functions

static int Compare (const ON_NameHash &a, const ON_NameHash &b)
 
static int CompareNameSHA1 (const ON_NameHash &a, const ON_NameHash &b)
 
static int CompareNameSHA1Ptr (const ON_NameHash *a, const ON_NameHash *b)
 
static int CompareParentId (const ON_NameHash &a, const ON_NameHash &b)
 
static int CompareParentIdPtr (const ON_NameHash *a, const ON_NameHash *b)
 
static int ComparePtr (const ON_NameHash *a, const ON_NameHash *b)
 
static ON_NameHash Create (const char *utf8_name)
 
static ON_NameHash Create (const char *utf8_name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_String &name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_String &utf8_name)
 
static ON_NameHash Create (const ON_UUID &parent_id, const char *utf8_name)
 
static ON_NameHash Create (const ON_UUID &parent_id, const char *utf8_name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_UUID &parent_id, const ON_String &name)
 
static ON_NameHash Create (const ON_UUID &parent_id, const ON_String &utf8_name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_UUID &parent_id, const ON_wString &name)
 
static ON_NameHash Create (const ON_UUID &parent_id, const ON_wString &name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_UUID &parent_id, const wchar_t *name)
 
static ON_NameHash Create (const ON_UUID &parent_id, const wchar_t *name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_UUID &parent_id, size_t length, const char *utf8_name)
 
static ON_NameHash Create (const ON_UUID &parent_id, size_t length, const char *utf8_name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_UUID &parent_id, size_t length, const wchar_t *name)
 
static ON_NameHash Create (const ON_UUID &parent_id, size_t length, const wchar_t *name, bool bIgnoreCase)
 
static ON_NameHash Create (const ON_wString &name)
 
static ON_NameHash Create (const ON_wString &name, bool bIgnoreCase)
 
static ON_NameHash Create (const wchar_t *name)
 
static ON_NameHash Create (const wchar_t *name, bool bIgnoreCase)
 
static ON_NameHash Create (size_t length, const char *utf8_name)
 
static ON_NameHash Create (size_t length, const char *utf8_name, bool bIgnoreCase)
 
static ON_NameHash Create (size_t length, const wchar_t *name)
 
static ON_NameHash Create (size_t length, const wchar_t *name, bool bIgnoreCase)
 
static ON_NameHash CreateFilePathHash (const char *file_path)
 
static ON_NameHash CreateFilePathHash (const class ON_FileReference &file_reference)
 
static ON_NameHash CreateFilePathHash (const wchar_t *file_path)
 
static ON_NameHash CreateIdAndEmptyName (const ON_UUID &parent_id)
 
static ON_NameHash CreateIdAndUnsetName (const ON_UUID &parent_id)
 
static ON_NameHash Internal_DotNetInterfaceSet (const ON_UUID &, const ON_SHA1_Hash &, const ON__UINT32)
 

Static Public Attributes

static const ON_NameHash EmptyNameHash
 
static const ON_NameHash UnsetNameHash
 

Detailed Description

Description: An ON_NameHash is designed to help search for and compare attribute names like the ON_ModelComponent.Name() value.

If a name is wchar_t encoded as wide_char_name and UTF-8 encoded as utf8_name, then ON_NameHash(wide_char_name) == ON_NameHash(utf8_name).

Set: bool bEqualNameHash = ON_NameHash::Create(parent_id1,name1) == ON_NameHash::Create(parent_id2,name2); bool bEqualParentId = (parent_id1 == parent_id2) bool bEqualAttributeName = ON_String::EqualAttributeName(name1,name2);

If (bEqualParentId && bEqualAttributeName) is true, then bEqualNameHash is true. If bEqualParentId is false, then bEqualNameHash is false. With probability 1-epsilon, if bEqualAttributeName is false, then bEqualNameHash is false, where epsilon is an extremely tiny number.

Constructor & Destructor Documentation

◆ ON_NameHash() [1/2]

ON_NameHash::ON_NameHash ( )
default

Default construction creates ON_NameHash::UnsetNameHash.

◆ ~ON_NameHash()

ON_NameHash::~ON_NameHash ( )
default

◆ ON_NameHash() [2/2]

ON_NameHash::ON_NameHash ( const ON_NameHash )
default

Member Function Documentation

◆ Compare()

static int ON_NameHash::Compare ( const ON_NameHash a,
const ON_NameHash b 
)
static

Description: Compares id, then length, then SHA-1 digest.

◆ CompareNameSHA1()

static int ON_NameHash::CompareNameSHA1 ( const ON_NameHash a,
const ON_NameHash b 
)
static

◆ CompareNameSHA1Ptr()

static int ON_NameHash::CompareNameSHA1Ptr ( const ON_NameHash a,
const ON_NameHash b 
)
static

◆ CompareParentId()

static int ON_NameHash::CompareParentId ( const ON_NameHash a,
const ON_NameHash b 
)
static

◆ CompareParentIdPtr()

static int ON_NameHash::CompareParentIdPtr ( const ON_NameHash a,
const ON_NameHash b 
)
static

◆ ComparePtr()

static int ON_NameHash::ComparePtr ( const ON_NameHash a,
const ON_NameHash b 
)
static

Description: Compares id, then length, then SHA-1 digest.

◆ Create() [1/24]

static ON_NameHash ON_NameHash::Create ( const char *  utf8_name)
static

◆ Create() [2/24]

static ON_NameHash ON_NameHash::Create ( const char *  utf8_name,
bool  bIgnoreCase 
)
static

◆ Create() [3/24]

static ON_NameHash ON_NameHash::Create ( const ON_String name,
bool  bIgnoreCase 
)
static

◆ Create() [4/24]

static ON_NameHash ON_NameHash::Create ( const ON_String utf8_name)
static

◆ Create() [5/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const char *  utf8_name 
)
static

◆ Create() [6/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const char *  utf8_name,
bool  bIgnoreCase 
)
static

◆ Create() [7/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const ON_String name 
)
static

◆ Create() [8/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const ON_String utf8_name,
bool  bIgnoreCase 
)
static

◆ Create() [9/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const ON_wString name 
)
static

◆ Create() [10/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const ON_wString name,
bool  bIgnoreCase 
)
static

◆ Create() [11/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const wchar_t *  name 
)
static

◆ Create() [12/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
const wchar_t *  name,
bool  bIgnoreCase 
)
static

◆ Create() [13/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
size_t  length,
const char *  utf8_name 
)
static

◆ Create() [14/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
size_t  length,
const char *  utf8_name,
bool  bIgnoreCase 
)
static

◆ Create() [15/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
size_t  length,
const wchar_t *  name 
)
static

◆ Create() [16/24]

static ON_NameHash ON_NameHash::Create ( const ON_UUID parent_id,
size_t  length,
const wchar_t *  name,
bool  bIgnoreCase 
)
static

◆ Create() [17/24]

static ON_NameHash ON_NameHash::Create ( const ON_wString name)
static

Returns: ON_NameHash::EmptyNameHash if name is empty. ON_NameHash::UnsetNameHash if name is not valid.

◆ Create() [18/24]

static ON_NameHash ON_NameHash::Create ( const ON_wString name,
bool  bIgnoreCase 
)
static

◆ Create() [19/24]

static ON_NameHash ON_NameHash::Create ( const wchar_t *  name)
static

◆ Create() [20/24]

static ON_NameHash ON_NameHash::Create ( const wchar_t *  name,
bool  bIgnoreCase 
)
static

◆ Create() [21/24]

static ON_NameHash ON_NameHash::Create ( size_t  length,
const char *  utf8_name 
)
static

◆ Create() [22/24]

static ON_NameHash ON_NameHash::Create ( size_t  length,
const char *  utf8_name,
bool  bIgnoreCase 
)
static

◆ Create() [23/24]

static ON_NameHash ON_NameHash::Create ( size_t  length,
const wchar_t *  name 
)
static

◆ Create() [24/24]

static ON_NameHash ON_NameHash::Create ( size_t  length,
const wchar_t *  name,
bool  bIgnoreCase 
)
static

◆ CreateFilePathHash() [1/3]

static ON_NameHash ON_NameHash::CreateFilePathHash ( const char *  file_path)
static

◆ CreateFilePathHash() [2/3]

static ON_NameHash ON_NameHash::CreateFilePathHash ( const class ON_FileReference file_reference)
static

◆ CreateFilePathHash() [3/3]

static ON_NameHash ON_NameHash::CreateFilePathHash ( const wchar_t *  file_path)
static

◆ CreateIdAndEmptyName()

static ON_NameHash ON_NameHash::CreateIdAndEmptyName ( const ON_UUID parent_id)
static

◆ CreateIdAndUnsetName()

static ON_NameHash ON_NameHash::CreateIdAndUnsetName ( const ON_UUID parent_id)
static

◆ DataCRC()

ON__UINT32 ON_NameHash::DataCRC ( ON__UINT32  current_remainder) const

32 bit hash of id and mapped name

◆ IdCRC()

ON__UINT32 ON_NameHash::IdCRC ( ON__UINT32  current_remainder) const

32 bit hash of id

◆ IgnoreCase()

bool ON_NameHash::IgnoreCase ( ) const

Returns: True if hash is set and case is ignored

◆ Internal_DotNetInterfaceGetFlags()

ON__UINT32 ON_NameHash::Internal_DotNetInterfaceGetFlags ( ) const

◆ Internal_DotNetInterfaceSet()

static ON_NameHash ON_NameHash::Internal_DotNetInterfaceSet ( const ON_UUID ,
const ON_SHA1_Hash ,
const  ON__UINT32 
)
static

Description: Internal_CreateFromDotNet() is public for technical reasons. It is used in Rhino Common p-invoke code that provides a .NET interface to the services ON_NameHash provided by the ON_NameHash class. This function should be ignored and never called from ordinary C++ code. If you choose to ignore the preceding admonition, you will have to read the source code for information about how this function works.

◆ IsEmptyNameHash()

bool ON_NameHash::IsEmptyNameHash ( ) const

Returns: True if the hash is for an empty name.

◆ IsFilePathHash()

bool ON_NameHash::IsFilePathHash ( ) const

Returns: True if the hash is not empty and was set by calling CreateFilePathHash().

◆ IsInvalidNameHash()

bool ON_NameHash::IsInvalidNameHash ( ) const

Returns: True if the hash is for an invalid name.

◆ IsValidAndNotEmpty()

bool ON_NameHash::IsValidAndNotEmpty ( ) const

Returns: True if the hash is for a valid non-empty name.

◆ MappedNameCodePointCount()

ON__UINT32 ON_NameHash::MappedNameCodePointCount ( ) const

Number of UTf-32 code point values in mapped name. (0 for file path hashes)

◆ MappedNameSha1Hash()

ON_SHA1_Hash ON_NameHash::MappedNameSha1Hash ( ) const

SHA-1 hash of mapped name.

◆ NameCRC()

ON__UINT32 ON_NameHash::NameCRC ( ON__UINT32  current_remainder) const

32 bit hash of id and mapped name

◆ operator=()

ON_NameHash& ON_NameHash::operator= ( const ON_NameHash )
default

◆ ParentId()

ON_UUID ON_NameHash::ParentId ( ) const

Member Data Documentation

◆ EmptyNameHash

const ON_NameHash ON_NameHash::EmptyNameHash
static

◆ UnsetNameHash

const ON_NameHash ON_NameHash::UnsetNameHash
static