Ignore:
Timestamp:
Jun 20, 2015, 3:52:41 PM (4 years ago)
Author:
nmedfort
Message:

Temporary check-in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/UCD/unicode_set.h

    r4189 r4611  
    44#include <vector>
    55#include <ostream>
     6
    67//
    78// unicode_set.h - representing and manipulating sets of Unicode
     
    3839
    3940struct RunStructure {
    40   RunStructure(run_type_t r, uint16_t lgth) : run_type(r), run_length(lgth) {};
     41  RunStructure(run_type_t r, uint16_t lgth) : run_type(r), run_length(lgth) {}
    4142  run_type_t run_type;
    4243  uint16_t run_length;
     
    5859//
    5960//  Nullary constructor for incremental building.
    60     UnicodeSet() : runs(std::vector<RunStructure>()), quads(std::vector<bitquad_t>()), quad_count(0) {};
     61    UnicodeSet() : runs(std::vector<RunStructure>()), quads(std::vector<bitquad_t>()), quad_count(0) {}
    6162//
    6263//  Ternary constructor for constant construction using precomputed data.
    63     UnicodeSet(std::vector<RunStructure> r, std::vector<bitquad_t> q, int c) : runs(r), quads(q), quad_count(c) {};
     64    UnicodeSet(std::initializer_list<RunStructure> r, std::initializer_list<bitquad_t> q, int c) : runs(r), quads(q), quad_count(c) {}
    6465};
    6566
    66     void Dump_uset(UnicodeSet s);
    67     UnicodeSet empty_uset();
    68     UnicodeSet singleton_uset(int codepoint);
    69     UnicodeSet range_uset(int lo_codepoint, int hi_codepoint);
    70     UnicodeSet uset_complement (UnicodeSet s);
    71     UnicodeSet uset_union(UnicodeSet s1, UnicodeSet s2);
    72     UnicodeSet uset_intersection(UnicodeSet s1, UnicodeSet s2);
    73     UnicodeSet uset_difference(UnicodeSet s1, UnicodeSet s2);
    74     UnicodeSet uset_symmetric_difference(UnicodeSet s1, UnicodeSet s2);
    75     bool uset_member(UnicodeSet s, int codepoint);
     67void Dump_uset(UnicodeSet s);
     68UnicodeSet empty_uset();
     69UnicodeSet singleton_uset(int codepoint);
     70UnicodeSet range_uset(int lo_codepoint, int hi_codepoint);
     71UnicodeSet uset_complement (const UnicodeSet &s);
     72UnicodeSet uset_union(const UnicodeSet & s1, const UnicodeSet & s2);
     73UnicodeSet uset_intersection(const UnicodeSet &s1, const UnicodeSet &s2);
     74UnicodeSet uset_difference(const UnicodeSet &s1, const UnicodeSet &s2);
     75UnicodeSet uset_symmetric_difference(const UnicodeSet & s1, const UnicodeSet & s2);
     76bool uset_member(const UnicodeSet & s, int codepoint);
     77
     78class Uset_Iterator {
     79public:
     80    Uset_Iterator(const UnicodeSet & s) : uSet(s), run_no(0), offset(0), quad_no(0) {}
     81    bool at_end();
     82    RunStructure current_run();
     83    bitquad_t get_quad();
     84    void advance(int n);
     85private:
     86    const UnicodeSet & uSet;
     87    int run_no;
     88    int offset;
     89    int quad_no;
     90};
    7691
    7792#endif
Note: See TracChangeset for help on using the changeset viewer.