// A bijection is a one-to-one mapping. // This particular bijection maps strings to strings. // It also copies anything which is put into it. #include "ut_bijection.h" #include #include "ut_string.h" #include UT_Bijection::UT_Bijection() { m_n = 0; m_first = m_second = NULL; }; void UT_Bijection::clear() { if (!m_n) return; for(int i=0;is1 && items->s2;++items) add(items->s1, items->s2); } size_t UT_Bijection::size() const { return m_n; } const char* UT_Bijection::nth1(size_t idx) const { return ( idx>(size()-1) ) ? NULL : m_first[idx]; } const char* UT_Bijection::nth2(size_t idx) const { return ( idx>(size()-1) ) ? NULL : m_second[idx]; }