Path: blob/master/thirdparty/graphite/src/inc/FeatureVal.h
9906 views
// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later1// Copyright 2010, SIL International, All rights reserved.23#pragma once4#include <cstring>5#include <cassert>6#include "inc/Main.h"7#include "inc/List.h"89namespace graphite2 {1011class FeatureRef;12class FeatureMap;1314class FeatureVal : public Vector<uint32>15{16public:17FeatureVal() : m_pMap(0) { }18FeatureVal(int num, const FeatureMap & pMap) : Vector<uint32>(num), m_pMap(&pMap) {}19FeatureVal(const FeatureVal & rhs) : Vector<uint32>(rhs), m_pMap(rhs.m_pMap) {}2021FeatureVal & operator = (const FeatureVal & rhs) { Vector<uint32>::operator = (rhs); m_pMap = rhs.m_pMap; return *this; }2223bool operator ==(const FeatureVal & b) const24{25size_t n = size();26if (n != b.size()) return false;2728for(const_iterator l = begin(), r = b.begin(); n && *l == *r; --n, ++l, ++r);2930return n == 0;31}3233CLASS_NEW_DELETE34private:35friend class FeatureRef; //so that FeatureRefs can manipulate m_vec directly36const FeatureMap* m_pMap;37};3839typedef FeatureVal Features;4041} // namespace graphite2424344struct gr_feature_val : public graphite2::FeatureVal {};454647