• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ut_bijection.h

Go to the documentation of this file.
00001 #ifndef UT_BIJECTION_H
00002 #define UT_BIJECTION_H
00003 
00004 #include <stdlib.h>
00005 
00006 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
00007  * so even if it's commented out in-file that's still a lot of work for
00008  * the preprocessor to do...
00009  */
00010 #ifndef UT_TYPES_H
00011 #include "ut_types.h"
00012 #endif
00013 
00014 class ABI_EXPORT UT_Bijection
00015 {
00016 public:
00017 
00018     UT_Bijection();
00019     ~UT_Bijection();
00020 
00021     /* NULL is returned if item not found. */
00022     const char *lookupByTarget(const char *s) const;
00023     const char *lookupBySource(const char *s) const;
00024     void  add(const char *f, const char *s);
00025 
00026     struct pair_data
00027     {
00028         const char *s1,*s2;
00029     };
00030 
00031     /*the array is terminated by record with s1 or s2 == NULL*/
00032     void add(const pair_data* items);
00033     size_t size() const;
00034     const char* nth1(size_t idx) const;
00035     const char* nth2(size_t idx) const;
00036     void clear();
00037 
00038 private:
00039     int m_n;
00040     char **m_first;
00041     char **m_second;
00042 };
00043 
00044 #endif

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1