File: name.h

package info (click to toggle)
powder 118%2Bdfsg1-3
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, sid, trixie
  • size: 10,528 kB
  • sloc: cpp: 55,308; java: 824; makefile: 541; sh: 260; objc: 245; ansic: 107; xml: 55; csh: 54
file content (59 lines) | stat: -rw-r--r-- 1,342 bytes parent folder | download | duplicates (5)
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
57
58
59
/*
 * PROPRIETARY INFORMATION.  This software is proprietary to POWDER
 * Development, and is not to be reproduced, transmitted, or disclosed
 * in any way without written permission.
 *
 * Produced by:	Jeff Lait
 *
 *      	POWDER Development
 *
 * NAME:        name.h ( POWDER Library, C++ )
 *
 * COMMENTS:
 *	This class handles the global namespace which allows
 *	users to name specific creatures or items.  We don't
 *	want to waste 32 bits on a pointer, when there can
 *	only be a few names.  This also simplifies the marshalling,
 *	etc, of names.
 */

#ifndef __name__
#define __name__

#include "buf.h"

// Required one time initialization.
void name_init(int numnames = 0);

// Required load/save functions.  These save the
// actual data of the names.
void name_load(SRAMSTREAM &is);
void name_save(SRAMSTREAM &os);

class NAME
{
public:
    NAME();
    ~NAME();

    // Copy constructor & assignment operators.
    NAME(const NAME &name);
    NAME &operator=(const NAME &name);
    
    const char	*getName() const;

    // Because you can't change an existing name, setName will
    // actually allocate a new myIdx.
    void	 setName(const char *name);
    void	 setName(BUF buf)
		 { setName(buf.buffer()); }

    void	 save(SRAMSTREAM &os) const;
    void	 load(SRAMSTREAM &is);
    
protected:
    u16		 myIdx;
};

#endif