Source code
/*
* HashEntry.h
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// 2012/04/22 Updated.
// 2015/12/02 Updated.
#pragma once
#include <viz++\Entry.h>
namespace VIZ {
class HashEntry :public Entry {
private:
Key intKey;
char* charKey;
wchar_t* wcharKey;
HashEntry* next;
public:
HashEntry(Key key, Object* object)
:Entry(object, NULL),
intKey (key),
charKey(NULL),
wcharKey(NULL),
next (NULL)
{
}
public:
HashEntry(const char* key, Object* object)
:Entry(object, NULL),
intKey(0),
charKey(NULL),
wcharKey(NULL),
next(NULL)
{
const char* text = key;
if(text == NULL) {
text = "";
}
int slen = strlen(text) + 1;
charKey = new char[slen];
strcpy_s(charKey, slen, text);
}
public:
HashEntry(const wchar_t* key, Object* object)
:Entry(object, NULL),
intKey(0),
charKey(NULL),
wcharKey(NULL),
next(NULL)
{
const wchar_t* text = key;
if(text == NULL) {
text = L"";
}
int slen = wcslen(text) + 1;
wcharKey = new wchar_t[slen];
wcscpy_s(wcharKey, slen, text);
}
public:
~HashEntry()
{
if(charKey) {
delete [] charKey;
delete [] wcharKey;
}
}
void add(HashEntry* entry) {
next = entry;
}
const char* getCharKey(){
return (const char*)charKey;
}
const wchar_t* getWcharKey(){
return (const wchar_t*)wcharKey;
}
const Key getIntKey() {
return intKey;
}
HashEntry* getNext() {
return next;
}
};
}
Last modified: 10 Feb 2017
Copyright (c) 2009-2017 Antillia.com ALL RIGHTS RESERVED.