From befb3d467e1f1231ecfa63212c3040bd9c1ff1a2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 20 Nov 2002 12:58:14 +0000 Subject: [PATCH] Separate the KeywordExt from the list node that points to it. --- ChangeLog | 8 ++++++++ src/input.cc | 4 ++-- src/keyword-list.cc | 4 ++-- src/keyword-list.h | 9 +++++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07f640d..f1c5d82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2002-11-02 Bruno Haible + * src/keyword-list.h (KeywordExt_List): Don't inherit from KeywordExt. + (KeywordExt_List::KeywordExt_List): Take a KeywordExt* as argument. + (KeywordExt_List::_car): New field. + (KeywordExt_List::first): Use it. + * src/keyword-list.cc (KeywordExt_List::KeywordExt_List): Take a + KeywordExt* as argument. + * src/input.cc (parse_line): Create the KeywordExt separately. + Start using bool. * src/bool-array.h (Bool_Array::set_bit): Change return type to bool. * src/bool-array.icc (Bool_Array::set_bit): Likewise. diff --git a/src/input.cc b/src/input.cc index d57abde..c7b23f6 100644 --- a/src/input.cc +++ b/src/input.cc @@ -299,7 +299,7 @@ parse_line (const char *line, const char *delimiters) } lp++; } - return new KeywordExt_List (key, kp - key, option[TYPE] ? lp : ""); + return new KeywordExt_List (new KeywordExt (key, kp - key, option[TYPE] ? lp : "")); } else { @@ -312,7 +312,7 @@ parse_line (const char *line, const char *delimiters) else /* Skip the first delimiter. */ rest = &line[len + 1]; - return new KeywordExt_List (line, len, option[TYPE] ? rest : ""); + return new KeywordExt_List (new KeywordExt (line, len, option[TYPE] ? rest : "")); } } diff --git a/src/keyword-list.cc b/src/keyword-list.cc index 8aae7f9..7776b5c 100644 --- a/src/keyword-list.cc +++ b/src/keyword-list.cc @@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ #include "keyword-list.h" /* Constructor. */ -KeywordExt_List::KeywordExt_List (const char *s, int s_len, const char *r) - : KeywordExt (s, s_len, r), _cdr (NULL) +KeywordExt_List::KeywordExt_List (KeywordExt *car) + : _cdr (NULL), _car (car) { } diff --git a/src/keyword-list.h b/src/keyword-list.h index d2f8921..0a3f5d3 100644 --- a/src/keyword-list.h +++ b/src/keyword-list.h @@ -26,19 +26,20 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ #include "keyword.h" -/* List node of a linear list. */ -class KeywordExt_List : private KeywordExt { +/* List node of a linear list of Keyword. */ +class KeywordExt_List { public: /* Constructor. */ - KeywordExt_List (const char *allchars, int allchars_length, const char *rest); + KeywordExt_List (KeywordExt *car); /* Access to first element of list. */ - KeywordExt * first () { return this; } + KeywordExt * first () { return _car; } /* Access to next element of list. */ KeywordExt_List *& rest () { return _cdr; } private: KeywordExt_List * _cdr; + KeywordExt * const _car; }; #endif