File: container.h

package info (click to toggle)
librudiments0 0.27-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,528 kB
  • ctags: 2,284
  • sloc: cpp: 14,657; sh: 7,547; ansic: 2,664; makefile: 945; xml: 15
file content (56 lines) | stat: -rw-r--r-- 1,767 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2004 David Muse
// See the COPYING file for more information.

#ifndef RUDIMENTS_CONTAINER_H
#define RUDIMENTS_CONTAINER_H

#include <rudiments/private/containerincludes.h>

// The container class provides base class for classes which store related data.

class container {
	public:
			container();
		virtual	~container();

		// These methods control the behavior of the setter methods.
		void	copyReferences();
			// Instructs the setter methods to copy the values
			// passed into them rather than just keeping track
			// of the pointers.
		void	dontCopyReferences();
			// Instructs the setter methods to just keep track
			// of pointers passed into them rather than copying
			// the values.

		// These methods control the behavior when the container
		// is deleted.
		void	cascadeOnDelete();
			// Instructs the destructor to call delete or delete[]
			// (as appropriate) on whatever data is contained in
			// the class.
		void	dontCascadeOnDelete();
			// Instructs the destructor not to call delete or
			// delete[] (as appropriate) on whatever data is
			// contained in the class.  This is the default.

		virtual	bool	save(filedescriptor *fd);
		virtual	bool	save(unsigned char *buffer);
				// Writes a representation of the data in the
				// container out to the filedescriptor or
				// buffer.
				//
				// Returns true on success and false on failure.
		virtual	bool	load(filedescriptor *fd);
		virtual	bool	load(unsigned char *buffer);
				// Loads the data from filedescriptor or buffer.
				// Replaces data currently stored in the
				// container and implies copyReferences() and
				// cascadeOnDelete().
				//
				// Returns true on success and false on failure.

	#include <rudiments/private/container.h>
};

#endif