source: gsdl/trunk/lib/corbaconv_text_t.mpp@ 15428

Last change on this file since 15428 was 14909, checked in by davidb, 16 years ago

Standardisation of Windows config file to lowercase (included from this source file). Was causing a problem when trying to compile on Unix filesystem mounted under Windows.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 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 14909 2007-12-11 20:39:26Z davidb $
25 *
26 *********************************************************************/
27
28#if defined(GSDL_USE_STL_H) || defined(__APPLE__)
29#include <vector.h>
30#else
31#include <vector>
32#endif
33
34// protocol header
35#include "corbaiface.h"
36using namespace gsdlInterface;
37
38#include "corbatext_t.h"
39
40#include "corbaconv_text_t.h"
41
42
43#if defined(GSDL_USE_OBJECTSPACE)
44# include <ospace\std\algorithm>
45#elif defined(GSDL_USE_STL_H)
46# if defined(GSDL_USE_ALGO_H)
47# include <algo.h>
48# else
49# include <algorithm.h>
50# endif
51#else
52# include <algorithm>
53#endif
54
55#ifdef HAVE_CONFIG_H
56# ifdef __WIN32__
57# include "win32cfg.h"
58# else
59# include "mico/config.h"
60# endif
61#endif
62
63
64// #include "unitool.h" // ****
65
66////////////////////////////////////
67// corbaconv_text_t methods
68////////////////////////////////////
69
70corbaconv_text_t::corbaconv_text_t (corbatext_t t)
71{
72 setCorbatext(t);
73}
74
75void corbaconv_text_t::getCorbatext(const text_t& t, corbatext_t &ct)
76{
77 ct.encoding = 0;
78 fillUsString(t,&ct.text);
79}
80
81void corbaconv_text_t::setCorbatext(text_t& t, corbatext_t ct)
82{
83 t.setencoding(0);
84 t.clear();
85 corbatext_usvector(ct, t.text_as_usvector());
86}
87
88void corbaconv_text_t::fillUsString(const text_t& t, usString *us)
89{
90 unsigned int i;
91 usvector::const_iterator here = t.text_as_usvector().begin();
92 usvector::const_iterator end = t.text_as_usvector().end();
93
94
95 if (end == here)
96 {
97 return;
98 }
99 (*us).length(end - here);
100 i = 0;
101
102 while (here != end)
103 {
104 (*us)[i] = *here;
105 i ++;
106 here ++;
107 }
108
109}
Note: See TracBrowser for help on using the repository browser.