File: WordArray.h

package info (click to toggle)
spamprobe 1.0a-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,028 kB
  • ctags: 1,006
  • sloc: cpp: 7,631; sh: 835; ansic: 346; ruby: 178; lisp: 73; makefile: 59
file content (77 lines) | stat: -rw-r--r-- 1,955 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
///###////////////////////////////////////////////////////////////////////////
//
// Burton Computer Corporation
// http://www.burton-computer.com
// $Id: WordArray.h,v 1.3 2003/08/30 21:42:24 bburton Exp $
//
// Copyright (C) 2000 Burton Computer Corporation
// ALL RIGHTS RESERVED
//
// This program is open source software; you can redistribute it
// and/or modify it under the terms of the Q Public License (QPL)
// version 1.0. Use of this software in whole or in part, including
// linking it (modified or unmodified) into other programs is
// subject to the terms of the QPL.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// Q Public License for more details.
//
// You should have received a copy of the Q Public License
// along with this program; see the file LICENSE.txt.  If not, visit
// the Burton Computer Corporation or CoolDevTools web site
// QPL pages at:
//
//    http://www.burton-computer.com/qpl.html
//

#ifndef _WordArray_h
#define _WordArray_h

class WordData;

class WordArray
{
public:
  WordArray(char *buffer = 0,
            int num_words = 0);
  ~WordArray();

  enum {
    ENTRY_SIZE = 8,
    COUNT_SIZE = 3,
    FLAGS_SIZE = 2,
  };

  void reset(char *buffer,
             int num_words);

  void readWord(int index,
                WordData &word);

  void writeWord(int index,
                 const WordData &word);

private:
  /// Not implemented.
  WordArray(const WordArray &);

  /// Not implemented.
  WordArray& operator=(const WordArray &);

private:
  void copyToArray(unsigned char *&data,
                   int length,
                   int number);

  void copyFromArray(const unsigned char *&data,
                     int length,
                     int &number);

private:
  unsigned char *m_buffer;
  int m_numWords;
};

#endif // _WordArray_h