Ignore:
Timestamp:
Jul 14, 2015, 12:20:32 AM (4 years ago)
Author:
nmedfort
Message:

Force UnsupportedPropertyObject? kind to be UnsupportedProperty?.

Location:
icGREP/icgrep-devel/icgrep/UCD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/UCD/PropertyObjects.cpp

    r4661 r4667  
    9898}
    9999
    100 UnicodeSet BinaryPropertyObject::GetCodepointSet(const std::string & value_spec) const {
     100const UnicodeSet & BinaryPropertyObject::GetCodepointSet(const std::string & value_spec) {
     101    int property_enum_val = Binary_ns::Y;
    101102    if (value_spec.length() != 0) {
    102103        auto valit = Binary_ns::aliases_only_map.find(value_spec);
     
    104105            throw std::runtime_error("Binary Property " + UCD::property_full_name[the_property] +  ": bad value: " + value_spec);
    105106        }
    106         if (valit->second == Binary_ns::Y)
    107             return the_codepoint_set;
    108         return ~the_codepoint_set;
     107        property_enum_val = valit->second;
    109108    }
    110     return the_codepoint_set;
     109    return GetCodepointSet(property_enum_val);
    111110}
    112111
    113 UnicodeSet BinaryPropertyObject::GetCodepointSet(const int property_enum_val) const {
    114     if (property_enum_val == Binary_ns::Y)
    115         return the_codepoint_set;
    116     return ~the_codepoint_set;
     112const UnicodeSet & BinaryPropertyObject::GetCodepointSet(const int property_enum_val) {
     113    if (property_enum_val == Binary_ns::Y) {
     114        return mY;
     115    }
     116    if (noUninitialized) {
     117        mN = uset_complement(mY);
     118    }
     119    return mN;
    117120}
    118121
  • icGREP/icgrep-devel/icgrep/UCD/PropertyObjects.h

    r4661 r4667  
    5454    }
    5555
    56     UnsupportedPropertyObject(property_t p, ClassTypeId k) : PropertyObject(p, k) {}
     56    UnsupportedPropertyObject(property_t p, ClassTypeId)
     57    : PropertyObject(p, ClassTypeId::UnsupportedProperty) {
     58
     59    }
    5760    UnicodeSet GetCodepointSet(const std::string &);
    5861    UnicodeSet GetCodepointSet(const int);
     
    144147
    145148    BinaryPropertyObject(UCD::property_t p, UnicodeSet s)
    146         : PropertyObject(p, ClassTypeId::BinaryProperty)
    147         , the_codepoint_set(s) {
     149    : PropertyObject(p, ClassTypeId::BinaryProperty)
     150    , noUninitialized(true)
     151    , mY(s) {
    148152
    149153    }
    150     UnicodeSet GetCodepointSet(const std::string & value_spec) const;
    151     UnicodeSet GetCodepointSet(const int property_enum_val) const;
     154    const UnicodeSet & GetCodepointSet(const std::string & value_spec);
     155    const UnicodeSet & GetCodepointSet(const int property_enum_val);
    152156private:
    153     UnicodeSet the_codepoint_set;
     157    bool noUninitialized;
     158    UnicodeSet mY;
     159    UnicodeSet mN;
    154160};
    155161
Note: See TracChangeset for help on using the changeset viewer.