source: branches/corba/gsdl/lib/corbaconv_text_t.mpp@ 1069

Last change on this file since 1069 was 1068, checked in by cs025, 24 years ago

First corba additions: new files

  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1/**********************************************************************
2 *
3 * corbaconv_text_t.mpp -- conversion support text_t <-> corba_text_t
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id: corbaconv_text_t.mpp 1068 2000-04-04 15:11:31Z cs025 $
25 *
26 *********************************************************************/
27
28
29
30#include "corbaiface.h"
31#include "corbatext_t.h"
32
33#include "corbaconv_text_t.h"
34
35
36#if defined(GSDL_USE_OBJECTSPACE)
37# include <ospace\std\algorithm>
38#elif defined(GSDL_USE_STL_H)
39# if defined(GSDL_USE_ALGO_H)
40# include <algo.h>
41# else
42# include <algorithm.h>
43# endif
44#else
45# include <algorithm>
46#endif
47
48#ifdef HAVE_CONFIG_H
49# ifdef __WIN32__
50# include "WIN32cfg.h"
51# else
52# include "config.h"
53# endif
54#endif
55
56
57// #include "unitool.h" // ****
58
59////////////////////////////////////
60// corbaconv_text_t methods
61////////////////////////////////////
62
63corbaconv_text_t::corbaconv_text_t (corbatext_t t)
64{
65 setCorbatext(t);
66}
67
68void corbaconv_text_t::getCorbatext(const text_t& t, corbatext_t &ct)
69{
70 ct.encoding = 0;
71 fillUsString(t,&ct.text);
72}
73
74void corbaconv_text_t::setCorbatext(text_t& t, corbatext_t ct)
75{
76 t.setencoding(0);
77 t.clear();
78 corbatext_usvector(ct, t.text_as_usvector());
79}
80
81void corbaconv_text_t::fillUsString(const text_t& t, usString *us)
82{
83 unsigned int i;
84 usvector::const_iterator here = t.text_as_usvector().begin();
85 usvector::const_iterator end = t.text_as_usvector().end();
86
87
88 if (end == here)
89 {
90 return;
91 }
92 (*us).length(end - here);
93 i = 0;
94
95 while (here != end)
96 {
97 (*us)[i] = *here;
98 i ++;
99 here ++;
100 }
101
102}
Note: See TracBrowser for help on using the repository browser.