diff options
Diffstat (limited to 'Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h')
-rw-r--r-- | Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h b/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h index 9610c39a487..142a00e7e9f 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h +++ b/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h @@ -15,8 +15,8 @@ You should also have received a copy of the GNU Lesser General Public License along with this library in the file named "LICENSE". - If not, write to the Free Software Foundation, 51 Franklin Street, - Suite 500, Boston, MA 02110-1335, USA or visit their web page on the + If not, write to the Free Software Foundation, 51 Franklin Street, + Suite 500, Boston, MA 02110-1335, USA or visit their web page on the internet at http://www.fsf.org/licenses/lgpl.html. Alternatively, the contents of this file may be used under the terms of the @@ -41,7 +41,7 @@ public: FeatureSetting(int16 theValue, uint16 labelId) : m_label(labelId), m_value(theValue) {}; uint16 label() const { return m_label; } int16 value() const { return m_value; } - + CLASS_NEW_DELETE; private: FeatureSetting(const FeatureSetting & fs) : m_label(fs.m_label), m_value(fs.m_value) {}; @@ -56,6 +56,7 @@ class FeatureRef static const uint8 SIZEOF_CHUNK = sizeof(chunk_t)*8; public: + FeatureRef() throw(); FeatureRef(const Face & face, unsigned short & bits_offset, uint32 max_val, uint32 name, uint16 uiName, uint16 flags, FeatureSetting *settings, uint16 num_set) throw(); @@ -64,7 +65,7 @@ public: bool applyValToFeature(uint32 val, Features& pDest) const; //defined in GrFaceImp.h void maskFeature(Features & pDest) const { if (m_index < pDest.size()) //defensive - pDest[m_index] |= m_mask; + pDest[m_index] |= m_mask; } uint32 getFeatureVal(const Features& feats) const; //defined in GrFaceImp.h @@ -75,14 +76,14 @@ public: uint16 getSettingName(uint16 index) const { return m_nameValues[index].label(); } int16 getSettingValue(uint16 index) const { return m_nameValues[index].value(); } uint32 maxVal() const { return m_max; } - const Face & getFace() const { return m_face;} + const Face & getFace() const { assert(m_face); return *m_face;} const FeatureMap* getFeatureMap() const;// { return m_pFace;} CLASS_NEW_DELETE; private: FeatureRef(const FeatureRef & rhs); - const Face & m_face; + const Face * m_face; FeatureSetting * m_nameValues; // array of name table ids for feature values chunk_t m_mask, // bit mask to get the value from the vector m_max; // max value the value can take @@ -97,6 +98,16 @@ private: //unimplemented FeatureRef& operator=(const FeatureRef&); }; +inline +FeatureRef::FeatureRef() throw() +: m_face(0), + m_nameValues(0), + m_mask(0), m_max(0), + m_id(0), + m_nameid(0), m_flags(0), m_numSet(0), + m_bits(0), m_index(0) +{ +} class NameAndFeatureRef @@ -118,7 +129,7 @@ class FeatureMap { public: FeatureMap() : m_numFeats(0), m_feats(NULL), m_pNamedFeats(NULL) {} - ~FeatureMap() { free(m_feats); delete[] m_pNamedFeats; } + ~FeatureMap() { delete[] m_feats; delete[] m_pNamedFeats; } bool readFeats(const Face & face); const FeatureRef *findFeatureRef(uint32 name) const; @@ -135,7 +146,7 @@ friend class SillMap; FeatureRef *m_feats; NameAndFeatureRef* m_pNamedFeats; //owned FeatureVal m_defaultFeatures; //owned - + private: //defensive on m_feats, m_pNamedFeats, and m_defaultFeatures FeatureMap(const FeatureMap&); FeatureMap& operator=(const FeatureMap&); @@ -153,7 +164,7 @@ private: public: LangFeaturePair() : m_lang(0), m_pFeatures(0) {} ~LangFeaturePair() { delete m_pFeatures; } - + uint32 m_lang; Features* m_pFeatures; //owns CLASS_NEW_DELETE |