~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/lib/std/shl/QuarkZone.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ---------------------------------------------------------------------------
 
2
// - QuarkZone.hpp                                                           -
 
3
// - standard object library - quark zone class definition                   -
 
4
// ---------------------------------------------------------------------------
 
5
// - This program is free software;  you can redistribute it  and/or  modify -
 
6
// - it provided that this copyright notice is kept intact.                  -
 
7
// -                                                                         -
 
8
// - This program  is  distributed in  the hope  that it will be useful, but -
 
9
// - without  any  warranty;  without  even   the   implied    warranty   of -
 
10
// - merchantability or fitness for a particular purpose.  In no event shall -
 
11
// - the copyright holder be liable for any  direct, indirect, incidental or -
 
12
// - special damages arising in any way out of the use of this software.     -
 
13
// ---------------------------------------------------------------------------
 
14
// - copyright (c) 1999-2011 amaury darsch                                   -
 
15
// ---------------------------------------------------------------------------
 
16
 
 
17
#ifndef  AFNIX_QUARKZONE_HPP
 
18
#define  AFNIX_QUARKZONE_HPP
 
19
 
 
20
#ifndef  AFNIX_STRING_HPP
 
21
#include "String.hpp"
 
22
#endif
 
23
 
 
24
namespace afnix {
 
25
 
 
26
  /// The QuarkZone class is an administrative class designed to manage
 
27
  /// the class quarks. The class is fed by adding quark in the form of
 
28
  /// string internation. Once created, a quark is locally stored by the
 
29
  /// zone which can report whether or not a quark exists
 
30
  /// @author amaury darsch
 
31
 
 
32
  class QuarkZone {
 
33
  private:
 
34
    /// the zone size
 
35
    long  d_size;
 
36
    /// the zone length
 
37
    long  d_zlen;
 
38
    /// the array of quark
 
39
    long* p_zone;
 
40
 
 
41
  public:
 
42
    /// create an empty quark zone
 
43
    QuarkZone (void);
 
44
  
 
45
    /// create a quark zone with an initial size
 
46
    /// @param size the initial size
 
47
    QuarkZone (const long size);
 
48
 
 
49
    /// copy construct this quark zone
 
50
    QuarkZone (const QuarkZone& that);
 
51
 
 
52
    /// destroy the quark zone. 
 
53
    ~QuarkZone (void);
 
54
 
 
55
    /// assign a quark zone to this one
 
56
    QuarkZone& operator = (const QuarkZone& that);
 
57
 
 
58
    /// reset the quark zone
 
59
    void reset (void);
 
60
 
 
61
    /// @return the number of elements
 
62
    long length (void) const;
 
63
 
 
64
    /// @return true if the quark exists
 
65
    bool exists (const long quark) const;
 
66
 
 
67
    /// intern the string argument and return the associated quark
 
68
    /// @param value the string to intern
 
69
    long intern (const String& value);
 
70
 
 
71
    /// @return the interned quark by index
 
72
    long get (const long index) const;
 
73
 
 
74
    /// @return the interned string by index
 
75
    String tostring (const long index) const;
 
76
  };
 
77
}
 
78
 
 
79
#endif