class MyHash specification

Key and Value can be registered in a pair. Addition, deletion, reference, and listing can be performed.

Since iterater is held inside, it is not thread safe. Please do not call the same instance from two or more threads. In order to make it thread safe, please inherit this class and carry out the override of a SeekTo function and the Get function. MyContentType.h in a CEHTTP source file will be consulted.

Basic structure

|key1|\0|value1|\0|key2|\0|value2|...|keyN|\0|valueN|\0|\0|

- A terminus is |\0|\0|
- and value permit \0
- Key does not permit \0.

MyHash
+GetBuffer : const void*
+GetLength() : int
+SeekToFirst() : char*
+SeekToKey(in char* pszKey) : char*
+SeekToKeyI(in char* pszKey) : char*
+GetCurrentKey() : char*
+ GetCurrentValue() char*
+ SeekNext() char*
+ Clear() void
+ Set(in char* pszKey, in char* pszValue ) : int
+ Del(in char* pszKey) : int
+ GetValue(in char* pszKey ) char*
+ GetValueI(in char* pszKey) : char*

 


const void* GetBuffer();

The pointer of the allocated memory is returned. With a Set(), a Del(), etc., this pointer becomes invalid.

int GetLength();

The length of the memory pointer which the class has allocated is returned.

char* SeekToFirst();

Internal iterater is set to a head.

char* SeekToKey(char* pszKey);

The given key string is looked for and a corresponding value character sequence is returned. NULL is returned when there is no key string.

char* SeekToKeyI(char* pszKey);

The given key string is looked for and a corresponding value character sequence is returned. NULL is returned when there is no key character sequence. This function does not distinguish a capital letter small letter.

Since the multi-byte character sequence is not taken into consideration, operation in that case is unfixed.

char* GetCurrentKey();

The present key string which internal iterater has pointed out is returned.

char* GetCurrentValue();

The present value string which internal iterater has pointed out is returned.

char* SeekNext();

Internal iterater is advanced. NULL is returned when it is in the last end.

void Clear();

Free the memory.

int Set( char* pszKey, char* pszValue );

A key and a value string are set. A value is overwritten when the key string is already set. In this case, since rearrangement of an internal memory is occurs, the pointer acquired by GetCurrentKey(), GetCurrentValue(), GetBuffer(), SeekToKey(), SeekToKeyI() becomes invalid. This function distinguishes a capital letter small letter.

int Del( char* pszKey );

The specified key string and its corresponding value character sequence are deleted. n this case, since rearrangement of an internal memory is occurs.

char* GetValue( char* pszKey );

The specified key string is searched and a corresponding value character sequence is returned.

char* GetValueI(char* pszKey);

The specified key string is searched and a corresponding value character sequence is returned. This function does not distinguish a capital letter small letter.


yu-ishi@ya2.so-net.ne.jp
Copyright (C) 2003 IshiSoft Allrights reserved.