1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * converter.cpp --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * PUT COPYRIGHT NOTICE HERE
|
---|
7 | *
|
---|
8 | * $Id: converter.cpp 164 1999-02-21 22:33:54Z rjmcnab $
|
---|
9 | *
|
---|
10 | *********************************************************************/
|
---|
11 |
|
---|
12 | /*
|
---|
13 | $Log$
|
---|
14 | Revision 1.2 1999/02/21 22:33:54 rjmcnab
|
---|
15 | Lots of stuff :-)
|
---|
16 |
|
---|
17 | Revision 1.1 1999/02/05 10:42:45 rjmcnab
|
---|
18 |
|
---|
19 | Continued working on receptionist
|
---|
20 |
|
---|
21 | */
|
---|
22 |
|
---|
23 |
|
---|
24 | #include "converter.h"
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | // the converters within converterinfo become the property of
|
---|
29 | // of this class after add_converter has been called. The converters
|
---|
30 | // remain the responsability of the calling code and will not be
|
---|
31 | // deleted by this class.
|
---|
32 | void convertinfoclass::add_converter (const text_t &name, inconvertclass *inconverter,
|
---|
33 | rzwsoutconvertclass *outconverter) {
|
---|
34 | // can't add a null converter or an action with no name
|
---|
35 | if (inconverter == NULL || outconverter == NULL || name.empty()) {
|
---|
36 | return;
|
---|
37 | }
|
---|
38 |
|
---|
39 | converterinfo info;
|
---|
40 | info.name = name;
|
---|
41 | info.inconverter = inconverter;
|
---|
42 | info.outconverter = outconverter;
|
---|
43 | converters[name] = info;
|
---|
44 | }
|
---|
45 |
|
---|
46 | // get_inconverter will return NULL if the convert could not be found
|
---|
47 | inconvertclass *convertinfoclass::get_inconverter (const text_t &name) {
|
---|
48 | iterator here = converters.find (name);
|
---|
49 | if (here == converters.end()) return NULL;
|
---|
50 |
|
---|
51 | return (*here).second.inconverter;
|
---|
52 | }
|
---|
53 |
|
---|
54 | // get_outconverter will return NULL if the convert could not be found
|
---|
55 | rzwsoutconvertclass *convertinfoclass::get_outconverter (const text_t &name) {
|
---|
56 | iterator here = converters.find (name);
|
---|
57 | if (here == converters.end()) return NULL;
|
---|
58 |
|
---|
59 | return (*here).second.outconverter;
|
---|
60 | }
|
---|
61 |
|
---|