1 /* 2 * Copyright 2011 Google Inc. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "sfntly/port/refcount.h" 18 #include "subtly/character_predicate.h" 19 20 namespace subtly { 21 using namespace sfntly; 22 23 // AcceptRange predicate AcceptRange(int32_t start,int32_t end)24AcceptRange::AcceptRange(int32_t start, int32_t end) 25 : start_(start), 26 end_(end) { 27 } 28 ~AcceptRange()29AcceptRange::~AcceptRange() {} 30 operator ()(int32_t character) const31bool AcceptRange::operator()(int32_t character) const { 32 return start_ <= character && character <= end_; 33 } 34 35 // AcceptSet predicate AcceptSet(IntegerSet * characters)36AcceptSet::AcceptSet(IntegerSet* characters) 37 : characters_(characters) { 38 } 39 ~AcceptSet()40AcceptSet::~AcceptSet() { 41 delete characters_; 42 } 43 operator ()(int32_t character) const44bool AcceptSet::operator()(int32_t character) const { 45 return characters_->find(character) != characters_->end(); 46 } 47 48 // AcceptAll predicate operator ()(int32_t character) const49bool AcceptAll::operator()(int32_t character) const { 50 UNREFERENCED_PARAMETER(character); 51 return true; 52 } 53 } 54