source: icGREP/icgrep-devel/icgrep/re/re_cc.cpp @ 5781

Last change on this file since 5781 was 5781, checked in by cameron, 16 months ago

Small fixes

File size: 1.7 KB
RevLine 
[3850]1/*
2 *  Copyright (c) 2014 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#include "re_cc.h"
[4286]8#include <llvm/Support/Compiler.h>
[4339]9#include <sstream>
[3850]10
[4194]11namespace re {
[3850]12
[4510]13std::string CC::canonicalName(const CC_type type) const {
[4339]14    std::stringstream name;
[4614]15    name << std::hex;
[5781]16    if ((type == CC_type::ByteClass) && (max_codepoint() >= 0x80)) {
[4613]17        name << "BC";
[4797]18    } else {
[4612]19        name << "CC";
[4510]20    }
[4519]21    char separator = '_';
[4829]22    for (const interval_t i : *this) {
[4339]23        name << separator;
[4614]24        if (lo_codepoint(i) == hi_codepoint(i)) {
25            name << lo_codepoint(i);
[4287]26        }
27        else {
[4614]28            name << lo_codepoint(i) << '_' << hi_codepoint(i);
[4287]29        }
[4612]30        separator = ',';
[3914]31    }
[4339]32    return name.str();
[3850]33}
[4319]34   
[5742]35CC::CC()
[5748]36: RE(ClassTypeId::CC)
37, UnicodeSet() {
[5742]38
[4320]39}
[5742]40
41CC::CC(const CC & cc)
42: RE(ClassTypeId::CC)
43, UCD::UnicodeSet(cc) {
44
45}
46
47CC::CC(const codepoint_t codepoint)
48: RE(ClassTypeId::CC)
[5748]49, UCD::UnicodeSet(codepoint) {
[5742]50
51}
52
53CC::CC(const codepoint_t lo_codepoint, const codepoint_t hi_codepoint)
54: RE(ClassTypeId::CC)
[5748]55, UCD::UnicodeSet(lo_codepoint, hi_codepoint) {
[5742]56
57}
58
59CC::CC(const CC * cc1, const CC * cc2)
60: RE(ClassTypeId::CC)
61, UCD::UnicodeSet(std::move(*cc1 + *cc2)) {
62
63}
64
[5748]65CC::CC(const UCD::UnicodeSet && set)
[5742]66: RE(ClassTypeId::CC)
[5748]67, UCD::UnicodeSet(std::move(set)) {
[5742]68
69}
70
71CC::CC(std::initializer_list<interval_t>::iterator begin, std::initializer_list<interval_t>::iterator end)
72: RE(ClassTypeId::CC)
[5748]73, UCD::UnicodeSet(begin, end)
[5742]74{
75
76}
77
78CC::CC(const std::vector<interval_t>::iterator begin, const std::vector<interval_t>::iterator end)
79: RE(ClassTypeId::CC)
[5748]80, UCD::UnicodeSet(begin, end)
[5742]81{
82
83}
84
85}
Note: See TracBrowser for help on using the repository browser.