WvStreams
categorynode.h
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  *
3  * XPLC - Cross-Platform Lightweight Components
4  * Copyright (C) 2000, Pierre Phaneuf
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  */
21 
22 #ifndef __XPLC_CATEGORYNODE_H__
23 #define __XPLC_CATEGORYNODE_H__
24 
25 #include <string.h>
26 #include <stdlib.h>
27 
29 public:
30  CategoryEntryNode* next;
31  UUID entry;
32  char* str;
33  CategoryEntryNode(const UUID& aUuid,
34  const char* aStr,
35  CategoryEntryNode* aNext): next(aNext),
36  entry(aUuid),
37  str(aStr ? strdup(aStr) : 0) {
38  }
40  if(next)
41  delete next;
42 
43  if(str)
44  free(str);
45  }
46 };
47 
48 class CategoryNode {
49 public:
50  CategoryNode* next;
51  UUID category;
52  CategoryEntryNode* entries;
53  CategoryNode(const UUID& aUuid,
54  CategoryNode* aNext): next(aNext),
55  category(aUuid),
56  entries(0) {
57  }
58  ~CategoryNode() {
59  if(entries)
60  delete entries;
61 
62  if(next)
63  delete next;
64  }
65 };
66 
67 #endif /* __XPLC_CATEGORYNODE_H__ */
CategoryEntryNode
Definition: categorynode.h:28
CategoryNode
Definition: categorynode.h:48
_GUID
The structure underlying UUIDs.
Definition: uuid.h:94