diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /sp/src/public/tier1/characterset.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/public/tier1/characterset.h')
| -rw-r--r-- | sp/src/public/tier1/characterset.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sp/src/public/tier1/characterset.h b/sp/src/public/tier1/characterset.h new file mode 100644 index 00000000..8bd35352 --- /dev/null +++ b/sp/src/public/tier1/characterset.h @@ -0,0 +1,43 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Shared code for parsing / searching for characters in a string
+// using lookup tables
+//
+// $Workfile: $
+// $Date: $
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef CHARACTERSET_H
+#define CHARACTERSET_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+struct characterset_t
+{
+ char set[256];
+};
+
+
+// This is essentially a strpbrk() using a precalculated lookup table
+//-----------------------------------------------------------------------------
+// Purpose: builds a simple lookup table of a group of important characters
+// Input : *pSetBuffer - pointer to the buffer for the group
+// *pSetString - list of characters to flag
+//-----------------------------------------------------------------------------
+extern void CharacterSetBuild( characterset_t *pSetBuffer, const char *pSetString );
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : *pSetBuffer - pre-build group buffer
+// character - character to lookup
+// Output : int - 1 if the character was in the set
+//-----------------------------------------------------------------------------
+#define IN_CHARACTERSET( SetBuffer, character ) ((SetBuffer).set[ (unsigned char) (character) ])
+
+
+#endif // CHARACTERSET_H
|