Changeset 184 for trunk/src/symtab.h


Ignore:
Timestamp:
Jul 20, 2008, 6:39:35 AM (11 years ago)
Author:
cameron
Message:

Create stringpool.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/symtab.h

    r174 r184  
    1010
    1111#include "namechars.h"
     12#include "stringpool.h"
    1213
    1314struct eqstr
     
    2728char * predefined[] = {"lt", "gt", "amp", "quot", "apos"};
    2829
    29 /*  A StringPool object provides managed storage for strings.
    30    It can grow to accommodate as many strings as desired, subject
    31    to space availability.  It is implemented as a vector of
    32    pool buffers.  Initially a single buffer of size initial_capacity
    33    is allocated.  Strings are inserted into this area until insufficient
    34    space remains, at which point a new buffer is allocated for
    35    subsequent insertions.  */
    36 
    37 class StringPool {
    38 public:
    39        StringPool();
    40        ~StringPool();
    41        char * Insert(char * s, int lgth);
    42 private:
    43        int buffer_capacity;
    44        int buffer_space_used;
    45        vector<char *> pool_buffers;
    46 };
    4730
    4831class Symbol_Table {
     
    7962        char * reserved;
    8063        int reserved_lgth;
    81         StringPool * pool;
     64        StringPool<4096,100> pool;
    8265};
    8366
Note: See TracChangeset for help on using the changeset viewer.